Mission Builder

From Wiki
Jump to navigation Jump to search

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 need 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 the 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 roads drawn in. The next step is to add scenery and obstacles. Go to World Editor Creator mode. The toolbar on the right should look something like this:

caption
caption

The top part of the toolbar shows the objects currently in the scene - currently just the default ones. The tree view at the bottom lists all the objects you can add. There are a lot. Play around and try out various different models. I'm mostly just going to be using the Darkwind track barriers, which are in the dwBarriers folder. To create one, just click on it and the model will be created wherever the camera is looking. Should look something like this:

The object is black because we haven't recalculated the lighting yet. Do that and it looks like this:

You can move the object by grabbing and dragging the axes, or the object itself. Alt-drag will rotate, and control-alt-drag will scale. Holding down shift aligns the axes to the world rather than the object (only needed if you've rotated it). Put a few barriers and obstacles around your track, and don't forget to save regularly. In the next section we'll look at the mechanics of making your track usable by the AI.

Here is my track after adding the obstacles and barriers. Don't forget the start line!

Waypoints, Checkpoints and Spawn Areas

There are three types of object we need to add for the race track to work. There will not be visible in the game, but control the logic of the race. Waypoints tell the AI where to drive, checkpints make sure players drive around the track correctly, and spawn points tell the game where the cars should be placed at the start of the race.

We'll start with spawn points, but first we need to quickly cover SimGroups.

SimGroups

SimGroups are just containers that you can put other objects in. Sometimes they're necessary (as we'll see for spawn points) and sometimes they're just a way of keeping your object list tidy. You can find them at the very bottom of the list of objects, under System. When you create one you'll be asked to give it a name, but it won't appear in the mission, it just exists in the tree view. They're also a pain to delete, so try not to create more than you need.

Create one now to store some objects you created. When it appears in the tree view, alt-click on it and the background will change colour. This is now your active SimGroup, and any new objects (including other simgroups) will be created inside it. To stop that, just alt-click on MissionGroup, which is your main SimGroup which stores the whole scene. A highlighted SimGroup looks like this:

I've created a SimGroup called PitBarriers to hold the barriers around the pit (imaginative, huh?) and highlighted it. If I create a new object it will be added to that group, or I can add all the barriers by selecting them (ctrl-click for multiple selection) and choosing Add Selection to Instant Group from the World menu. Now if I select the simgroup I can move, rotate or scale all the barriers at once.

OK, that's enough about simgroups for now, on to the interesting part.

Spawn Areas

First, create a SimGroup called PlayerDropPoints to hold all the spawn points (don't forget to make MissionGroup active first). We're going to need 25, one for each car in a maxxed out race. With PlayerDropPoints set as your active group, create a SpawnSphereMarker (found in Shapes->Misc). What you get looks something like this:

It's too big, but we can fix that. Select World Editor Inspector from the Window menu. The bottom of the right hand bar looks like this:

I pressed Expand All so you can see everything. This mode lets you manually set positions, rotations, scales and other attributes of objects. You need to press Apply after every change or it'll lose your edits. In this case, we want to change the radius down to something sensible. Set it to two then hit apply, you should see something like this:

Much more sensible. The box next to apply is for naming your spawn points. Call this one spawn1. This is where the car in pole position will spawn. The y axis shows the direction it will be facing. Couple of useful tips here - copy and paste will make it much less painful to do the other 24, and ctrl-D will drop the object, making it sit on the ground. Useful if you end up with a spawn point in mid air. Now go ahead and create the other 24. The finished product should look something like this:

I'm pretty sure it's the order of points in the container which determines which car goes where rather than the name, so it's less confusing if you keep the two the same.

Checkpoints

The number of checkpoints you need depends on the details of your track. You need enough to make sure the drivers don't take any shortcuts, or at least not ones you haven't planned. More is usually better if you're not sure.

Checkpoints are Trigger objects of the type CheckPointTrigger. You can find them in Mission Objects->Mission, and creating one gets you a popup like this:

Pressing the button allows you to select the type of trigger. You can call it whatever you want, but I'm just going to call mine checkpoint1. This will be the first checkpoint after the start/finish line.

Hitting OK will get you a tiny yellow box. You need to resize this to go across your track - the controls are the same as for other objects. Make sure you cover the whole track out as far as someone could legitimately drift. It also needs to be set into the ground, and go high enough to catch jumps. Mine looks like this:

I decided to extend it a long way out to the right, in case someone drifts up there by mistake. It's set inside the barrier on the left. The actual checkpoint is the angled red cuboid here - the yellow box is just a bounding box, it's the inner one cars will use. Now we just need to add a couple of parameters to the object. In World Editor Inspector mode you can use the Add button next to Dynamic Fields to create new parameters. These are name/value pairs. Create one called isLast with a value of zero, and one called checkpoint with a value of one. The result should look like this:

The checkpoint value sets the order cars have to pass through the checkpoints, and isLast sets whether going through the checkpoint ends a lap. You should now be able to go round and create all the checkpoints for your track. Make sure the last one is properly lined up with the finish line, and set isLast to 1.

Important point - copying and pasting a trigger will sometimes leave you with the previous object selected instead of the new one. Make sure you know what you're editing the name of!

Waypoints

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