XML/Tileset

From MegaGlest
(Redirected from Tileset XML)
Jump to navigation Jump to search

Back to XML Overview

Tilesets are structures which define how to render a map. Its XML explains which surface textures to use, which object models, day/night lighting, fog, weather, and water.

XML[edit]

<?xml version="1.0"?>
<tileset>
	<surfaces>
		<surface>
			<texture path="textures/surface.bmp" prob="1.0" />
		</surface>
	</surfaces>
	<objects>
		<object walkable="false">
			<model path="models/tree.g3d" anim-speed="150" smoothTwoFrameAnim="false" rotationAllowed="true" randomPositionEnabled="true">
				<particles value="true">
					<particle-file path="models/tree_particles.xml" />
				</particles>
				<rotationAllowed value="true" />
			</model>
		</object>
	</objects>
	<ambient-sounds>
		<day-sound enabled="true" path="sounds/day.ogg" play-always="false" />
		<night-sound enabled="true" path="sounds/night.ogg" play-always="false" />
		<rain-sound enabled="true" path="sounds/rain.ogg" />
		<snow-sound enabled="true" path="sounds/snow.ogg" />
		<day-start-sound enabled="true" path="sounds/chicken.wav" />
		<night-start-sound enabled="true" path="sounds/wolf.wav" />
	</ambient-sounds>
	<parameters>
		<water effects="true">
			<texture path="textures/water.tga" />
		</water>
		<fog enabled="true" mode="2" density="0.010" color-red="0.3" color-green="0.3" color-blue="0.3" />
		<sun-light red="1" green="1" blue="1" />
		<moon-light red="0.3" green="0.3" blue="0.4" />
		<day-night value="0.7" />
		<weather sun="0.5" rain="0.4" snow="0.1" />
        <!--air-height value="10"/-->
	</parameters>
</tileset>

Documentation[edit]

surfaces[edit]

Surfaces are the textures used for the ground. There must be at least 5 surface elements in each tileset, one for each surface type. A 6th surface can be defined for cliffs as well (MegaGlest only, but backwards compatible).

surface[edit]

Inside the surfaces element is the individual surface elements. These elements each define the surface for different types, and order is important. The first element will be surface 1 (generally grass), the second will be surface 2 (grass 2), and so on... Standard tilesets only need 5 surface tags, but a 6th optional one may be defined for custom cliff textures in MegaGlest.

texture[edit]

The texture tag is inside the surface tags, and there can be multiple texture tags. These are numerous images that will make up the surface of that cell. When multiple textures are listed, Glest will choose one based on its prob attribute, which is the percentage probability (in decimal form, 0 - 1) of that texture being used. The path attribute is the relative path to the texture. The prob attributes must all add up to 1.

objects[edit]

Objects are the models which will be used for objects placed on maps, such as trees, statues, or rocks. There must be exactly 10 object elements inside the objects tag, order-sensitive. The first object is a regular tree, the second is a dead tree, and so on. A complete list of objects can be found on the Tilesets page. Please note that objects are randomly rotated when placed on the map, so should be created with that in mind.

object[edit]

Inside the objects tag are exactly 10 object tags. These tags can store the paths to the object's models. The walkable attribute defines whether or not units can walk through the object (air units can always pass over all objects).

model[edit]

The model tag defines the path to the G3D file in the path attribute. There can be multiple model tags inside each object tag, and one will be randomly chosen each time.

anim-speed is a value which denotes the model is animated and should be played at the corresponding speed.

smoothTwoFrameAnim is a switch which smoothes 2 frame animations with a sin curve for the animation speed. This is good for animated trees (example: see tileset birch forest).

rotationAllowed defines whether nor not the object can be randomly rotated when placed on maps. By default, all objects will be given a random rotation. If false, the objects will not be rotated and will be seen at the angle it appears in the G3D viewer.

randomPositionEnabled defines whether nor not the object can be randomly placed on maps. By default, all objects will be given a random position within the field. If false, the objects will be placed at the center of the field.


particles[edit]

Particles can be set to any object. Unit particle XMLs will be used used for this, and any number of particle XMLs can be linked.

day-sound[edit]

If the enabled attribute is true, a sound will be played if it is daytime. The path attribute is the relative path to the sound file. The play always attribute overrides the other sounds and plays the sound always.

night-sound[edit]

If the enabled attribute is true, a sound will be played if it is night time. The path attribute is the relative path to the sound file. The play always attribute overrides the other sounds and plays the sound always.

rain-sound[edit]

If the enabled attribute is true, a sound will be played when it is raining. The path attribute is the relative path to the sound file.

snow-sound[edit]

If the enabled attribute is true, a sound will be played when it is snowing. The path attribute is the relative path to the sound file.

day-start-sound[edit]

If the enabled attribute is true, a sound will be played once every time the day starts. The path attribute is the relative path to the sound file.

night-start-sound[edit]

If the enabled attribute is true, a sound will be played once every time the night starts. The path attribute is the relative path to the sound file.

water[edit]

If effects are enabled, land-units will make splash effects when they walk through water.

texture (water)[edit]

A child tag of the water element, there are generally multiple texture tags which will be strung together to make a sprite, a series of 2D files played in a loop to create an animation. Again, this is order specific, and it is recommended to use at least four images.

fog[edit]

If fog is enabled, then it will be drawn with the tileset. The mode attribute is the OpenGL drawing method, generally "2", while density is the thickness of the fog (from 0-1). Each of the three colour attributes are used to create an RGB color. Each is a percentage of that color in decimal form (0-1).

sun-light[edit]

Sets the RGB color for daytime. Each of the three colour attributes are used to create an RGB color. Each is a percentage of that color in decimal form (0-1).

moon-light[edit]

Sets the RGB color for night time. Each of the three colour attributes are used to create an RGB color. Each is a percentage of that color in decimal form (0-1).

day-night[edit]

The value attribute is the day-night ratio: the length of the day compared to the length of the night, as a percentage in decimal form. For example, 0.5 would mean that the day is the same length as the night, 0.7 would mean that the day-night ratio would be 0.7:0.3 (if the day was 700 seconds long, the night would be 300), and so on.

weather[edit]

The weather element chooses the percentage chances of the 3 possible weather conditions: sun, rain, or snow, in decimal form (0-1).

air-height[edit]

Optional attribute to set a higher flying height for air units. This is needed when a tileset has very high trees or bigrocks for example. By this you can make the air units fly higher. If its smaller then the default (5) its ignored. Syntax is: <air-height value="15"/>

See Also[edit]