Setting up WorldCraft for creating Tribes2 shapes:
This
document and related images will describe how to get WorldCraft 3.3 and a
related set of tools ready for use in editing shapes for use in the Tribes2
game engine. These instructions are not intended to be a complete reference
guide to using WorldCraft. There is a great help file included in the program,
and there are many excellent WWW resources offering great tips and help for
WorldCraft in general.
This Document assumes that you have successfully installed
Tribes2 and WorldCraft 3.3 on to your computer and you have all the proper
components and tools referred to in this document.
If you are going to be creating shapes during your
editing sessions you will need to make certain that bots have been turned off
from within Tribes2’s host mission function. If bots are enabled on your
computer the mission that is loaded to test shapes will crash due to the fact
that there is no navigation graph for interiorTest.mis.
You will also probably want to make certain that the
“Display on Master Server” option under the Tribes2 settings network tab is set
to never.
·
Setting up your folders and Tribes2 .wad files
Create a directory named “worldcraft” in your Tribes2
directory. Copy all of the attached .wad files, and the tribes.fgd file into
the worldcraft directory.
Create a directory named “missions” in your
Tribes2\GameData\base directory. Copy the attached file “interiorTest.mis” into
your tribes2\GameData\base\missions folder.
Create a directory named “interiors” in your
Tribes2\GameData\base directory. This is where your processed files will be
saved with the .dif extension.
Create a directory named something like “working_art”
somewhere on your hard drive. I generally like to put this at the root level of
the drive where Tribes2 is located. This is where you will load the examples
from, and where you may wish to save your shapes out of WorldCraft. Copy the
included .rmf and .map files into your working_art directory.
Copy the attached file “morian.exe” into your Tribes2\GameData
directory.
Copy the attached file “wadtool.exe” into your Tribes2\GameData
directory.
Copy the attached file “IFC22.dll” into your Tribes2\ directory.
·
Setting up “cmdseq.wc" and "gamecfg.wc”
First take the attached files "cmdseq.wc" and
"gamecfg.wc" files and put these into your WorldCraft program base
directory. These files probably in "c:\program_files\WorldCraft",
your drive letters and path may be different depending on where you installed
WorldCraft. You may need to replace existing files while doing this step.
NOTE! If you have already set up WorldCraft for creating
shapes for other games you will probably want to create a backup for
"cmdseq.wc" and "gamecfg.wc".
Alternatively you can edit your “run map(advanced)”
dialog box as follows AFTER you have
edited your options as described below under “Setting Your Basic Options” and
have an object open in WorldCraft.
Launch WorldCraft.
Go to “Run Map(advanced)” dialog box via the F9 key. Be
certain you are at the “Run Map(advanced)” selection. Switch between normal and
advanced from the button on the bottom left hand side of the dialog box.
Click EDIT and then New. Name your new configuration.
Select your new configuration in the drop down menu.
Click NEW. Select the new compile/run command and then
add a COMMAND PROPERTY by clicking CMDS and choose “Change Directory”. Next add
a PARMS game executable directory.
Click NEW. Select the new compile/run command and then
add a COMMAND PROPERTY by clicking CMDS and choose “BSP Directory”. Next click
under the Parameters: area and copy/paste or type the following line of text
into that area:
$path\$file.$ext
base/interiors
Click NEW. Select the new compile/run command and then
add a COMMAND PROPERTY by clicking CMDS and choose “Game program” from the
bottom of the popup dialog box.
Make certain that the compile/run commands have a check
mark in the box to the left of the command. This check will activate the marked
step. Also check the “Use long filenames” box, and the “Use process window
box”.
Click Cancel to return to world craft.
When you are ready to process a shape you will return to this dialog box and hit the “Go!” button to start the process.
Launch WorldCraft and bring up the "options"
dialog box from the "tools" drop down menu. Set up the games
configuration tab first. You will need to click "edit" then
"add" a configuration for Tribes2. Then set up this dialog box as
seen in the attachment "T2-WC-config.bmp" substituting your drive
letters and paths where necessary.
Then you will want to set up the build programs dialog
box as seen in "T2-WC-build.bmp".
You will also need to add a texture file under the
"textures" dialog box. Click “browse” and navigate to your
tribes2\worldcraft directory. The example world craft map files included in
this zip file all use the badlands.wad. Click OK when you are set up, then exit
WorldCraft.
There are other tabs under the “options” dialog box.
These are described in the on line help and there are many excellent WorldCraft
sites on the WWW that are great references.
When you are ready to test a shape you will hit the
"F9" key to bring up the "run map" dialog box. You will
want to make certain that you are using the "expert" version of this
dialog. To toggle between normal and expert modes click the button on the lower
left corner of the dialog box.
If you placed the "cmdseq.wc" and "gamecfg.wc" files correctly you should be able to compile and run your shape. Alternatively you can set up this dialog as described above under “Setting up “cmdseq.wc" and "gamecfg.wc”.
·
Setting Map Properties
Each WorldCraft file you create can have unique “map
properties”. However there are a couple of values you will probably want to
keep consistent in all of your maps. You may have to do this step each time you
create a shape.
To set these values launch WorldCraft. Create a new map
via the “File” menu. Under the “Map” menu you will find “Map Properties”.
Select this to bring up the dialog box. Look for “Geometry Scale” and make
certain that the value here is “32.0” This value determines how many WorldCraft
measurement units are equal to 1 meter. Also you will want to make certain the
“Lighting scale (must be a power of 2)” is set to “32.0” This value determines
the sampling frequency of the light maps generated when you process your shape.
“32.0” here means that there will be one light sample for each meter in your
processed shape. You can use other values here as long as they are powers of 2.
Changing this to smaller numbers creates a higher sampling frequency and larger
light map sizes. Generally I would suggest leaving this at “32.0”.
Also in this dialog box are controls for controlling
various aspects concerning level of detail settings. These will be described
more in depth later in this document.
More aspects of this dialog control the ambient light color, and emergency ambient color. These values in RGB (0-255) describe the ambient light color of this shape in regular and emergency lighting modes. Change these if you would like to add a bit of ambient light to your shapes.
·
Start with a large square
After you have set up WorldCraft it will be time to test the process to make certain everything is working correctly.
Create a large cube. 1024x1024x256 tall would be perfect. Place the shape in the center of the 3d space. Change the texture if you would like. Save this shape as test.rmf or something similar. I have saved this as example1.rmf and it should be in this .zip file. This shape uses the badlands.wad file.
When you have saved your shape hit the F9 key, or click
on the “Run Map!(F9)” button. Click on the "Go!" button and the
process should start. The shape will be passed through "morian.exe"
and placed into a temporary mission where you can fly around and see your
shape.
If this doesn’t work you will have to make certain that all of the details in the “Setting up …” sections of this document are implemented correctly.
·
Add a light and change the ambient light value
After you successfully process your first shape it will be time to add a light entity. Select the entity tool, and place an entity above the center of your shape by hitting the return key. Select the light entity, the little pink cube.
Open the edit properties dialog box (alt-enter while selected). Color is self explanatory, Alarm type sets under what lighting state the particular light will be active (normal or alarm, or both), falloff1 is the “hot spot” size, falloff2 is the size of the light until the color value is truncated to 0 0 0, or no light.
Change the color if you would like. Make certain the light entity alarm type is set to “normal only”. Set the falloff1 to 64, and falloff2 to 512. These measurements are in world space unit size so this will make a large light.
To change the ambient light value open the “map properties” dialog box from the “map” menu. Select “ambient color” and change the value to 64 64 64. This will make the darkest parts of the shape appear to be lit at the value you just set, a dark gray. Note that all of the lights you will edit in WorldCraft are additive. The light color you set will always be added to the ambient value set in the ambient color dialog box with one exception. Any lights on the exterior of a shape will be lit according to the ambient mission lighting. Interior vs. exterior faces are determined by the “portal zone” the faces exist in. I will describe portals and portal zones later in this document.
From this dialog box you will also be able to set the “Emergency ambient color”. Set the emergency ambient light at 16 16 16.
Run your shape and check the results.
·
Emergency Lighting Mode
In the Tribes2 engine there are two lighting states and light maps for any given WorldCraft shape, normal and emergency modes. These two states of illumination are hooked into the mission by using the mission editor. I will not be covering mission editing in this document. Generally normal mode is when the power to a shape is on, and emergency mode is when the power is off (as in destroyed generators).
Create a copy of the big light you added to the simple scene (copy paste or shift drag). As a consistent rule I personally always place emergency mode lights directly a few units under the normal state of any copied light. This way I always know which is emergency vs. normal. Edit this entity (select the entity then alt+enter). Change the color to bright red (255 0 0 rgb). Set the alarm type to “Alarm Only”.
There is one more variation under the “Alarm Type” drop down menu. This is “Both normal and Alarm”. This makes the light entity visible under both light states.
One more note about light states. All animated lights can exist only in one state or the other, never both states. It is simple to make animated lights appear to exist in both states without changing the values. Simply copy the animated light and make one version “Normal Only” and the other “Alarm Only”. The ambient light change between “Normal” and “Emergency” ambient values will effect animated lights but it will appear consistent other than that.
See the included “example1.rmf” file to see this set up using the badlands.wad file.
·
A Simple Hall –
Detail Brushes
Next we will look at a simple shape with a couple of
hallways, a small room, and a few lights. We will look at portals and detail
brushes.
Open the shape “example2.rmf” which is included in this
zip file. This shape uses the badlands.wad file. You may need to add this wad
file to your active textures in WorldCraft via the textures tab under the
tools/options dialog box. You may also want to make certain you are using only
the badlands.wad file for this example. You can work with more than one .wad
file at a time but I have found that multiple wad files can create some odd
problems in WorldCraft’s texture browser.
First lets look at detail brushes. Detail brushes are
used to reduce the number of polygons that are created when two brushes touch
in WorldCraft. Select one of the light fixtures at the entrances. Go to the
tools menu and select “Tie to entity”, then in the dialog box choose “detail”
from the class drop down list. In the 2D views of WorldCraft you may see the
light fixture entity change color to show you have changed the nature of this
brush.
Detail brushes do not split faces when
touching a normal world brush. For example the lights touching the walls in
“example2.rmf” will cause the walls to split into several polygons unless they
are designated as detail brushes. If the light fixtures are designated as
detail brushes, the underlying wall polygon will not be split to accommodate
the light fixtures. Using detail brushes can really cut down on your polygon
count if used correctly.
Detail polygons are not “seen” by
bots. If you have a pillar in the middle of a large floor that is a detail
brush, any bots you may use will not see the pillar and may produce some odd
behavior.
The portal creation process in
morian.exe does not see detail brushes as world objects. Morian.exe will
perceive any detail brushes that connect an outside face with an inside face as
a hole in the shape and you will not be able to create a valid portal zone as
described below.
·
A Simple Hall – Portal brushes and zones
Next we will take a look at “portal zones”, and “portal brushes”. Portal zones help control the number of visible polygons in a WorldCraft generated shape from any given zone. A portal zone in a shape is created by placing portal brushes in the shape. At least two portal brushes must be in a shape to create a portal zone.
Open “example2.rmf”. You are going to change the bright pink brushes that cover the entrances in this shape into portal brushes. The bright pink color is the “null” texture. Faces with the “null” texture render as invisible in the Tribes2 engine. Make certain your 3D view window is in “3D textured” mode. Look around the shape and locate a bright pink brush that is covering an entrance. Select the bright pink brush and “tie to entity”. You can “tie to entity” from the tools menu or you can hit ctrl+t as the short cut. Select “portal” from the drop down menu. Here you can see an option to pass ambient light if you wish. For this example use “Does not pass through”. Close the dialog box. Find the other thin pink brush and turn this into a portal brush.
Next find a pink brush inside the shape that is much thicker than the other pink brushes. Select this brush and squish it until it is as thin as possible and still covers the interior doorway. The largest face of the portal brush will be used to determine where the portal starts or stops. Or morian.exe will randomly pick one face of the brush if there are two equal sized faces. Select the interior portal brush and “tie to entity”, portal.
Process your shape with the F9 key.
Exterior faces exist in portal zone 0. Exterior faces are faces of your shape that exist outside of an interior portal zone. All faces that exist in portal zone 0 will receive ambient light as described by the mission editor. You can also control whether or not ambient light will pass through a portal brush by editing the properties of the portal brush in the edit properties dialog box.
Polygons in a portal zone can exist in more than one portal zone. For example a hallway with several portal zones may have polygons that cross portal zone boundaries.
Portal brushes should be as simple as possible. Portal brushes must be completely embedded on all sides by normal solid brushes. Portal brushes should not align exactly on the face of another solid world brush. Portal brushes do not recognize detail brushes as solid brushes, you cannot anchor a portal brush in a detail brush. The largest face of the portal brush will be used to determine where the portal starts or stops or it will randomly pick one face of the brush if there are two equal sized faces. This is why you will flatten your portal brushes to control where the portal zone begins and ends.
You can use as many portal brushes as necessary for your shape. If a portal zone brush is not useful, morian.exe will simply ignore it and it should not hurt the performance of your shape.
If you want to remove the portal properties of a shape you can use “move to world” to convert the portal brush into a normal world brush.
The Tribes2
engine will automatically perform back face culling to reduce the number of
drawn polygons. This means any polygon face that is facing away from your
viewpoint and cannot be seen will not be rendered.
·
LOD - Level of detail
Creating levels of detail for a shape is a way to reduce
the number of rendered faces and vertices as your shape reduces its apparent
size. The fewer the faces and vertices in a shape, the less the transformations
the game engine will have to manage resulting in higher frames. The trick is to
make these transitions as transparent as possible while reducing the total
number of polygons and vertices in your shape.
Morian.exe (the shape processing tool) looks for a
specific naming convention to process all of the pieces of any given shape in
the correct order and finally include all of the levels of detail into one
final file that is displayed in the game engine. The naming convention is as
follows:
*****_#.map
Morian uses only the .map format files. The .rmf files
are a slightly more inclusive format that will save your grouping information,
and vis group information. I primarily work with the .rmf format files to
preserve my groups, and vis group information. When I am ready to process the
entire group of LOD’s for one shape I export the latest version of each LOD in
a given shape to .map format via the file menu “export to .map”.
To set the LOD parameters for each level of detail in a
shape you will have to access the "map properties" dialog box from
the "Map" drop down.
"Shape Detail Index" should be equal to the
LOD value. "LOD_0.map" should have a "0" in this field.
"LOD_1.map" should have a "1" in this field, and so on.
"Minimum Pixels For Detail" sets the value for
when the next LOD below the current
LOD will be switched in the game engine. This value is based on the projected
pixel height of the shape. If the value is set for 250 this means when the
current shape is below 250 pixels high it will switch to the next lower LOD.
The last LOD in any given shape should have a “minimum pixels for detail” of
zero, however numbers higher than zero are acceptable.
After you have created all of your LOD's and have properly established the parameters for the LOD switching you will have to export each separate LOD into .map format via the file menu "export to .map". Then when you process the highest order of detail shape the rest of your LOD's will be processed and incorporated into the final .dif. Morian.exe looks for up to 10 LOD's for any shape. It would take "LOD_0.map", "LOD_1.map", "LOD_2.map", and "LOD_3.map" and process them all into "LOD.dif".
Portal zone brushes are valid in all levels of detail.
There are several things to keep in mind while trying to minimize the appearance of LOD switching. Lighting can give away the change in LOD. Only eliminate lights that are not visible to the outside of you shape. If you have a strong light source in a doorway to the exterior of your shape, and that light suddenly disappears when you switch LOD it will be very noticeable and distracting to the player. When your shape gets smaller these changes will be less noticeable. Major geometry shifting or changes can also make for abrupt LOD changes. Keep major changes to a minimum until your shape is fairly small. Texture shifting on exterior faces can be another thing to watch out for when creating LOD’s.
I have included a series of shapes in this .zip file to illustrate the concept of switching LOD’s. The shapes I have included are not necessarily designed to reduce polygon count, but to show how the concept works. These files are LOD_0.rmf and .map, LOD_1.rmf and .map, LOD_2.rmf and .map, and LOD_3.rmf and .map. These files use the badlands.wad as the texture source.
·
Point Entities (there may be more entity information
added at a future date)
Ai_special_node This is for helping bots navigate
interiors. Place at tops and bottoms of
Chutes, and other places where bots need some hints for
navigation.
Light_emitter_point Used internally by morian. No need to
place these entities.
light_pulse Name:
not necessary but you can name this light if you would like
Speed: how fast the light will switch between RGB values
Alarm Type: Animated lights must be Normal only or Alarm
only
Color1(RGB): Color value one
Color2(RGB): Color value two
Falloff1: size of light at 100% RGB value
Falloff2: distance to truncate RGB value to 0 0 0 (no
light)
Light_emitter_omni Basic point light.
RGB: color value
Alarm Type: Alarm mode setting. Normal only, alarm only,
or both
Falloff1: size of hot spot for light
Falloff2: distance of falloff for light to be truncated
to RGB 0 0 0
Please note
that animated lights can cause some performance degradation due to the
manipulation of light maps. Multiple animated lights that overlap will be very
processor intensive. Animated lights on surfaces visible from the exterior of
your shape should be kept to a minimum to avoid performance degradation.
·
Wadtool
Wadtool
is the tool that will make unique .wad(texture reference) files for use in
WorldCraft. If you set up your environment as described in this document
wadtool.exe will be located in your Tribes2\GameData directory.
The texture sets created in Wadtool are not the final images
used in the game, they are a set of reference images used when creating your
world craft shapes. Wad textures are limited to an 8 bit pallet, and the
textures in the Tribes2 engine can be used in higher bit depths for better
image quality.
In the Tribes 2 game engine there is an option to run the
game using palletized, or 256 color textures. The textures for the 256 color
images must be processed through a tool that we are currently preparing for
release to the public. Until this conversion utility is released your custom
textures will be displayed at 16 or 32 bit image depth even when the palletized
option is enabled. After the release of this tool you will be able to create
the custom .bm8 format images files.
First make
a folder in your Tribes2\GameData\base\textures directory. The name of this
folder should be the same as the name of the wad file you will be creating. As
an example create a folder named "testing".
Save your .png format source textures into the
"testing" folder. The .png files should be based on powers of 2. 8x8,
16x16, 64x64, 128x64 for example. Wadtool will support up to 512x512 images,
however textures of this size have a very large memory footprint and should
only be used sparingly. There are some texture sizes that wadtool doesn't like.
Ratios of 16 to 1 or greater will cause wadtool to crash. For example sizes
like 16 x 1, 32 x 2, 64 x 4 should be avoided.
You should include a “null” texture in your custom
texture sets. A null texture is a texture with the RGB value of 255 0 255, and
should be named “null.png”. This texture does not need to be more than 16x16
pixels in size. This color is bright pink. Faces with a null texture are not
rendered in the same way as a standard textured face. There are fewer
computations involved in drawing and transforming a face with a null texture
resulting in better performance. Use null textures on faces that will never be
visible to a player in your shape. For example if you design a shape that is
always embedded into terrain apply a null texture to the faces that will always
be occluded by the terrain. Another area where you will want to use null
textures is on portal brushes. Portal brushes are easier to see this way when
you are editing a shape. If you run into an invisible wall in a shape it is
probably a brush that should have been turned into a portal brush.
You will use wadtool from a dos prompt. Navigate to your
Tribes2\GameData directory. Activate the tool by typing "wadtool (path to
"testing" folder including drive letter) testing.wad" then
enter. This should process all the .png format files in the target directory
and then dump a "testing.wad" file into the directory where
wadtool.exe exists (most likely your Tribes2\GameData directory).
Copy the "testing.wad" .wad file into the Tribes2\worldcraft directory. There should be several .wad files in the Tribes2\worldcraft directory already if you have installed these according to the directions described in the “Setting up your folders and Tribes2 .wad files” portion of this document.
Launch
WorldCraft, go to the options dialog box, go to the textures tab and add
"testing.wad" from your tribes2\worldcraft directory. I personally
prefer to use only one .wad at a time so I would remove any other .wad files at
the same dialog box. You will then want to quit WC, and restart. This will make
certain only the "testing.wad" file is loaded.
In order for other people to see your unique textures
they will have to have the correct .png texture files in a correctly named
folder in the Tribes2\GameData\base\textures directory.
Build a shape with your new textures, add some lights
and then hit the process key (F9) to process the shape through morian.exe and
dump it into tribes2.exe.
This should get you up and running. I would suggest you
try a very simple shape like a cube and one light and when that is completely
working work your way up to more complex shapes.