EA official tutorials:
Terrain editor
Leveleditor
Custom Mod Setup
Understanding Heightmaps
Build the Bunker - 3ds Max
Build the Bunker - Maya
Import the Bunker
Build the Car - Maya
Import the Car
Create new team - Maya
Create new team - 3ds Max
Create new kits - Maya and Max

Mapping - General
Setup FH2/bf2editor
FH2 mapping guide
FH2 mapping standards

Mapping - Texturing
Texture system in bf2
Terragen skies
Terragen texturing

Mapping - Heightmaps
World Machine
Geocontrol and bf2hmt

Mapping - Lightmapping
Simple lightmap setup

Mapping - Downloads
Sky settings bf2
Water settings bf2
Lowdetailtextures/settings bf2

3D modelling/texturing
Skinning the Daimler Dingo

Coding

Battlefield 2 Modding Tutorial 7 - Importing and Editing the Basic Car

by [EA]Lawrence Brown

 

Revised – 8/19/05

 

In this tutorial I will show you how to “import” the car from the previous tutorial and make all the necessary edits to get it into the game using the Object Editor.

 

Please note: This tutorial is written to cover the steps for users of both Maya and Max. Where the steps differ, they will be labeled accordingly. Just follow the instructions for whichever program you are using.

   

Set-up: n

This tutorial assumes you have done one of the following:

Maya – you have completed tutorial 6, “Building the Car” and have created the file “My_Car.mb

 

Max – You have completed tutorial 6, “Building the Car – Max” and have exported the car using the wizard, placing the correct files and textures as directed in the tutorial.

 

 

Importing:

The term “importing”, when applied to the editor, can be a bit misleading. If you use Maya, then you will import using the editor. If you use Max, you actually export with the BF2 Max tools and just open the object in the editor. We will go through both methods now.

 

Maya –

If you are using Max for modeling, skip to the section titled “Max –“

 

  1. Launch the editor and select “MyMod” at the startup screen.
  2. Switch to the Object Editor.
  3. From the main menu, select “File>Import”.
  4. In the browser window that pops up, select “My_Car.mb”:

 

  1. Press “OK” to begin the import process. A command line window will appear for a few moments and then close again:

 

Note: if you get an error message at the end of this saying errors have occurred, press “OK” to close this window. Look in the output window at the bottom of the editor for the error messages.

 

If the error messages are something like “Move failed. Could not find texture file: …”, then you probably don’t have your files, especially the texture files, placed in the correct directories. Remember that the texture directory you get the textures from should be in your RawData path, not the final destination in your mod.

 

There may also be an error message that starts with “Ignored Warning[Console] : Properties only takes one argument!: …” This error is safe to ignore and just means that there is a space in the name of your computer or the user name. The editor writes the name of the creator to each con file and doesn’t like spaces, but it doesn’t hurt anything.

 

  1. After importing, to be sure everything is in the right place, be sure that the “my_car” directory in your mod contains the following files and is in the following path:

 

Back in the editor, the important thing to look for is that you should now see a folder named “my_car” in the list under “MyMod”, and inside that folder should be a file also named “my_car”:

 

  1. You have now completed the importing of the car from the Maya file. Drag the file “my_car” from the list to the main window. (Note: You must drag the actual file to the window, not the folder above it with the same name!)

 

You should now skip ahead to the section titled “Editing the Car”.

 

Max –

If you are using Max for modeling, you use the exporter in the BF2 Max tools rather than the import function built into the editor.

 

This tutorial assumes that you’ve exported the car from Max and copied the “textures” folder to the correct place in your mod so that you end up with a directory structure like the following:

 

  1. Check the above screenshot to be sure that your directory structure matches and all the files are in the correct places.
  2. Launch the editor and select “MyMod” from the Startup Mod window.
  3. Switch to the Object Editor and expand the “MyMod” folder to find the folder “my_car”. Inside this folder you will find a file with the same name:

 

  1. Drag the file “my_car” from the list to the main window. (Note: You must drag the actual file to the window, not the folder above it with the same name!)

 

 

Editing the Car:

Now that you’ve gotten the car into the editor, the following steps are the same regardless of which modeling program you use. There will be a few minor discrepancies that will be noted as we go, but the process is the same.

 

  1. If you haven’t already, drag the file “my_car” into the main window of the editor. It should look like this:

 

The Car Wizard:

What we currently have is the basic car with a few basic components. Before we can actually place it in the game, we still need to add some info and set some options. We will do that with the car wizard.

 

  1. On the right side of the screen, scroll down until you see a button labeled “Wizard”.
  2. Click on this button to open the roll-out.
  3. In the selection box in this section, click on it and choose “Car”.
  4. With “Car” selected, click the “Run Wizard” button. A new window will open up labeled “My_Car”:

 

There are three sections to the wizard window:

  • “Errors” are things that we must fix for the vehicle to work in the game.
  • “Warnings” are helpful hints for things that you may or may not want to change.
  • “Utilities” are usually things that should be done to make the vehicle work correctly. You can adjust these settings here or individually in the editor itself.

 

  1. Expand all three sections and check all the boxes in “Errors” and “Utils”. (It’s not possible to check the boxes next to “Warnings”. The window should now look like this:

 

  1. After checking all the boxes, press “Execute”.
  2. Several windows will pop up with the label “Enter string”. There is a second label inside each window just above a text entry box. Enter the following for each of the text boxes that come up:
  • “Enter new Camera name” – You can label this anything you like. I always just append “ Cam ” to the end of the name, so in this case it would be “my_car_Cam”:

  • “Enter new EntryPoint name” – This one I always append with “Entry””

 

  1. After this another window will pop up saying “Util Completed Successfully!”. Click on “OK” to continue.
  2. Yet another window will come up Labeled “Adjust Strength/Damping”. This should by default have all the boxes checked. Click “OK” to continue again:

 

(Max Users – the labels will read “whl_BL” and so on instead of “My_Car_BL”.)

 

  1. More text entry boxes will come up. Look for the label just above the entry box and do the following:
  • “Enter new damping” – Set the value to 4:

  • “Enter new strength” – Set the value to 30:

Note: These are the values based on the jeep. They are just something to start with. You will most likely want to adjust them later.

 

  1. Another window will pop up saying “Util Completed Successfully!”. Click on “OK” again.
  2. Still another window will open up Labeled “Adjust G rip: Select objects to affect”. For now just make sure all boxes are checked. They should be by default:

 

(Max Users – the labels will read “whl_BL” and so on instead of “My_Car_BL”.)

 

  1. Click “OK”. This brings up another window labeled “Enter new grip”:

 

  1. Take a second to look at the options. These are different kinds of “wheels” you can apply to your vehicle. When you’re done, choose “P G FEngine G rip”.

 

Note: This option is for wheels that are attached to the engine, like the drive wheels on a car. Since we had the checkboxes for all four wheels selected, this turns our car into a 4-wheel drive vehicle, which is fine for now.

 

  1. After making your selection, click “OK” again.
  2. A final “Util Completed Successfully” notice will come up again. Click “OK” to finish using the wizard.
  3. At this point you should be back to the initial wizard screen. This time click “Done” to close it.

 

Testing the Default Wizard Options:

At this point we have technically set up everything we need to get the car into the game, but let’s take it for a test drive before we go any further.

 

  1. On the right side of the editor, scroll back up to the top and click on the button labeled “Enable physics”. You may see the car bounce a little bit as it “settles” on the springs we set up for the wheels.
  2. Click on the button labeled “Input” just above the previous button. This will allow us to control the car as if we were in the game.
  3. Before doing anything else, find the drop-down box just below the Input button. Click in this box and select “Locked on target”. This will make the camera in the editor follow the car wherever it goes. Otherwise you would just drive out of the screen and lose the car. We are now ready to drive the car:

 

  1. Move the cursor so that it is over the main window and press the Spacebar once. (This will not work if the cursor is anywhere else)

 

You have now toggled “Control” mode. The editor uses the default BF2 input scheme, so holding down “W” should make the car move forward, but it doesn’t. The car doesn’t move at all. This is because there are a few things we need to fix that the wizard doesn’t get right.

 

Setting Additional Default Settings:

We will now make a few additional settings that will “fix” our broken car.

  1. As usual, press “Escape” to exit out of control mode and return the cursor to normal usage.

 

Note: You may also have to press the “Free” button on the right side of the screen in order to be able to move the camera around again.

 

  1. On the left side in the Resource bar, click on the line labeled “My_Car_Engine. You may have to expand “my_car” if you don’t see it.

 

(Max Users – This will be labeled “zMotor” instead of “My_Car_Engine”.)

 

  1. With “My_Car_Engine” (or “zMotor”) selected, go to the Tweak bar and expand the section labeled “Physics”.
  2. Look about half-way down for the entry labeled “EngineType”. Click on the box to the right and change this to “NewCar2”. Look at the following screenshot for where to find these entries:

 

The reason we need to do this is because “NewCar2” is a type of engine that was added to the game after the wizard was created. By default the wizard sets the engine to “NewCar” (or “Car” if you are using Max), which is no longer used by the game.

 

Note: when working with the resource and Tweak bars, you may sometimes have to make them wider to get at the entries. You can do this by holding your cursor over the vertical edge of the window until it becomes a pair of horizontal arrows, then drag to make the window wider. In the above screenshot I’ve make the windows pretty wide so you can see the entries.

 

We are now ready for another test drive.

  1. Over on the right, locate the button labeled “Reload Object” and press it.

 

You may notice the car jump a bit. We do this to apply the changes we just made to the engine. This isn’t always strictly necessary, but if you find you’ve made some changes and there doesn’t seem to be any difference to your vehicle, try pressing this button to be sure all your changes were applied.

 

  1. Reloading the object resets some of the buttons on the right, so click on “Input” again and make sure that “Enable Physics” is still active. Also make sure that the camera follow mode is still set to “Locked on target”.
  2. Make sure the cursor is over the main window and press the Spacebar again. Now you should be able to drive around using the default W, S, A, and D keys.

 

Oops! The car move forwards and backwards now, but doesn’t turn. That’s because the wizard pretty much only sets options that are necessary to get the vehicle into the game. We still have to set up some rotation on the steering.

 

Setting up the Steering:

 

  1. Press Escape to get out of control mode.
  2. In the Resources window, expand the “My_Car_Engine” entry (or “zMotor”).
  3. Find the entries labeled “My_Car_nav_FL” and “My_Car_nav_FR” if you are using Maya, or “whl_Nav_FL” and “whl_Nav_FR” if you are using Max.

 

These are the rotational bundles that were set up in the modeling program for steering. “nav” means “navigation”, which is just a fancy way of saying “steering”.

  1. Click on “My_Car_nav_FL” (or ““whl_Nav_FL”) to bring up the values assigned to it in the Tweak bar.
  2. In the Tweak bar, expand the entry for “Rotation”.

 

The first two entries in this section are “MinRotation” and “MaxRotation”. We will use these to set up the minimum and maximum that each wheel can turn to the left and right.

  1. Expand the “MinRotation” entry.

 

Notice there are 3 separate entry fields labeled X, Y, and Z. In almost all the Battlefield files, these three numbers stand for either translation or rotation. In this instance they are rotation and stand for Yaw, Pitch, and Roll, respectively. (Yaw is basically turning left or right while Pitch is rotating up and down. Roll doesn’t often get used.)

  1. In this case we want to set the minimum Yaw for the wheel, or how far left it will turn, So click on the box next to “X” under “MinRotation”, enter “-30”, and hit return.
  2. Now do the same for “MaxRotation, setting the “X” value to “30”.

 

We have now set up the Front-Left wheel to turn a maximum of 30 degrees to the left and right. There are more settings though, so let’s continue.

  1. Locate the entry labeled “MaxSpeed” and expand it.
  2. Enter “40” into the “X” field.

 

This is how “fast” the wheel will turn.

  1. Locate the entry labeled “Acceleration” a little further down, expand it, and enter “80” into “X”.

 

Since you are using a keyboard for input instead of a steering wheel, this is a way to simulate steering. Acceleration in this case is similar to the engine: the longer you hold down the key, the “faster” the wheel turns until it reaches its maximum setting. You will have to play with these settings until you get them the way you like them.

 

Notice that in all these entries, we’ve been entering numbers in the “X” field. These are all “Yaw” values. Make sure that you keep them straight because they all correspond to each other. If the rotational bundle was something like a gun turret that rotated in both the X and Y axis, you would have numbers in both these fields.

 

  1. Locate the entry labeled “InputToYaw”. This is where you tell the game which keys to use to control what. In this case the Yaw input is the steering.
  2. Click on the field to the right where it says “PINone” and change this to “PIYaw”, which stands for “Player Input Yaw”. (It’s the very first entry in the list, so you have to scroll to the top of the drop-down window.)
  3. The last thing to do is locate the entry just a bit below this labeled “AutomaticReset”. Check the box to the right of it to turn the option on.

 

What this does is automatically return the wheels to their default position of pointing straight forward when we stop pressing the steering buttons. If we didn’t do this, the car would keep spinning in circles every time we stopped pressing the button.

 

If you had any trouble following the above directions, look at this screenshot. I’ve highlighted everything you need to set with the correct values:

 

  1. Now select “My_Car_nav_FR” in the Resource bar and do the same for the Front-Right wheel. Make sure that all settings are exactly the same.

 

G ive it a test drive again and try out the steering. Don’t forget to click the “Reload Object” button if the changes don’t seem to be working. You also may wish to click “Reset Vehicle Position” if you had previously driven the car off into the distance. You should now be able to drive the car all over the grid.

 

Note that the wheels may tend to “slip” a little on the surface. This is because of the default material used on the grid in the editor. The only way to get a real feel for how it handles is in the game itself, which we will get to later. The editor just provides an approximation.

 

Editing the Engine:

You’ve probably also noticed by now that the car moves rather slow and doesn’t seem to have much power. We’ll change that now.

  1. Press Escape to get out of control mode again. You may also wish to press the “Reset Vehicle Position” button to return the car to the center of the grid. If your camera control is still set to “Locked on target”, the camera will be pointed at the car. If not, you may also want to click on “Zoom to Object”. This moves the camera back to point at the car.
  2. In the Resources bar, click on “My_Car_Engine or “zMotor” again.
  3. In the Tweak bar, expand the “Physics” section.
  4. In the Physics section, set the following values:

·        Torque                   30

·        Differential  5

·        NumberOf G ears     3

·        G earUp                  .85

·        G earDown             .5

·        G earChangeTime    .7

 

Use the following screenshot as a guide:

 

  1. Once you’ve changed these settings, scroll down in the Tweak bar and expand the “Rotation” section.

 

The rotation settings for an engine work slightly differently than when applied to a rotational bundle. In this case the entries are actually used as a kind of throttle. All these settings will be explained in detail in a seperate tutorial.

  1. In the Rotation section, set the following values (Notice that you are changing the “Z” value for most of these):

·        MinRotation           0/0/-1

·        MaxRotation          0/0/1

·        MaxSpeed             0/0/5000

·        Acceleration           0/0/10

 

Use the following screenshot as a guide:

 

All other settings should be left at their defaults. You are now ready for another test drive. Use the previous technique to drive around again and notice the difference. The car will be much zippier now, both in forwards and reverse. We are still having a bit of a problem with the front tires seeming to slip a bit, causing it not to turn sharp corners very well. Remember that this is only an approximation and that final testing still needs to be done in the game itself.

 

Assigning Materials and Armor:

We’ve finished with the engine. Now it’s time to edit the materials and armor component of the vehicle.

  1. Press Escape again to exit control mode and optionally press “Reset Vehicle Position” again if necessary to return your car to the center of the window.
  2. In the Resources bar, select “my_car” again to select the root of the file.
  3. In the Tweak bar, expand the section labeled “Default”.
  4. At the bottom of the Default section is an entry labeled “MapMaterials”. Click on the “…” to the right of the name. This will open up a material assignment window.

 

There will be two entries in this window, “Rubber” and “light_armored_vehicle”. These names come from the shaders we created when we modeled the car.

  1. Click on the boxes labeled “Default” to the right of “Rubber” and change the material to rubber. Do the same for “light_armored_vehicle”, changing the material to “Armor_5_light_tank_front”. The window should now look like this:

 

Note that we originally called the material on the main body “light_armored_vehicle”, but we are assigning a heavier tank armor instead. The initial names are just labels to tell you what’s what. You can assign whatever material you want to them.

 

You won’t see much difference in the editor, but this step is important to make the tires grip the terrain correctly and also is necessary for material effects, such as dust and mud that get kicked up by the tires when they go over different surfaces.

  1. With “my_car” still selected in the Resource bar, right-click on any of the entries in the Tweak bar. This will bring up a list of things you can add in the Tweak bar.
  2. Select “Add Armor Component”:

 

  1. Expand the newly-created “Armor[Component] section and change “HitPoints” and “MaxHitPoints” to 300. You can leave all other settings at their defaults:

 

You should now be able to shoot at it without crashing the game. We have not created an actual wreck LOD yet, so the car will just disappear when it’s destroyed.

 

Editing the Camera, Entry, and exit settings:

You may think that we’ve covered everything, but there still are a few final details we need to take care of.

  1. Reset the vehicle position if you haven’t already, and this time instead of pressing the “Input” button, press the “Enter” button just to the right of it instead. You should now see something similar to this:

 

What’s happening is that we added a driver’s camera when we used the car wizard, but it’s been placed at the origin of the car by default. Since we haven’t created a dashboard or anything yet, we’re going to move it up temporarily so that your view is from just outside the car. In a later tutorial when we create a proper first-person LOD 0, we’ll change it to a more appropriate view.

  1. Press Escape if you need to get out of control mode, then press the “Free” button to the left of “Input”. You may also need to reset the car position and so on in order to see the car again.
  2. In the Resource bar, select “my_car_Cam”. Remember when we created that in the wizard?
  3. In the main window, you will notice a manipulation handle appear that consists of three different arrows coming out of a small red box. This is the pivot point of the vehicle’s camera. Click on the arrows and drag up and slightly back to move the point to just above the roof of the car:

 

  1. Now with the camera still selected, expand the “Rotation” section in the Tweak bar and set the following:

1.      MinRotation           -120/-20/0

2.      MaxRotation          120/20/0

3.      MaxSpeed             90/90/0

4.      Acceleration           5000/5000/0

5.      InputToYaw           PIMouseLookX

6.      InputToPitch           PIMouseLookY

7.      RegulatePitch          .1/-.1

  1. Lastly, check the box next to “RestoreRotationOnExit”. (This resets the camera to straight ahead when you exit the vehicle.)

 

Use the following screenshot as a guide:

 

These are the settings that let you look around while you are driving the car. If you don’t set them, you will only be able to look straight ahead.

 

  1. Back in the Resource bar, select “my_car_Entry”, just below “my_car_Cam”.
  2. In the Tweak bar, expand the “Camera” section and change the number to 5.

 

Even though the section is labeled “Camera”, this is actually where you set the radius of the entry point of the car. The default value of 3 is probably big enough, but now you know how to change it. You can also move this entry point the same way you did the camera by using the pivot point manipulator in the main window.

  1. In the Resource Bar, select “my_car” and expand the “PlayerControlObject” section in the Tweak bar.
  2. Find the entry for “SoldierExitPosition” and change this to -2/0/0:

 

  1. Select “File>Save” from the main menu to save your work.

 

Placing the Car in a Map:

We are now finally ready to place our new vehicle in a map for testing.

  1. Switch to the Level editor and load a level that you want to test the car in.
  2. In the main window of the Level editor, right-click somewhere close to a control point and choose “Create ObjectSpawner”. A window labeled “Select Vehicle Type” will open up.
  3. The name of our car won’t show up in this list, so just choose anything and click “OK”.
  4. Another window will pop up where you can enter a name. Change this name to “My_Car”.
  5. Click “OK” again, and whatever vehicle you chose will appear on the map.
  6. At this point the vehicle you chose should still be selected. If not, reselect it, and in the Tweak bar, locate the entries labeled “Vehicle Team 1” and “Vehicle Team 2”.
  7. Click on each of these entries and chose “my_car” from the list that pops up. The car should now replace the vehicle that was originally placed. This is how you get any vehicle or stationary weapon into the game that doesn’t appear in the default list. You should now see something like this:

 

Note: the car may look a bit funny with the wheels out of place. This is because the editor doesn’t properly update the positions of “sub-objects” correctly. You may wish to click on the “Snap object(s)” button on the right side of the editor if you want to be sure the vehicle is positioned correctly. The wheels won’t move, but it should be okay.

  1. Select “File>Save All” from the main menu.
  2. If you package your maps before testing, and it’s probably a good idea to get in the habit, then select “Mod>Package Mod”, also from the main menu.
  3. In the window that comes up labeled “Package MOD Archives”, make sure that both “package level” and “package mod” are checked, then click “OK”.

 

Note: Remember that once you package something once, you have to always package it in the future. Also don’t forget to do “Save All” BEFORE you package. Otherwise the changes won’t get added to the packaged files.

 

Final testing:

You should now be ready to test. Quit the editor, launch the mod, activate your map, and have fun.