Mission Builder: Difference between revisions

From Wiki
Jump to navigation Jump to search
Line 69: Line 69:
=== Terrain Editing ===
=== Terrain Editing ===


Once you have the empty area, it's time to build your race track.  Select XXX mode from the menu.  This will allow you to alter the terrain and sculpt your track out of the barren desert.  You'll see when you move your mouse around that there is a circle on the ground, red in the centre and green around the edge.  This shows the area your tools will affect.
Once you have the empty area, it's time to build your race track.  Select '''Terrain Editor''' mode from the '''Window''' menu, and set Action to '''Adjust Height'''.  This will allow you to alter the terrain and sculpt your track out of the barren desert.  You'll see when you move your mouse around that there is a circle on the ground, red in the centre and green around the edge.  This shows the area your tools will affect.
The default tool is raise/lower.  Hold down the left mouse button and drag up and down, you will see hills and pits created.  You can use Alt-1 to Alt-XXX to change the size of the affected area.  You can also make other changes to it from the XXX menu.
Hold down the left mouse button and drag up and down, you will see hills and pits created.  This is the main way to modify the terrain.  Feel free to stick some hills and pits in hte area around your track.  You can use Alt-1 to Alt-6 to change the size of the affected area.  You can also make other changes to it from the '''Brush''' menu.
To start with, let's use flatten mode.  Select it from the menu, and pick a size 4 brush (Alt-4).  Pick somewhere that looks a bit like the track you want, then click and drag around the area of your track, and you should see the ground start to flatten out and look a bit more like a track.
Next, let's use smooth mode.  Choose a brush slightly wider than your track, then drag the smoothing tool around the track.  This will remove sharp edges and small bumps, making for an easier ride.  It's also useful if you've generated some sharp edges with the other tools, and want to make them look a bit more natural.  '''Flatten''' mode is a more extreme version of this, if you want to give the feel of a more manmade track.
Next, smooth mode.  Choose a smaller brush, then drag the smoothing tool around the track.  This will remove sharp edges and small bumps, making for an easier ride.  It's also useful if you've generated some sharp edges with the other tools, and want to make them look a bit more natural.
Experiment with the other modes if you want - there's a reasonably good undo function if you mess up.  Once you feel the track is ready, it's time to add objects.  Don't get too perfectionist - you can always come back later.
Experiment with the other modes if you want - there's a reasonably good undo function if you mess up.  Once you feel the track is ready, move on to some detailed texturing.
 
Don't forget to recalculate the lighting once you finish adjusting the terrain.  My version of the track now looks something like this:
 
[[File:MB Screen7.jpg]]
 
I decided to have a steep cliff part at the crossroads, so I moved the starting area around to face the other direction.  You can just paint over the darker sand with light sand if you want to remove part of the track.


=== Creating Models ===
=== Creating Models ===

Revision as of 13:25, 14 February 2010

The mission builder is the tool used for creating new race tracks, arenas and scouting areas. I'm going to update this page as I learn more about it, in the hopes that others can bypass some of my mistakes.

Getting the Mission Builder

This is the mission builder (Windows application, 250MB )

http://www.dark-wind.com/missionBuilder/missionBuilder.zip

There's also a Media Encrypter (Windows executable) which is required if you're making your own DIF models using the Torque Constructor:

http://www.dark-wind.com/missionBuilder/mediaEncrypter.zip

Startup

After starting the mission builder, you'll see a screen with a list of vehicles and some buttons on the bottom left. Pick a vehicle from the list (they're the model names rather than the in game names, but most are obvious) and click the "Start Mission" button. It doesn't matter much which one you pick, as they all handle terribly - this is the Torque physics engine, not the Darkwind one. Next, choose a mission. Try looking at some of the missions most similar to the one you want to build, to get an idea of what they look like in the editor.

Basic Controls

Once in the mission, you'll probably find you're looking through the wheels of your car as it falls through the air. Hit tab to switch to third person view. You can drive the car with the mouse or arrow keys to steer and W/S to accelerate/brake. As mentioned it's not very good, but it can give you an idea of where the bumps are on the track.

To get to the editor, press Alt-C to switch to third person camera mode, then F11. If you got it right the mouse wheel will let you move the camera up and down, otherwise you can move the camera up and down with + and - (keypad + and non-keypad -, oddly).

First thing to do is hit F1 and read some of the help. It's mostly accurate and mostly useful, but not everything works the way the help file claims, so be a little careful.

Creating a Race Track

A step by step guide to creating a new racing circuit - a simple figure 8 circuit in a desert area. This tutorial will be aimed at creating a completely new track from scratch. If you want quicker results, you could try just changing the obstacles around on an existing track to produce a new route - in that case, skip ahead to the section on creating models. Start a new mission (enter an existing mission, then create a new one from the file menu), then enter the editor mode as described above. You'll see something a bit like this:

The most important menu is Window, which switches between the different editing modes. We'll go through them in the order they're needed. Notice that they're split into two groups, one to do with models and one to do with terrain. You can do the same actions in most modes in the same group, but the interface will change. We'll start by generating the terrain.

Terrain Generation

First, we want to create a new area to set our track in. This is done using the Terrain Terraform Editor mode. Select this mode, and you'll see the bar on the right look something like this:

The section at the bottom is the list of all transforms which will be applied to the terrain. You can probably do some very clever things with this (at least if you're more skilled than I am) but we'll keep it simple. If there are any transforms other than General, delete them. Now, click on General. This shows the basic settings for your terrain. Height Range is how high the other transforms are allowed to make mountains, and Min Terrain Height is how low the valleys can be. It's worth setting the min height to be more than zero so that you can dig some pits later on, if you want to. Set range to 25 and min to 50. The slider sets the water level, but this is supposed to be a desert track (and I don't know how it works yet) so let's leave it on zero.

Now we need to create the terrain. Click on the Operation button, and select fBm Fractal. This uses a fractal algorithm to generate fairly realistic hills and valleys. The default parameters should be OK to give us an area of low rolling hills (these are going to be sand dunes, maybe somewhere near Somerset). Now hit "apply", and your terrain will be generated. It should look similar to (but not the same as) this:

If you don't like it, press the New Seed button to re-randomise, fiddle with the settings if you want, and hit Apply again. Once you have something that looks OK, it's time to add some colour.

Texture Painting

First, we just want to put a basic sand texture across the whole map. Select Terrain Texture Editor mode. The tool bar should look like this:

Delete all the default materials, then press Add material. The sand texture used most around Somerset is afrika9, so choose that. Now press Apply, and you should see the desert texture across your map. There will probably be some odd-looking dark patches though. This is because the shadows of hills and valleys aren't recalculated when you modify the terrain. Press Alt-L to relight the scene, and you should end up with something that looks like this:

This might be a good time to save.

OK, now we nedd to make the track. I find it easier to draw the track on with textures first before sculpting the terrain, so choose Terrain Texture Painter mode. The eight boxes on the right are the eight textures you can use for this mission. It's a little restrictive, but you can blend textures together to get some nice effects. Press the Add button under one of the empty slots (only one will work), and choose afrika9dark.

You've probably noticed the circular green and red cursor when you move your mouse around the terrain. This is the brush used for all terrain operations (sculpting, painting etc.). The red area gets the full effect and the green area gets partial effect. You can change the siza and shape in the Brush menu. For now, set it to size 9x9, and draw on a rough outline of your track, something like this:

You can't see the whole thing due to depth fog but trust me, it's a figure 8. You'll also want to add in an area for the cars to start, if they don't start on the track (and it makes it a little easier later on if they don't).

OK, track laid out. The next step is to flatten out the track surface and add in hills and so on.

Terrain Editing

Once you have the empty area, it's time to build your race track. Select Terrain Editor mode from the Window menu, and set Action to Adjust Height. This will allow you to alter the terrain and sculpt your track out of the barren desert. You'll see when you move your mouse around that there is a circle on the ground, red in the centre and green around the edge. This shows the area your tools will affect. Hold down the left mouse button and drag up and down, you will see hills and pits created. This is the main way to modify the terrain. Feel free to stick some hills and pits in hte area around your track. You can use Alt-1 to Alt-6 to change the size of the affected area. You can also make other changes to it from the Brush menu. Next, let's use smooth mode. Choose a brush slightly wider than your track, then drag the smoothing tool around the track. This will remove sharp edges and small bumps, making for an easier ride. It's also useful if you've generated some sharp edges with the other tools, and want to make them look a bit more natural. Flatten mode is a more extreme version of this, if you want to give the feel of a more manmade track. Experiment with the other modes if you want - there's a reasonably good undo function if you mess up. Once you feel the track is ready, it's time to add objects. Don't get too perfectionist - you can always come back later.

Don't forget to recalculate the lighting once you finish adjusting the terrain. My version of the track now looks something like this:

I decided to have a steep cliff part at the crossroads, so I moved the starting area around to face the other direction. You can just paint over the darker sand with light sand if you want to remove part of the track.

Creating Models

OK, we have a textured terrain area with cliffs and roads drawn in. The next step is to add scenery and obstacles.

Waypoints, Checkpoints and Spawn Areas

Notes

  • When adding objects to a scene, if they are solid black it's because you need to recalculate lighting (takes a while)
  • Scene Groups can be found under Mission Objects -> System. Alt-click to add newly created objects to the group.
  • Each map has a maximum of 8 textures. If you load another texture, it replaces the one you had in the slot before.
  • Press F1 for help. Most of it seems accurate, and there's some useful info in there.

Info dump of Sam's forum posts on the subject:

I know some of you guys are interested in trying out the mission builder... so here's some quick links and instructions.

If you produce something useable in the game, great! If not, no problem!

This is the mission builder (Windows application, 250MB )

http://www.dark-wind.com/missionBuilder/missionBuilder.zip

There's also a Media Encrypter (Windows executable) which is required if you're making your own DIF models using the Torque Constructor:

http://www.dark-wind.com/missionBuilder/mediaEncrypter.zip


To start editing a mission: Choose a vehicle and click 'start mission' then choose the mission. Once in the game, press TAB to move the camera back behind the vehicle (otherwise you're stuck inside it). Driving around is a good way to make sure the track is the right size and that the ground is flat/bumpy as appropriate. Use the mouse to steer and W/S to accelerate/brake Use ALT/C to separate camera from vehicle I know the cars drive very badly, its based on the default vehicle physics; I have improved things quite a bit in the real game, but this mission builder is based on a default Torque build.

The best way to learn about how missions are set up is to open a few and examine them. There's a bunch of finished and half-finished ones in the Mission Builder. (Some aren't very good and were never added to the game).

MissionArea

centrePoint = "303.000000 77.000000"; This is the centre point of the mission (2 numbers: X Y only, the up direction (Z) is ignored)

fixedRadius = "482"; How far the camera should be allowed to go from that centre point


Checkpoints ONLY USED ON RACETRACKS You need a set of these, probably between 5 and 10 of them. In fact, the more the better. Make sure they overlap the track boundaries generously, so we don't penalise people who drift over the edges a little.

Each checkpoint is a Trigger object: checkpoint = "1"; This numbers the checkpoints (pretty obvious I guess) so we can tell that they're being visited in the right order to finish a lap without taking illegal shortcuts. isLast = "1"; Only the final checkpoint has this value. Note that the final checkpoint needs to precisely line up with the start/finish line. The finish line is just an object, no special data needed. In fact I've used things like orc's clotheslines and hitching posts blown up to massive proportions.. ;-)


Spawn Areas RACETRACKS HAVE 1 SPAWN AREA ONLY The spawn area is specified by using two SpawnSpheres inside a SimGroup called PlayerDropPoints. These two SpawnSpheres show the opposite corners of a rectangle into which the cars will be spawned. The first is the 'front' of the starting grid and the second is the 'back' of the grid. The rotation of the first SpawnSphere will be the rotation that cars are spawned at.

Alternatively, you can out a full set of 25 SpawnSpheres into the PlayerDropPoints SimGroup. This specifies precise locations rather than have the server fit them all within an area.

ARENAS HAVE EXACTLY 2 SPAWN AREAS (Open up SomersetMineArena.mis to see) Now we have 4 SpawnSpheres inside PlayerDropPoints. The first 2 points delimit the first team's spawn area, and the last 2 delimit the second team's spawn area.

WILDERNESS ROADS HAVE SEVERAL SPAWN AREAS PlayerDropPoints1Pirate and PlayerDropPoints1Trader are two SimGroups containing either 4 or 25+ SpawnSpheres. If they have 4, then they delimit the front-left, front-right, rear-left, and rear-right corners of an area. If they have 25+ then these are precise spawn locations. Note that the Y axis is the forward direction of the car.

To have additional spawn locations on a wilderness map, use PlayerDropPoints2Pirate, PlayerDropPoints2Trader etc. – are SimGroups containing SpawnSphere objects.

AmbushPoints1Pirate, AmbushPoints2Pirate etc. are optional extra SimGroups containing 25+ SpawnSphere objects.


Waypoints

Open a .mis file and look for a Path object called CarPath. In this are Markers (which are the actual waypoints the NPC cars use). The names and seqNum values are ignored: it's only the order of them that matters. Their important fields are: __scale __- this is the actual size of the waypoint. The NPCs aim towards their centre, but as soon as they cross the boundary of the one they're heading for, the immediately aim for the next one. Notice how they're set up on some of the key corners, to make the NPCs turn into the apex at the right time. __speed __- the speed the NPCs should aim to be at when they hit the waypoint. This is actually metres per second: multiply by 2.25 to get mph. As a rule of thumb, I use 200 for a waypoint you can take flat-out, maybe 40 for ones that can almost be done flat-out, and anything down to about 20 or 25 for tighter corners. __mustNotAvoidCars__ - give this field the value 1 if the waypoint is too dangerous to do anything silly like avoid enemy cars or mines, since there are walls etc. too close nearby. __isOffroad __- this takes 2 possible values, or can be omitted. A value 1 means this waypoint is only for offroad vehicles (e.g. the buggy or the landrunner) to use (they have better tyre friction and this can be significant in places where other cars slide a lot). A value 2 means this waypoint is only for non-offroad vehicles. If you omit the isOffroad field then all cars use the waypoint.

RACETRACKS HAVE 1 CARPATH

ARENAS HAVE BETWEEN 2 AND 4 CARPATHS (open up SomersetMineArena.mis.waypoints and you'll see the first is called CarPath and the second is called CarPath2. The first is the path that cars from the first team start to drive on until they decide there's something better to do. The second is the path the second team start to drive on at the beginning of the combat.

Never make an angle of more than about 70 degrees between 2 subsequent waypoints, otherwise the NPCs can get confused and might turn the 'long way around' to face the way they need to go.

WILDERNESS MAPS HAVE 1 OR MORE CARPATHS. The key thing here is to recognise that the terrain repeats itself, and the CarPaths need to connect to themselves or another CarPath in order to provide data for the NPCs to drive the road over multiple terrain repetitions. It can get a bit confusing, but if you stick to a single carpath that covers exactly 1 terrain repetition then it will work fine. More complex terrains are harder (take a look at gates of somerset for example).

Some extra notes on getting waypoints and checkpoints right:

Waypoints:


These are 'Marker' objects that must be inside a path called 'CarPath' Do not apply any rotation to them as it will be ignored by the AI code and it therefore misleading Make sure they are not narrow in any direction. The way the AI cars use these is that they aim for the centre of the waypoint, but as soon as they cross the waypoint edge, they then switch to the *next* waypoint. So a narrow waypoint will cause erratic driving. They need one dynamic field: --> 'speed' is the maximum speed that should be driven when close to this waypoint. It is measured in metres per second (1ms = 3.6kmh = 2.25mph)


Checkpoints:


These are 'Trigger' objects and must use the 'CheckPointTrigger' datablock You *can* apply rotations to checkpoints Make sure their bases are below ground so cars don't pass under them. Make sure their tops are nice and high too, just in case cars are airborne etc. They need to have two dynamic fields added: --> 'checkpoint' takes the checkpoint number (starting at 1) --> 'isLast' takes the number 0 or 1. The checkpoint that lines up with the start/finish line is the only one that should have 1 for this value. Note that this should also be your *final* checkpoint, not your first one.

Spawn Spheres:


The order of these, rather than their name, determines their position on the grid