Parent Maps

Parent Maps provide a way of positioning objects in the mud client using the config file as opposed to 3dtags. For example in the config file you can position a sack at x=252.30, y=289.47 using the following position element:

<POSITION name="sack" x="252.30" y="289.47" />

The type of parent map used to display the sack determines when it is displayed. For example if it is a staticposition parent map then the sack is drawn when the mud client is first loaded and stays in the mud client until it is shut down. A staggeredposition parent map on the other hand would only draw the sack if the player was a certain distance from the sack. A mobsquare parent map would only draw the sack if the mud said the sack was in the room eg {osack,+}.

There are also map parentmaps that instead of having a list of position have a 2D image with the same dimensions as the mud. The color of the 2D image at the x,y is matched to the 'color' attribute of an object and the corresponding object is drawn. In this way you can specify large areas of vegetation on the 2D image and draw it without the need for a huge list of position.

The layout of parent maps is as follows where parentmaps has any number of staticposition, staggeredposition, staticmap and staggeredmap but only one mobsquare. For example:

<PARENTMAPS>

<STATICPOSITION objectsorting="none">
<POSITION name="sun" x="251.63" y="294.47" z="50"/>
<POSITION name="terrainmesh" directionx="0" directiony="0" directionz="1" />
</STATICPOSITION>
<STATICMAP filename="maps\staticobjects.tga" />
<STAGGEREDMAP filename="maps\staggeredobjects.tga" width="15" stagger="4"/>
<STAGGEREDPOSITION width="13" stagger="5" objectsorting="none" >
<POSITION iname="ariochdemon" x="258.11" y="279.77" z="0" scalexchildren="0.2" scaleychildren="0.2" scalezchildren="0.2" turn="-90"/>
<POSITION name="grass2" x="261.79" y="294.46" />
</STAGGEREDPOSITION>
<MOBSQUARE >
<POSITION name="maze" x="260" y="279.42" />
</MOBSQUARE>

</PARENTMAPS>

Position parent maps (staggeredposition,staticposition and mobsquare) have any number of position elements that provide the position of an object.

The order in which the parentmaps are rendered is the order in the parentmaps. In the above example the mobsquare would be rendered last. Individual parent map have a 'objectsorting' parameter such as:

<STATICPOSITION objectsorting="none">

which signifies the order in which object a rendered by the mud client in the parentmap itself. If it was 'renderfarthestfirst' then the furthest would be rendered first.

Staticposition
The staticposition parentmap has unlimited number of position and is rendered on startup of the mud client and rendered object's will remain until the mud client is shutdown. In the following example the town of sanom is drawn on startup:

<STATICPOSITION>
<POSITION name="sanom" x="251" y="294" z="0.35" scalex="0.162" scaley="0.18" scalez="0.162" turn="0" pitchchildren="90" />
..
..

Staticposition parent maps also providing impostering which allows for an object to be replaced by another object when a player moves a certain distance from the object centre. For example when a player moves a long way from the town of sanom you could replace the town with just the walls thus increasing the framerate. This is discussed more thoroughly in the impostering document.

Staggeredposition
Staggeredposition is similar to staticposition except only objects that are within a certain distance from the camera are displayed. This allows for the parent map to have large numbers of objects yet only display those that are needed. The staggeredposition has an extra 'width' and 'stagger' attribute where 'width' is the width of a square drawn around the player. Those object that are within that square are drawn. Stagger is how far a player must walk before the objects are redrawn. This stops the drawing and redrawing of objects every time a player takes a step.

<STAGGEREDPOSITION name="smallstagger" width="9" stagger="3" >

<POSITION name="sack" x="252.30" y="289.47" />

The above example draws a sack at 252.30, 289.47 if a player is within a 9 unit square around the sack.

files/positionmap.jpg

When a player walks 3 mud units the parent map will be refreshed.

It is also possible to use staggeredposition to draw objects that are specified by the mud. For example when a player walks into the room and the mud specifies a fountain (eg ofountain,+) the position of the fountain can be specified by the staggeredposition if it within the room radius (refer to rooms). For example if the mud specifies {ofountain,+} and the room centre is x=253, y=295.5 and room radius is 0.7 then the fountain will be drawn at x=253,03, y=295.07

<STAGGEREDPOSITION width="15" stagger="5" objectsorting="none" useinmob="true"
mobleeway="1.5">

<POSITION name="fountain" x="253.03" y="295.07" />

To specify use the staggeredposition in this way 'useinmob' should be set to true. Sometimes you might want to match objects that might be slightly outside the room radius. You can use the attribute 'mobleeway' that is a factor that is multiplied by the room radius by in order to get a match. Thus if the roomradius is 0.4 inin the above example you wont get a match. If you multiplied it by 0.4 by 1.5 you would.

Staticmap
Static maps will display an object based upon the color at a position x,y on a 2D image with loaded with the 'filename' attribute of the staticmap element. If for example at position 255,200 on the 2D image the color is $332211 and there is an objects with a 'color' attribute that matches $332211 then that object will be displayed. In this way it is possible to display large tracts of vegetation on a terrain without having to give the x,y position of every piece of vegetation. Like staticposition the objects will be drawn when the mud client is loaded and will only be destroyed when the mud client is closed.

The following is an example of a staticmap in parentmaps

<STATICMAP filename="maps\staticobjects.tga" />

An example of a static map is show below:

files/staticobjects.jpg

Staggeredmap
Same as a staticmap except that rather than all objects being displayed permanently, they are staggered like in staggeredposition. Thus vegetation closer to the camera can be displayed while vegetation further away isnt drawn. Like staggeredposition it has a stagger width (eg 15) and stagger (eg 4) where every time a player moves 4 units the stagger map will be redrawn.

<STAGGEREDMAP filename="maps\staggeredobjects.tga" width="15" stagger="4"/>

Mobsquare
The mobsquare is like a staggeredpositon but only those items specified by the mud as being in the room are displayed. For example if the mud specifies an applepie is in the room (eg {oapplepie,+}) and there is a position in the mobsquare that is an applepie and is within the room radius (refer to rooms) then the apple pie at the position is drawn. Like in staggeredposition with 'useinmob' set to true, the attribute 'mobleeway' can be used to increase the roomradius so that more objects are matched as being within the room.

You'd use 'mobsquare' over staggeredposition with 'useinmob' set to true when you want to display an object in the mud that is always there such as a heavy and unmoveable bed. The player can see the bed from a distance even though hes not in the room and when he gets into the room he can click the bed as though it were a mud item. If on the other hand the item is something like an applepie that can be taken then you dont want the apple pie to be seen from a distance since it might not be there when the player gets into the room because it might have been eaten. In such a case you'd use a mob square.