[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.16.2.3 World Definition Section

This section describes the world definition section.

Sector Section

A map file usually contains at least one sector. A sector is an infinite area of space which you can populate with mesh objects and lights. Using portals you can connect different sectors.

Note that while a sector is in fact infinite, in practice it is usually bounded by some geometry. For an outside level there is usually a sky box or sky dome which marks the outermost geometry. In case of indoor type levels there are usually sector walls.

Here is an example sector:

 
<sector name="room">
  <meshobj name="walls">
    <plugin>crystalspace.mesh.loader.thing</plugin>
    <zfill />
    <params>
      <v x="-10" y="-1" z="10"/> <v x="10" y="-1" z="10"/>
      <v x="-10" y="-1" z="-10"/> <v x="10" y="-1" z="-10"/>
      <v x="-10" y="4" z="10"/> <v x="10" y="4" z="10"/>
      <v x="-10" y="4" z="-10"/> <v x="10" y="4" z="-10"/>
      <material>wood</material>
      <texlen>4</texlen>
      <p name="up">
        <v>6</v> <v>7</v> <v>5</v> <v>4</v>
      </p>
      <p name="down">
        <v>3</v> <v>2</v> <v>0</v> <v>1</v>
      </p>
      <p name="back">
        <v>7</v> <v>6</v> <v>2</v> <v>3</v>
      </p>
      <p name="front">
        <v>4</v> <v>5</v> <v>1</v> <v>0</v>
      </p>
      <p name="left">
        <v>6</v> <v>4</v> <v>0</v> <v>2</v>
      </p>
      <p name="right">
        <v>5</v> <v>7</v> <v>3</v> <v>1</v>
      </p>
    </params>
  </meshobj>
  <light>
    <center x="0" y="3" z="0"/>
    <radius>40</radius>
    <color red="1" green="1" blue="1"/>
  </light>
</sector>

In the above example we create a sector called ‘room’ which contains one mesh object (the outer walls of the sector) and one light. Any type of mesh object can be placed in a sector. In this example we use the ‘thing’ mesh object.

There are some other things you can specify in a sector. By default a sector will use the ‘frustvis’ visibility culler. This visibility culler will only do frustum culling. For small sectors (i.e. a small number of objects) this is usually sufficient. If you have a large sector with lots of objects then you should probably use ‘dynavis’ instead. Like this:

 
<cullerp>crystalspace.culling.dynavis</cullerp>

In addition to using ‘meshobj’ for specifying mesh objects in a sector there are also some other techniques that you can use.

A sector can also contain fog like this:

 
<fog red=".5" green=".5" blue=".5" density=".01" />

Finally a sector can contain nodes. A node represents something that has a position. In addition a node can contain keys and addons. Crystal Space itself doesn't use nodes but an application using Crystal Space can use them for whatever purpose it needs. Here is an example:

 
<node name="monster">
    <position x="10" y="3" z="12" />
    <key name="spawn" value="100" />
</node>

Sectors can contain keys and addons.

Region Specification

With regions it is possible to group related objects (like textures, materials, mesh objects, mesh factories, sectors, sequences, triggers, shared variables, ...). Regions are not a geometrical concept. It is possible to define a region which contains all wall geometry and a region which contains all moving geometry. Usually though, regions represent some area in the world. You can use regions to dynamically load/unload parts of the world. This is useful if you have really big worlds that don't fit in memory at once.

Collection Specification

A collection is similar to a region in some respects but the purpose is different. Basically a collection is a collection of some other objects which you want to tie together for some reason (other than dynamic loading). For example, using them in a scripting setup.

Here is an example collection:

 
<collection name="carCol">
    <meshobj>car</meshobj>
    <meshobj>tire1</meshobj>
    <meshobj>tire2</meshobj>
    <meshobj>tire3</meshobj>
    <meshobj>tire4</meshobj>
    <light>lightname</light>
</collection>

Collections can also contain keys.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.