HOW TO GET A LIGHTMAPPED STATIC PROP INTO GRAW

PAGE 4

 

9.A unit is a unit is a unit

 

Ok, so lets recap for a bit, shall we? What do we have so far? Well we have our 3dmodel in .diesel format that we exported from 3dsmax and we have a model.xml with the necessary definitions in it for our model to work properly in game.is that it? No not really , first you need ...this!

 

The Unit file.

 

A unit file is ,as you can see in the excellent overview tutorial I wrote earlier, a file that tells the game what to do with our model.and where to place it in the editor menus.

 

In data\units\props\ go ahead and create a .xml file called “u_wall.xml”.

 

All unit files are called u_whateveryouwant.xml and can be located anywhere within the subfolders of data\units\

 

Ok, well inside your u_wall.xml(or whatever you chose to call it) you start off bad adding a tag called

 

<units>

</units>

 

this is the “master” tag of the file and between these two little rascal, basicly an infite number of units can be added if you want more than one in one file.we often use several units in one file, not to create hundreds and hundreds of separate files that are harder to edit and do searches in, etc etc.but we will start of by adding one.

 

<units>

<unit type="prop" name="wall" slot="20"> 

“unit type” is what type of unit it is, this one is obviously a prop, albeit a static one.static props goes in slot 20. this affects

in what layer the prop will show up. Name is the name that will be displayed in the editor and also the name with wich you call for this unit from other unit files if you want to spawn it in some fancy way.but more on that later.we have simpler task to accomplish first.

<network sync="bodies" />

this syncs the bodies and lightmaps over the network and in savegames.dont forget to add this line, no changes needed there.

</unit>

dont forget to close your tags!

 

</units>

dont forget to close your tags!

 

Ok, lets just a bit ahead and just add the rest of the stuff, its really not that much to explain! Well a bit, but ill make it short.or ill try atleast.

 

 

<units>

 

<unit type="prop" name="wall" slot="20">

                                           

<network sync="bodies" />

                                            <model file="\props\wall\wall.xml"/>  this just tells the game where to look for your model xml (wall.xml in this case perhaps?)

                                            <script_class name="base" class="Base"/> this just says “this is a base class, nothing fancy here, no changes needed to this line.

 

                                            <stats block="base_data"> the statsblock tag should always be here even if you dont have any lightmap tags in it.no changes.

                                            <var name="lightmap" value="true"/>      these two lines are the ones that tells us that this object is gonna be included in

<var name="lightmap_size" value="8"/> the lightmaps rendering “value=”8” means the lightmap will be 8x8 pixels big for this unit  BUT this already  overridden in the model.xml that we wrote earlier. Go back and look at it! The value in the MODEL XML overrides the value in the unitfile!      

                                            </stats> dont forget to close your tags!

                     

                                            <xi:include href="/data/units/mass.xml#xpointer(/mass/mass_object_medium/*)"/> this one ive described in the a bit in the overview.go look there.

What it basicly does is to set a preset for what distance the object should “pop” out of the world, if you set it to “large” it will pop out at a very large distance, and if you set it to small, it will pop out pretty soon.play around with the settings and see what fits your object best! But dont just set everything to “large”, thats bad for the performance!!

                      </unit>

                      Dont forget to close your tags!!

                     

</units>

Dont forget to close your tags!!

 

Ok this is what our u_wall.xml unit file looks like right now in its “finished” state.at a later point we will add more things to it, but its all just a matter of cut and paste from other unit files.I will teach you, young grasshopper.

 

<units>

 

<unit type="prop" name="wall" slot="20">

                                           

<network sync="bodies" />

                                            <model file="\props\wall\wall.xml"/> 

                                            <script_class name="base" class="Base"/>

 

                                            <stats block="base_data">

                                            <var name="lightmap" value="true

                                            <var name="lightmap_size" value="8"/>           

                                            </stats>

                     

<xi:include href="/data/units/mass.xml#xpointer(/mass/mass_object_medium/*)"/>

                      </unit>

                     

                     

</units>

 

this is all! Lets get started with the textures and materials and then we are done done and done!

                                                                                      

Previous page ------ Next page