Vehicle Importing Tutorial for JA

Part 1: non animated vehicles

by Duncan_10158

A. Contents:
                           A. Contents
                           B. This tutorial is about
                           C. What we need
                           D. What could help
                           E. Where we start
                           F. The tutorial 
                           G. How to name
                           H. Troubleshooting

B. This tutorial is about how to bring a model as vehicle into Jedi Knight Jedi Academy. In this part, I will explain that only on non-animated vehicles. The tutorial starts with a finished mash of a vehicle and shows what is to do to bring it in game. It will not treat: modeling, UV-maping, skining, shaders, editting .veh/.npc files or editting weapons. Its only about geting the mesh in game. basicly its very similar to bringing player models in game, you can take a look in those tutorials too for getting a better overview. I am using 3ds Max for modeling, but the meshes can be done where ever, importent are the last steps and they can only be done in 3ds Max. And thats what's this tutorial about.

C. What we need to bring a new vehicle model in game are following things: 3ds Max 4.x or 5, we need that program cause there is no other way to export a model in XSI format with all mashes weighted to bones. To say it right away, creating a model.glm using the MD3View tool, like for saber hilts, does not work. using this method the model has no bones nor is it attached to a .gla animation file. Then, to be able to export the model we need XSIImporter.dli plugin for 3ds Max from the first >JKEdittingTools< released by raven and vmdexp.dle plugin for 3ds Max from the second >JKEdittingTools2< also released by raven. To convert the model from XSI fromat into a model.glm file attached to a .gla file we need the assimilate tool (with carcass.exe) from the first >JKEdittingTools< by raven. finaly we need any kind of Notepad to do all the code files and a zip to pack it up.

Here is the list:
                       3ds Max 4.x or 5
                       XSIImporter.dli plugin for 3ds Max
                       vmdexp.dle plugin for 3ds Max
                       assimilate tool with carcass.exe
                       WinZip or WinRAR or any other zipper

D. What could help is the >jedi academy model and animation< pack released by raven. It includes some vehicles in XSI format, for ex. the swoop. With the dotXSI plugin for 3ds Max you can import the models and look how raven mad their vehicles. Use it as reference for your vehicle model. Out of this file you can also import some elements into your own model, like the tags.
Another great help is to use the models and files in the >assets1.pk3< as reference, you can open it using WinZip and copy out the swoop model and its .veh and .npc files. just 

E. Where we start, in this tutorial i will bring my STAP model in game, so every time I use the name >stap< you should  place there the name of your own model. I am starting this tutorial with a finished mash, UVmaps done and a skin, everything ready in 3ds Max. Keep in mind, if you change a mash after your UVmaps are done, you have to do the UVmapping again, so dont start this until your model is finished. My model consisits of 10 elements, it is possible to creat it out of one element, but this way you can have different skinmaps. I set my model to 11 frames, 0 to 10, two would be enought but eleven is a nice number. 



F. The Tutorial (or 20 steps to enlightenment)


1. Open or import the model into 3ds Max, give every element an appropriat unique name. Rotate the model so that it correspond to the 3ds Max views, place it in the middle of the z axis above the origin. how high on the z axis isnt that importent yet, you will probably need to change it at step 8 anyway.    

2. Add to every element a modifier Unwrap UVW, with this you can later change the UVmaps without adding a modifier above the skin modifier.


3. Now we need to add all the tag for the vehicle. There are two ways to do that, you can either create them as triangles or import them from an existing model. a tag is basicly an element of three vertecs with a single sided face connecting it. every tag has the prefix >bolt_<, so we need to creat or import the following tags:
bolt_driver       ;tag for the placing the driver
bolt_muzzleX   ;tag for the weapon, 
                         you can place multibles, X is the number vor everyone
bolt_exhaustX  ;tag for the exhaust effect,
                         you can place multibles, X is the number for eveyone

If you creat a vehicle without driver, weapons or exhaust effects, you can leave that out or do it and deatived it in the .veh file. I place them and decide later, the other way that doesnt work, you know. 
4. For this non-animated model we basicly need one bone, cause of the creating in 3ds Max, we will end up with two, thats ok, later we can use the second bone very good anyway. Under create/systems use the bone buttom and place them in the right view on the z axis. the name of the bone can be  whatever. I am using the same bone names as in JO player modeling, there is the main bone >pelvis< and every bone ending a bonecain has the suffix >end<. so i have these two bones:
pelvis        ;bone to which everything will be weighted
pelvisend  ;the end cain bone
5. Last thing to add are the Dummys. These are small green cubes only importent for the correct hirarchy, we need four of them. Same as the tags you can import them or creat them on your own. Place them in the origin, they have the following names:


6. To creat the hirarchy open the Schematic View. Use >Link< to bind an enfant element to its parent. the seleton root is only pelvis/pelvisend. All tags and model parts bind to one model part, in model >body<, and this one bind to >mesh_root<. >Skeleton_root< and >mesh_root< to >B:model_root<, and >B:model_root< bind to >XSISceeneRoot<.
7. To avoid an error when using assimilate to create a animation gla file without any animations in our file, we do now a small animation. assimilate dont accept a file without this the way we will use it, so we do one that has no affect, only to have more then one frame in our file.

Move the time slider to 5 and actived >Animate< buttom. Select >pelvisend< and rotate it in the right view 90, then deactived >Animate< buttom. Move the time slider back to 0,  that was it.

8. We have to bring every tag and bone in the correct place. The bolt_muzzle and bolt_exhaust are easy, place them where you want to see those effects. The Dummys in the origin, as already mentioned. Place the pelvis (moving pelvis will move pelvisend too) somewhere above the origin in the middle of the vehicle. to place the bolt_diver is the difficult part in this step. It may, or better it will happen that you have to do this a few times until you find the correct place. the problem is, we want to have the driver in the right place, but the bolt_driver, the pelvis and the Dummys in the origin must have an exact distance relation (A to B, in the pic). You will see in game, if you dont place it right, the vehicle will have another rolling center point then the driver. you can take a look at the swoop for reference. In game you will see that the driver is not in the right place and/or is rolling wrong, then you have to come back to this step, correct it and do the rest ot the tutorial steps again. if the driver is not correct, you have to move the bolt_driver relativly to the vehicle. if the driver is wrong turning, you have to select the hole vehicle and all tags and move them vertical relativly to the bone (pelvis), this to keep the driver in the right place. Importent, if moving a vehicle part or a tag, it must not be weighted, you always have to delete the weigting befor moving and weight it again, or you get horrible problems!
9. Add to one vehicle part the skin modifier, so we can weight it. click on >Add Bone< and in the window select pelvis. click on >Select< and you got pelvis in the modifier listed. click on >Edit Envelopes< and you see a sphere around the pelvis. you can size up that sphere by moving the dots on the sphere lines. you can see that the vehicle part inside the sphere get red, there its weighted, outsied its blue, not weighted. size up the sphere so the hole vehicel is inside it. deactived the >Edit Envelopes<, take skin in the modifier stock and drag and drop it on all vehicle parts and tags. now you can check, if the pelvis is moved every vehicle part and tag should move with it. undo this check movement and make the weighting sphere bigger if something was wrong.

Now we have done everything in 3ds Max, except to export it. Save your vehicle, so you can fix bugs from this point on.

10. To have the assimilate work properly, we need a correct folder structure and set it up right. the assimilate tool and carcass.exe have to be in a >base< folder, which have to be as first folder in the drive. creat a folder >models/players/vehicle_you< in the >base< folder. I named that >stap_dun<. That folder name is very importent, its the same folder name as in the pk3 files and nearly more importent will be the name of the animation file. To avoid compabilety problems give it a unique name, i use to add the suffix >_dun< for Duncan_10158. Find yourself a not already used suffix and add it to all vehilces you will creat. (see naming notes)
11. Now the setup of assimilate.exe, start it. Open >Edit / Preferences..<, window, point >Compiler< to >carcass.exe<. Everything else doesnt need to be changed. >OK< and assimilate is ready.
12. Back to 3ds Max, we have to export our model. >File / Export< brings you the to the >Select File to Export< window, chose XSI 3.0 as filetyp, name it >root< and save it in the >base/models/players/vehicle_you< folder we created above.
13. We get to >XSI Export<, all settings should be right. >OK< and the model should be exported.
14. Back to assimilate again, we have to add the model file. Chose >File / Add Files...<, pick your >root.XSI< file in the >vehicle_you< folder and klick >Open<. A massage will pop up:
>You're trying to add "root.xsi", which is inherent, you should only do this if you're making a model that has no seperate anim files   Proceed?<
Thats exactly what we want, so >Yes<. We get back to the main view, there is now the folder >vehicle_you< or however you named it. Double click on it and we get to the >vehicle_you< preferences window.

This window you will see many times bevor you find the right seting for your vehicle. first check >Make it's own skeleton<. the Scale sizes your vehicle in game, the centre is where the root Dummys are. >Origin - Adjust< places the root Dummys, to have them on the ground, Z=24.
We also have to correct the >Path<, delete >d:/base<, there shoud be only >/models/players/vehicle_you/vehicle_you<. This will be the animation file, i suggest we dont change the name. >OK< and we are on the main window agin. 

15. We come to the compile prozess, you can click >B< or >Edit / Build Model>. Save the file as >< and the assimilate prozess will start.

A msdos window will pop up. You will get an error message if something went wrong (see Toubleshooting). Hit a key to close the window and if all went right there will be a message that >Everything seemed to go ok<, you see, not even assimilate knows all. now we can close assimilate.

16. There are six new files, but we need only three of them:
    vehicle_you.gla (an empty animation file :))

from now on everyone who moded vehicles shoud know how to finish it, so you can go on your own if you like. But read on the wise man would.

17. For editing files and packing it up i use an other folder structure. Copy the three files we created into the >models/players/vehicle_you< folder. Add all skins and a >< file, edit it so it points for every bodyparts to the skins the folder. In the >shader< folder you can add shaders for your model.
18. In the >ext_data/npcs< folder create or copy an >vehicle_you.npc< file. Open it with NotePad, the title should be the name of your model, >vehicle_you<. Set >width< and >height< so it fits your model, you will have to try a few times.
    weapon WP_BLASTER
    playerTeam TEAM_NEUTRAL
    enemyTeam TEAM_NEUTRAL
    width 24
    height 32
19. In the >ext_data/vehicles< folder copy an existing swoop.veh file and rename it to >vehicle_you.veh<. Open it with NotePad, edit three thing: tile, >name< and >model<, all should be >vehicle_you<, so it points to your vehicle.
    name stap_dun
    model stap_dun
20. We nearly done it, use WinZip to pack up >models<, >ext_data< and all subfolders and files. Name it >vehicle_you01.pk3<, cause its your first version, i suppose. Copy this file to your >Jedi Academy\GameData\Base< folder and start the game in MP.

When the game is loaded, start a map in cheat mode (devmap mp/ffa5). As soon the map is loaded bring down the console ( + shift) and typ in:
  >/npc spawn vehicle vehicle_you<
or whatever you used when i wrote >vehicle_you<. your vehicle should be in front of you. Its in game!

If the driver is in wrong place or rotating not correctly you have to go back to point 8 and try to correct it by moving the vehicle or the driver tag.

On any problems, see Troubleshooting.

G. How to name the file is very importent, in the tutorial i use >vehicle_you< for the vehilce name. In the pictures on right i use the name of my model, stap_dun. Cause this is a completely new model and dont uses any resources of the game (the player model uses the _humanoid.gla form the game) it needs an independent structure. For example if someone wants to reskin my stap model, she copys all files into a new folder, lets say >stap_newskin<, and replaces the skins and edit the .skin file. this skin will not work without my original, cause the copyed model.glm still points into my original folder. To copy the .gla animation file doesnt solve this problem. So every skin of a completely new model needs its own .gla file. All models need two things in their names, first off the vehicle that it is, speeder_bike or stap in my case. Second, the name of the creator, modder or skinner. I suggest this kind of naming the files:
                        >vehicle type<_>three to four letters of your name<_>type of skin<.
Keep an eye on the community about the names used. To have them unique is very importent or it will cause sever crashes.

H. Troubleshooting
This is a beta version of the tutorial, troubleshooting will grow as you help me to find the "problems" of this tutorial, Thanks.



All rights belong to their owner.