GRAW: CUSTOM
CONTENTS OVERVIEW by: wilhelm wintertidh/GRIN AB 2006
Overview of
the overview
Ok, so you want to import your own contents into GR:AW pc? Not a
problem! Well, it is a tiny bit of a
bother really, but not as bad as you might think when you first look at it!
This tutorial will do its best(funny how a tutorial, all of a sudden can
get a life and persona of its own) to get you sorted out.
What you need to get a prop, a house, a weapon or a character model(or
anything else really, maybe some zombies?or a spaceship!) into Graw are five things(not counting, wit, the
nessescary 3dsoftware and snacks)
-
.diesel file
-
model.xml
-
materials.xml
-
unit.xml
-
textures
the diesel file, model.xml and materials.xml will all be in the same
directory
for example
data/objects/props/mysweetgun/
while the textures will end up the data/textures folder
and the unit file should be created in the /data/units folder or a
subfolder of your choice.
this might look like alot of xml, but both the materials.xml and the
unit.xml is just a few lines of xml and really no work at all!
And once you get the hang of the model.xml and realize how much you can
do with it with just copy/paste/rename, you are
gonna have alot of fun with it!¨
lets get cracking!
The Diesel
File:
The .diesel file is the file that contains the actual 3d geometry and
other jolly good information that the game engine needs to properly set up and
render your object.
This file is generated when you export your 3dsmax scene with the Diesel exporter that you should have in
your “tools” directory in the root
of the game folder.the exporter is currently only for 3dsmax 7.
The diesel file contains, 3d
geometry, billboards(for trees,
lightcones, etc), material names to
be used in conjunction with the materials.xml
file, lights, animations etc etc,
Also, GRAW uses the metric system(comon
people, its 2006, maybe its time to join the rest of us in the glorius party
that is the metric system)
and uses real world scale. So you need to change your 3dsmax settings to
meters and centimeters.
One object that almost every
diesel file should contain, is the “root_point”
the “root_point” is a dummy box and
is the local point from wich the object is spawned in the world. The “root_point” should be at the top of the link hierarchy in 3dsmax when you export.
The
Model.xml:
Model.xml might actually be a bit misleading as the name of the model
xml file could be anything from aardvark.xml to zebra.xml, it really doesnt
matter but. Its usually nice though if it corresponds to the name of the other
files so incase you have a .diesel that is named
“mysweetgun.diesel”
its nice to have a model.xml that is named
“mysweetgun.xml”
do you follow me? Its just so that it will be easier for you to keep
track of your files.
the model.xml is called the model xml because it contains alot of
information about your model(the one in the .diesel, remember?).
things suchs as, collision, damage models, decals, physicsconstrains,
etc etc are all set up in this file. Also it tells the game wich .diesel and
materials.xml file to use for the model. And this brings us to....
The
Materials.xml
The materials is simply enough a little file that tells your dieselfile
what shaders and textures they should use with wich corresponding material name
in your 3dsmax scene.
So if your “mysweetgun” model
in 3dsmax has a material on it thats called “mysweetgun” you specify that, what shader to use with that material
and what textures to use in that shader.
No other material options
than the material names in 3dsmax will be of ANY importance at all after you have exported it.
All the material handling is done in the materials.xml
The material file is always called materials.xml
in GRAW but you can really call it whatever you want, but its nice to know that
it contains materials!
A simple example of such a file could be
<materials>
<material
name="mysweetgun" src="diffuse">
<diffuse_texture
file="mysweetgun_df"/>
</material>
</materials>
if you have more than one material in your scene/object, just make
another <material> tag after
the first and repeat.
If you want to see more examples,
just open of the many many material files that already excists in your unbundeled game directory!
“material name” is the name of
the material in your original 3dsmax scene
“src” is the name of
the shader, in this case just a standard diffuse shader
“mysweetgun_df” is the name of
the actual texture file to be used in that shader.
The “df” at the end is just for your own sake so you can keep track of
what kind of textures you have.
In GRAW we use “df” for
diffuse, “bm” for
normalmaps(normalbump) and “il” for
self-illumiation textures, etc etc
But these are just optional, however it is a recommendation to use them
if you want others to be able to use your textures in the future.
The Unit.xml
The unit xml is the end of the road for most models and its also the
file that tells the game where to look for your model.xml , what to do with it, and what kind of object it should
be, be it a prop, a static, a plant, etc. Its also the file that tells the editor to show the object in the object list so you can place it.
The name of the unit file should be u_mysweetgun.xml
(where “mysweetgun” ofcourse can be anything your heart desires, but once
again, its nice if it atleast resembles the name of the other files that you
have created)
An example of such a file could look like this
<units>
<unit type="prop" name="mysweetgun"
slot="13">
<network
sync="bodies" />
<model file="\props\mysweetgun\mysweetgun.xml"/>
<script_class
name="base" class="Base"/>
<stats
block="base_data">
</stats>
</unit>
</units>
what this file tells us is that this object is a “prop” in the slot “13”
that means that it will be displayed in the “props” layer in the games editor.
It tells us where to find the
model xml to use for this “unit” and that it should be lightmapped ( more on
this later as it involves both the materials and the model xml aswell)
It also tells us this
<xi:include
href="/data/units/mass.xml#xpointer(/mass/mass_object_small/*)"/>
Which is coder mumbojumbo for “if you want to have alot of these objects
in your map, you might want to add this to make it render faster”. It has to do
with instancing and lodding of the objects, dont get me started.ask someone
else.it works and its easy to add, so why not just add it?
You can exchange the “small” at the end, for “large”, “medium” or “big
gulp(no, not really)”, depending on the physical size of the object. A gun for
example, I would consider a “small” object, while a car might be a “medium”.
But look in other unit files for examples of this.
Textures
For optimization issues, GRAW uses texture “texture atlases”
An atlas is a big texture, consisting of many smaller
ones, baked into one, allowing faster handling in the engine. This is a matter
of optimization and it reduces the number of texture switches for each object
and therefor makes the objects faster to
render.
To create such a “texture atlas” with your own custom textures in it, you
will use the atlasgen.exe found in the tools directory together with the 3dsmax
exporter. It is a command line program to be used in the command prompt of
windows, but we will hopefully bundle a
tool for you in the July-patch to make it more graphical.
However, its not that difficult to use for a beginner but has loads and loads of options if you are a more advanced user.
Graw uses the DDS format for
textures.
Dxt5 for diffuse
textures and a8l8 for the
normalmaps.
That should be it for now, more indepth tutorials on each of the files
will come with some practical examples
on how to get objects, terrains etc into the game; step by step, from start to finish!
Happy modding
/the grin team J