Building .trk, .3d and .3do Files:
Now that you have a track in .sg format you need to know how to build files from that .sg that you can use in your sim.
[You need to have the N3 Sandbox installed]
Preparation:
You will need want add two other files to your sandbox folder, the ones in this archive. they will be explained later on in this tutorial.
The Build Tools:
As we saw before, the sim uses two files for the actual track data, the <track>.trk with physical track data and the <track>.3do with visual data. We will build those files with three tools located in your sandbox folder.
1. SG2TRK.exe will convert the .sg file to a .trk file;
2. TRK23D.exe will convert the .trk file to a .3d file;
3. 3D23DO.exe will convert the .3d file to a .3do file.
So, if the sim only uses the .trk and .3do files, why does it use the intermediate step of building a .3d file first ? Well, the .3d file can be described as a .3do file in script/text format. This file can come in very handy when you want to edit something by hand. I have done this with different goals in the past on numerous tracks but in this tutorial we will only use it to set some base colors in the .3do for easier editing later on.
If you just want to test your track you can build it very quickly without feeding any parameters to the tools at all. Here is where the .bat file you just downloaded will come in. As long as your .sg is called icr2.sg then running quick_build.bat will build your track like so:
1. SG2TRK.exe icr2.sg [creates icr2.trk]
2. TRK23D.exe icr2.trk [creates icr2.3d]
3. 3D23DO.exe icr2.3d [creates icr2.3do]
When you get a message that the .mrk file is missing just copy one from another track and rename it to icr2.sg. The tools need one present to function even if there is no data in it at all.
Then you can go test your track. When you go to your final build [or one of your final builds] it is important to not use the quick_build.bat file but to go to a DOS prompt instead. There are a good number of options that you can set for each tool from the command line by using parameters. I will go into more detail about all three tools next.
The Build Tools Explained, sg2trk.exe:
This tool can be used without any parameters and that I think is the advised way to use it. You can however set a couple of parameters if you know what you are doing.
These are those parameters and what they do:
| Parameter: | Function: | Possible input: |
| -radtoler [number] | sets maximum radius tolerancy [between sections] | Between 0 and 1000000000, default is 1500. |
| -arcangle [number] | sets maximum allowed arc angle [in degrees] | Between 0.000000 and 360. Remember me telling you in the SGE tutorial to make your corner sections cover less then 120 degrees ? That is because the default value for this one is 120 degrees. Now you could put in corners of 180 degrees and change the parameter here but my guess is it will not look good in the game so you better chop them up in smaller sections. |
Here is an example command line using both parameters, just so you know how to type this in a DOS prompt:
sg2trk.exe -radtoler 1800 -arcangle 140 icr2.sg
The Build Tools Explained, trk23d.exe:
This tool can be used without any parameters but you can do some interesting things by setting some of the available ones. You can read a small help screen with these options by just running trk23d.exe without feeding it any data or parameters, in fact most of it was copied directly into the following table :
| Parameter: | Function: | Possible input: | |
| -am | Textures ads in medium and high quality segments (*) | Default is high segments only. Ads are made using the .mrk file. | Only one of both can be used at a time ! |
| -al | Textures ads in low, medium and high quality segments (*) | Default is high segments only. Ads are made using the .mrk file. | |
| -c | Will center the .trk file to x,y,z = 0,0,0 | What's the use ? No idea... Might be helpful when you've lost an .sg file and can only built with .trk. | |
| -nf | For no horizontal polygons in the fences. | Used to create N1/ICR1 type fences. | |
| -w | Make different .mip names for left, right and pit wall | Works for armco too. Used to make different textures for inner, outer and pit walls. | |
| -h [number] | Specifiies the .mip height of the walls in N number of pixels | Default is 16 ? Used to add more detail to a wall if you want that wall higher than normal. | |
| -pit | Tells the program to read a file called pitwall.txt | Pitwall.txt has pitwall height, example: BOUNDARY
0: 0 1000000 HEIGHT 12000 Use ? No idea... fill me in folks, anyone ever used it ? |
|
| -slow | Turn on output flushing for debugging | Makes the program slower but if it crashes, the .3d file is more complete. | |
| -nosf | No s/f line will be drawn | If you want a textured s/f line polygon which can be made later on in OPE. | |
| -sandtex | Applies a sand.mip texture to the SFE surface SAND | When not used SAND surface is the same as PAINT (CURBING). | |
| -nwenglnd | Will make fencing on all of the right walls only | When you don't have an .sg file to edit, only used for ovals typically. | |
| -gin | Groove inside width | Only used in conjunction with a .lp file to create a groove. Only used in N3 so I have no experience with this but I'm sure you have to supply data on all four of the groove related parameters or not supply any at all. |
|
| -gout | Groove outside width | ||
| -gstr | Groove width on straights | ||
| -amax | Maximum alpha of the groove | ||
| -info | Not used with any other parameter | Prints .trk file/track information to the screen. | |
These are the file names that have to be or can be inlcuded on the command line:
| <name>.trk | Sets the name of the .trk file to read. | Required | You need an input file to get any output right :) |
| <name>.mrk | Sets the name of the .mrk file to read. | Optional | No need to include unless it is named something else then the <name>.trk. |
| <name>.lp | Sets the name of the .lp file to read. | Optional | When you already have a race.lp, include this command to tell the program to create a groove from this file. Only interesting for N3 track builders because it is not used in ICR2. |
| <name>.3d | Sets the name of the .mrk file to write to. | Optional | Default is the same name as the trk file, include if you want it to be something else. |
Here is an example command line using some of the parameters I have succesfully incorporated in some of my tracks, just so you know how to type this in a DOS prompt:
trk23d.exe -am -w -nosf -sandtex icr2.trk
A lot of the .3d related parameters will come up in another tutorial about using the .3d to add cool features to your track. There is one thing though that you should do with EVERY track you build when you build the final version and that is to replace the color definitions in the header of the .3d file with some custom made ones before using the final tool 3d23do.exe. If you open the .3d file [for example in a text/hex editor like UltraEdit] you will see, starting on the fifth line, surfaces with all kinds of numbers behind them. The last bit of every line c= <248> or c=<240> defines which base color [by track palette index number of the sunny.pcx file] every polygon of this surface type should get in the .3do file. When your track is completely finsihed with the right textures, objects and such things, you need to change those colors to match the textures again. This is easy to do in 3doEd because you can select surfaces by color to edit them. But, when all surfaces have THE SAME color this is not going to work. That is why the color definitions have to be changed in this phase. You don't have to give them the final colors that you want to use because chances are you don't know them yet. The most important thing is that different surface types [asphalt/grass/fences/walls] all have different colors so that when you edit them in 3doEd you can select walls by letting 3doEd show color index 220 and select grass by having 3doEd show color index 246 only, etc. That is the explanation that you needed, to know why you should do that, now the good thing for you is I have already supplied a file that you can copy into your header and have different colors defined. In files2.rar supplied at the beginning of this tutorial there is a file called 3dHeaderColors.txt. This file can be pasted into your own .3d files, just make sure it replaces the old lines. The first line in my 3dHeaderColors.txt file is nil : NIL ; and the last one is %%Mark Colors so if you copy the whole 3dHeaderColors.txt file, then select the part from nil : NIL ; to %%Mark Colors in your own .3d file and press Paste then your colors should be fixed. Save and exit the file and build your .3d file to a .3do.
The Build Tools Explained, 3d23do.exe:
This tool has some options as well but I don't think you will ever need them. It is my guess that Papy not only used this tool to create the <track>.3do files but also to make the other .3do objects in tracks and carsets. They probably had a plugin for a 3D program that could write .3d files and then they converted them to binary using 3d23do.exe. But as I said this is only a guess.
These are the options you can use for 3d23do.exe:
| /? | Will show a small info screen. | Also shown when just running the tool without any parameters. |
| /s= [number] | Scale the 3D model with specified number. | There is no need to use this when building tracks. |
| /o=[name.3do] | Sets the name of the outputfile to create. | Default name is the same as the .3d file. |
Conclusion:
As you can see there is a lot of added functionality to these tools. Some can be very helpful, others you will never use. The goal of this tutorial was to show you how to build a track quickly for when you are still developing it and how to build it with more detail when you are doing the final builds.