Home
Screenshots
Downloads
Forums
Docs
Servers
Stats
IRC Chat
Mods

Special Special    Search Search    Login/Logout Login

Main Page » Object Placement Files
Object Placement Files

Contents

Description

Object placements do just that, place various objects on the landscape where you want them. There are a variety of different methods you can use to choose how and where the objects are placed. So you can find a method that best suits what you are doing. You can also place a variety of different types of objects such as just a model, or a target that has health/items, even objects that have imbedded AI and can shoot weapons.

Like most of the other optional landscape features, object placements can be called from either Definition_Files or Texture_Files. In addition to that, placements can now also be constructed in Include_Files as of v41.


File Layout

The placement files should be located under your game installation's (or mod's) /data/landscapes folder. They are typically named placemyfilename.xml, where myfilename is the name of the object placement or group of placements stored in that particular placement file.

The basic layout of each placement file looks like this:

<place>

  <placement type="direct/mask/tree/bounds">
     ...
     <object type="group/model/random/tank/target">
        ...
     </object>
  </placement>
  <movement type="boids/ships/spline"> (optional)
     ... As of v41, any object placement can be supplied movement
  </movement>
  <placement>
     ...
  </placement>

</place>

Each placement is defined through it's own set of <placement></placement> tags and all the necessary info for that placement type is contained within those tags where the "..." are above. Every placement type will contain one of the various object types as well. As of v41, you can also supply movement to your placements as well. More details on all the placement, object and movement types can be found in the following sections.


Placement Types

The type of placement determines how the object is positioned on the landscape and how many of them there will be on the landscape. There are various different types of placements available to use depending on how much control you want over the placement. Although the placement types vary from type to type, they will all contain an object made up of one of the various object types.

The placement types available are direct, mask, tree and bounds. Details on each of these placement types and what they contain can be found in the following section. Descriptions are in yellow.

Direct Placement

The direct placement type places an object explicitly at specific coordinates on the landscape. It offers direct control over the exact position you want this placement to occur at.

<placement type="direct">

  <position>
     Coordinates on the landscape where the object will be placed
     <position>
        <A>#</A>
           East/West coordinate, 0 = far west side
        <B>#</B>
           North/South coodinate, 0 = far south side
        <C>#</C>
           Height coordinate, 0 = sea floor
     </position>
  </position>
  <object type="...">
     One of the various placement Object Types
  </object>

</placement>

Mask Placement

Mask placement uses a black and white bitmap file to determine areas where objects can and cannot appear.

<placement type="mask">

  <numobjects>#</numobjects>
         The number of objects to attempt to place on the map.
         This value assumes that the whole map is "placeable".
         ie: If 25% of the map is less than the minheight, and 
         another 25% is masked off by the mask file, half of this
         number of objects will be placed.
  <mask>data/landscapes/masks/city3rural2.bmp</mask>
         A .bmp file showing where objects will be placed.
         Black areas show where no placements will occur.
         White areas show where objects can be placed. 
  <minheight>#</minheight>
         Minimum height for object placements
  <maxheight>#</maxheight>
         Maximum height for object placements
  <mincloseness>#</mincloseness>
         Minimum distance between placements
  <minslope>#, 0 to 1</minslope>
         Steepness of grade on which object can be placed
         0.0 = 90 degree slop, 1.0 = no slope (flat terrain)
  <xsnap>#</xsnap>
         Objects will be placed on a grid with this value of East-West spacing. 
         The value is based on the size of the map, typical maps are 256x256, so
         xsnap=8 will give a spacing of 1/32 of the map width (256/8) between object placements
  <ysnap>#</ysnap>
         Same as above, but North-South.
  <object type="...">
         One of the various placement Object Types
  </object>

</placement>

Tree Placement

The tree placement places objects in dense clumps or patches on the landscape instead of being spread out evenly over the whole landscape. It is useful for simulating a random forest or mushroom cluster or something along those lines.

<placement type="tree">

  <numobjects>#</numobjects>
     Total number of objects to 'attempt' to place
  <numclusters>#</numclusters>
     Number of forest clusters or patches
  <minheight>#</minheight>
     Minimum land height trees will appear
  <maxheight>#</maxheight>
     Maximum land height trees will appear
  <object type="...">
     One of the various placement Object Types
  </object>

</placement>

Bounds Placement

The Bounds type placement places the object somewhere randomly within the defined bounding area. It is typically used to initialize a boid type placement somewhere in the air over the landscape.

<placement type="bounds">

 <count>2</count>
    The total number of this object that you want to place
 <minbounds><A>-100</A><B>-100</B><C>30</C></minbounds>
    Lower left (SW) boundary when placing the object(s), corresponds to landscape height/width
 <maxbounds><A>355</A><B>355</B><C>65</C></maxbounds>
    Upper right (NE) boundary when placing the object(s), corresponds to landscape height/width
 <object type="...">
    One of the various placement Object Types
 </object>

</placement>


Object Types

There are a variety of object types to choose from depending on what kind of object you are placing on the landscape and what you want it to do.

The object types available are group, model, random, tank, target and tree. Details on each of the object types follows. Descriptions are in yellow.

Group Object

The group object can be used to place several different objects at specific points around the current placement location.

<object type="group">

  <groupobject>
     <offset>
        Each groupobject has its own coordinate offsets
        <A>#</A>
           East/West offset
        <B>#</B>
           North/South offset
        <C>#</C>
           Vertical offset (altitude)
     </offset>
     <object type="...">
        One of the various placement Object Types
     </object>
  </groupobject>
  <groupobject>
      Multiple groupobjects can be supplied with different offsets, object types, etc
  </groupobject>

</object>

Model Object

The model object type places a specified model at the current location. Models can be made to fire off specific events when they are destroyed or burned. Models do not cause projectile collisions and can not have health or items like targets do.

<object type="model">

  <model type='MilkShape'>data/accessories/buildings/factory1.txt</model>
         The model file to load. See the modelling section
         of Game modding & 3D modeling for more info.
  <modelburnt type='MilkShape'>data/accessories/buildings/factory1burnt.txt</modelburnt> (optional)
         The model to use after the original target has been burnt by napalm
  <modelrotationsnap>#</modelrotationsnap> (optional)
         The angle (in degrees) to snap the rotation of the
         model to. Setting this to 0 will force the model to face North, whereas
         setting it to 90 will cause it to be
         placed (at random) to North, South, East, or West, and
         setting of 45 will also allow for Southeast, etc.. Setting it
         to 1 will yield random rotation.
  <removeaction>accessory</removeaction> (optional)
         An event in the accessories.xml file which
         describes what will happen when the model is destroyed.
         Typical actions include explosions, giving life or accessories, etc
  <burnaction>accessory</burnaction> (optional)
         As above, but this action is invoked when the model is burned with Napalm
  <flattenarea>-1.0</flattenarea> (optional)
         The amount of the area underneath the model to
         flatten. A value of 10 will make the landscape flat
         for an area ten units wide (square)
         A value of -1 will flatten an area the size of the model's bounding box.
  <border>#</border> (optional)
         Prevents other objects from being placed within this many units of the object
  <groundmap type='bmp'> (optional)
         Overlays a texture on the landscape underneath the object
     <image>data/landscapes/parking.bmp</image>
             A texture image to overlay on the landscape.This 
             image will be scaled 4:1 in pixels:game units.
             ie: On a 256x256 sized landscape, a 256x256 image
             will cover 1/4 of the  width of the map, centered
             where the model is placed.
     <alpha>data/landscapes/parkinga.bmp</alpha>
             A greyscale image showing what parts of the  groundmap will show. (see below for more details)
     <invert>true</invert>
             Whether or not to inver the alpha map for the groundmap texture. (Default: true)
             When invert=true, darker areas of the alpha map cause the groundmap image to
             show more, and lighter areas less. (ie: Black areas of the alpha map cause the
             groundmap to be the only texture visible on that area, white areas mean the
             normal landscape texture shows)
             Note: This image must be the same dimensions as the groundmap. If it is not,
             there will be no error, but the texture will not show.
  </groundmap>
  <groupname>name</groupname> (optional)
         Can be used to bind a group of sounds from a Ambient Sound File to the object.
         New to v41, you can combine with Event_Files and WeaponGroupSelect to fire events from this object

</object>

Random Object

The random object chooses a single object randomly from a collection of objects.

<object type="random">

  <randomobject>
     <object type="...">
        Any one of the various placement Object Types
     </object>
  </randomobject>
  <randomobject>
     Multiple objects are supplied, one is chosen randomly
  </randomobject>

</object>

Tank Object

The tank object type is similar to the Target Object. The difference is that they have AI and can fire weapons.

<object type="tank">

   <name>Red Turret</name>
           Name the tank will be known as to other players
   <model>Red Metal Turret</model>
           References a tank model in the tanks.xml file.
           You do not point to a model file like other placements.
   <ai>Red Turret</ai>
           Defines the ai type for this tank.
           The AI types are defined in your tankais.xml file.
   <shield>none</shield>
           The type of shields the tank will use.
           These are defined in your accessories.xml file
   <parachute>Parachute</parachute>
           The type of parachutes the tank will use.
           These are defined in your accessories.xml file.
   <life>500</life>
           Maximum amount of health the tank will have.
   <team>1</team>
           What team the tank should be on during team play.
           1 = Red, 2 = Blue, 3 = Green, 4 = Yellow
   <removeaction>AccessoryName</removeaction> (optional)
           Optional event that will fire when the tank is destroyed.
           These are defined in your accessories.xml file
   <burnaction>AccessoryName</burnaction> (optional)
           Optional event that will fire when the tank is hit with napalm.
           These are defined in your accessories.xml file
   <flattenarea>6</flattenarea> (optional)
           The amount of the area underneath the model to
           flatten. A value of 10 will make the landscape flat
           for an area ten units wide (square)
           A value of -1 will flatten an area the size of the model's bounding box.
   <border>#</border> (optional)
           Prevents other objects from being placed within this many units of the object.
   <boundingsphere>true/false</boundingsphere> (optional)
           False = use bounding box, true = use bounding sphere
   <driveovertodestroy>true/false</driveovertodestroy> (optional)
           Default=false= object will not be destroyed when driven over
   <drawshadow>true/false</drawshadow> (optional)
           Whether or not this object draws a shadow
   <groundmap type='bmp'> (optional)
           Overlays a texture on the landscape underneath the object
       <image>data/landscapes/parking.bmp</image>
                A texture image to overlay on the landscape.This 
                image will be scaled 4:1 in pixels:game units.
                ie: On a 256x256 sized landscape, a 256x256 image
                will cover 1/4 of the  width of the map, centered
                where the model is placed.
       <alpha>data/landscapes/parkinga.bmp</alpha>
                A greyscale image showing what parts of the  groundmap will show. (see below for more details)
       <invert>true</invert>
                Whether or not to inver the alpha map for the groundmap texture. (Default: true)
                When invert=true, darker areas of the alpha map cause the groundmap image to
                show more, and lighter areas less. (ie: Black areas of the alpha map cause the
                groundmap to be the only texture visible on that area, white areas mean the
                normal landscape texture shows)
                Note: This image must be the same dimensions as the groundmap. If it is not,
                there will be no error, but the texture will not show.
   </groundmap>
   <groupname>name</groupname> (optional)
         Can be used to bind a group of sounds from a Ambient Sound Definition to the object.
         New to v41, you can combine with Event_Files and WeaponGroupSelect to fire events from this object

</object>

Target Object

The target object type places a specified model at the current location. Unlike models, targets do cause projectiles to collide when they come in contact with them. Targets also have properties like health and can use defensive items like shields and parachutes.

<object type="target">

   <name>targetname</name>
           Name the object will be known as to other players.
   <model type="MilkShape">data/accessories/people/male1_soldier.txt</model>
           The model file to load. See the modelling section
           of Game modding & 3D modeling for more info.
   <modelburnt type='MilkShape'>data/accessories/people/male1_soldier.txt</modelburnt>
           The model to use after the original target has been burnt by napalm
   <size><A>#</A><B>#</B><C>#</C></size> (optional)
           Scale object in individual directions??
   <modelscale>#</modelscale> (optional)
           Scales the model by this amount (default = 1 = use model size)
   <modelscalediff>#</modelscalediff> (optional)
           Randomly varies the size of this object by this amount (default=0, no variance)
   <modelrotation>#</modelrotation> (optional)
           Rotates the model about the y-axis to the specified angle.
   <modelrotationsnap>#</modelrotationsnap> (optional)
           The angle (in degrees) to snap the rotation of the model to.
           Setting this to 0 will force the model to face North, whereas
           setting it to 90 will cause it to be
           placed (at random) to North, South, East, or West, and
           setting of 45 will also allow for Southeast, etc.. Setting it
           to 1 will yield random rotation.
   <shield>none</shield> (optional)
           The type of shields the tank will use.
           These are defined in your accessories.xml file
   <modelbrightness>#</modelbrightness> (optional)
           Adjusts the brightness of the object by this amount
   <parachute>Parachute</parachute> (optional)
           The type of parachutes the tank will use.
           These are defined in your accessories.xml file.
   <life>20</life> (optional)
           Maximum amount of health the object will have.
   <removeaction>Small Bldg</removeaction> (optional)
           Optional event that will fire when the tank is destroyed.
           These are defined in your accessories.xml file
   <burnaction>Small Bldg</burnaction> (optional)
           Optional event that will fire when the tank is burned by napalm.
           These are defined in your accessories.xml file
   <boundingsphere>true/false</boundingsphere> (optional)
           Default = true, object will use a spherical shaped bounding box.
           When false, the object uses the models actual (square) bounding box.
   <border>#</border> (optional)
           Prevents other objects from being placed within this many units of the object.
   <nocollision>true/false</nocollision> (optional)
           If set to true, weapons will not collide with this object
   <nofallingdamage>true/false</nofallingdamage> (optional)
           If set to true, objects will not take damage when falling
   <nodamageburn>true/false</nodamageburn> (optional)
           If set to true, object will not take damage from napalm
   <displaydamage>true/false</displaydamage> (optional)
           Whether or not to show the damage counters over this object when damaged
   <displayshadow>true/false</displayshadow> (optional)
           Whether or not this object will cast a (non-shader) shadow
   <displayhardwareshadow>true/false</displayhardwareshadow> (optional)
           Whether or not this object will cast a (shader) shadow
   <flattendestroy>true/false</flattendestroy> (optional)
           Whether or not to destroy this object when terrain under it has been flattened
   <driveovertodestroy>true/false</driveovertodestroy> (optional)
           Whether or not to destroy this object when its driven over
   <flattenarea>#</flattenarea> (optional)
           The amount of the area underneath the model to
           flatten. A value of 10 will make the landscape flat
           for an area ten units wide (square)
           A value of -1 will flatten an area the size of the model's bounding box.
   <groundmap type='bmp'> (optional)
           Overlays a texture on the landscape underneath the object
       <image>data/landscapes/parking.bmp</image>
                A texture image to overlay on the landscape.This 
                image will be scaled 4:1 in pixels:game units.
                ie: On a 256x256 sized landscape, a 256x256 image
                will cover 1/4 of the  width of the map, centered
                where the model is placed.
       <alpha>data/landscapes/parkinga.bmp</alpha>
                A greyscale image showing what parts of the  groundmap will show. (see below for more details)
       <invert>true</invert>
                Whether or not to inver the alpha map for the groundmap texture. (Default: true)
                When invert=true, darker areas of the alpha map cause the groundmap image to
                show more, and lighter areas less. (ie: Black areas of the alpha map cause the
                groundmap to be the only texture visible on that area, white areas mean the
                normal landscape texture shows)
                Note: This image must be the same dimensions as the groundmap. If it is not,
                there will be no error, but the texture will not show.
   </groundmap>
   <groupname>soundgroup</groupname> (optional)
           Can be used to bind a group of sounds from a Ambient Sound File to the object.
           New to v41, you can combine Event_Files and WeaponGroupSelect to fire events from this object

</object>

Tree Object

As of v41, there is no longer a tree object type as it used to be. Instead, it is now a type of model, and can be supplied in any other object type that wants a model type.

<model type="Tree">

  <tree>treetype</tree>
         Can be any of the follwing predefined tree types:
         pine, pine2, pine3, pine4, burntpine, yellowpine, whitepine
         oak, oak2, oak3, oak4
         palm, palm2, palm3, palm4
         palmb, palmb2, palmb3, palmb4, palmb5, palmb6, palmb7
  <snow>true/false</snow>
         Whether or not to use the snowy version of this tree
  <burnt>true/false</burn>
         Whether or not to use the burnt version of this tree

</model>

- OR -

<modelburnt type="Tree">

  ... See above

</modelburnt>


Movement Types

As of v41, any object placement can be told to move. There are currently 3 different methods to choose from when defining object movement. They are boids, ships and spline.

Boids Movement

The boid movement type randomly moves the object to points within a defined area.

<movement type="boids">

 <minbounds><A>-100</A><B>-100</B><C>30</C></minbounds>
    Lower left (SW) boundary when moving the boid(s), corresponds to landscape height/width
 <maxbounds><A>355</A><B>355</B><C>65</C></maxbounds>
    Upper right (NE) boundary when moving the boid(s), corresponds to landscape height/width
 <maxvelocity>9.0</maxvelocity>
    Maximum speed this object can travel
 <maxacceleration>5.0</maxacceleration>
    Maximum amount this object can accelerate
 <cruisedistance>9.0</cruisedistance>
    Distance this object will attempt to cruise in a straight line?
 <groupname>boids-f16</groupname>
    Binds objects of this group to this movement

</movement>

Ships Movement

The ship movement type defines waypoints along an ellipse and moves around them

<movement type="ships">

 <speed>0.03</speed>
    Speed for this object to move along the path
 <controlpoints>8</controlpoints>
    Number of waypoints to create
 <controlpointswidth>250</controlpointswidth>
    Width of the ellipse that points are created on
 <controlpointsheight>250</controlpointsheight>
    Height of the ellipse that points are created on
 <controlpointsrand>400</controlpointsrand>
    Not sure
 <starttime>600</starttime>
    Controls where the object starts along the path?
 <groupname>group</groupname>
    Binds objects of this group to this movement

</movement>

Spline Movement

Spline movement takes a series of given points and moves along a path interpolated from them.

<movement type="spline">

 <speed>#</speed>
    Speed for this object to move along the path
 <starttime>#</starttime>
    Controls where the object starts out along the path?
 <groundonly>bool</groundonly>
    Whether or not the object will stay along the ground?
 <controlpoint><A>#</A><B>#</B><C>#</C></controlpoint>
    X, Y and Z coords for the waypoints you want
 <controlpoint><A>#</A><B>#</B><C>#</C></controlpoint>
 <controlpoint><A>#</A><B>#</B><C>#</C></controlpoint>
    You must supply a minimum of 3 points, more if desired
 <groupname>group</groupname>
    Binds objects of this group to this movement

</movement>


Closing Remarks

Object placements can be one of the most complex aspects of a landscape. There are many different methods of using them available so there are a lot of possibilities. Although they are optional, they are almost always used to at least place some trees on the landscapes to spruce things up. Like all the optional landscape features, they are especially powerful when used alongside the additional features found in many of the other landscape files to get the most effect.




Edit this pagePage historyWhat links hereRelated changes
Donate to Scorched3D Visit Scorched3D at SourceForge.net Get it from CNET Download.com! 5 Stars
© Copyright 2008 Gavin Camp. All Rights reserved.