XML/Resource

From MegaGlest
Revision as of 14:25, 12 July 2011 by 213.252.171.254 (talk) (→‎XML)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Engines icons.png This article documents Glest, GAE, and MegaGlest

This is noted in the colored backgrounds, which denote lines as being engine specific. See the key below.[Editing help]

Template:Clear

Game resources are specified under the resources directory of the tech tree. Each resource will have it's own subdirectory and a resource specification file with the same name as the resource, but ending in .xml.

Note that there are 4 types of resources and that only one of the below can be specified for a single resource.

Template:TOC limit

XML

Template:XML definition header

<?xml version="1.0" standalone="no"?>
<resource>
	<image path="images/image.bmp"/>
	<type value="static">
		<!-- Start GAE Only -->
		<recoup-cost value="true" />
		<!-- End GAE Only -->
	</type>
	<type value="consumable">
		<interval value="30"/>
		</type>
	<type value="tech">
		<model path="models/gold.g3d">
			<!-- Start MG Only -->
			<particles value="true">
				<particle-file path="models/tree_particles.xml"/>
			</particles>
			<!-- End MG Only -->
		<model>
		<default-amount value="1500"/>
		<resource-number value="1"/>
	</type>
	<type value="tileset">
 		<default-amount value="300"/> 
		<tileset-object value="1"/>
	</type>
	<!-- Start GAE Only -->
	<display value="true"/>
	<!-- End GAE Only -->
</resource>

Documentation

image

This is the path of the resource's image, which will be displayed on the top with the HUD, unless the resource is a hidden resource (which means it will not appear on the HUD, GAE only), it needs an image to accompany it.

type

The main body of the resource, there is only ONE type tag. The above example has more simply because its shows all the differing possibilities based on the different choices of the type. The type refers to how the resource is controlled. A static resource can only be added from production, morphing, upgrades, or generation. A consumable is like a static resource, but are used in cycles. A tech resource is harvested from resource nodes placed on the map. A tileset resource is harvested from a specific tileset object.

static

If static is chosen, there are no needed attributes. Static resources aren't actually consumed, and if a unit requiring them dies, they can be reused. In GAE, there is an optional recoup-cost tag which controls whether or not you get the resource back when the unit that used it dies. Defaulting to true, you'd get the static resources back after the death of a unit using said resource, but if false, you will not (it will be lost in the same way as a tech or tileset resource).

consumable

Consumables only have a single attribute, the interval, which is how often (in seconds) that the resources from producers (such as Tech's cow) place their resource in the store and how often consumers (like Tech's swordman) consume those resources. If there isn't enough, the unit will lose one third of it's HP every interval. The number in parenthesis is the surplus if positive, and the shortage if negative.

tech

Tech resources need a link to the G3D model that will be displayed, the amount that will be in the resource, and the resource number, which is which resource node number on a map will be replaced with that resource.

tileset

Similar to a tech resource, the tileset resource must specify how much of that resource are held in each object, and which tileset object number will correspond with it (eg: Object 1 is trees). There is not yet any way to make multiple tileset objects be the same resource.

display

A GAE only feature that toggles whether or not the resource appears in the HUD. Generally, you'd want most resources to be there, but it can be useful to have a hidden resource, such as one that may be used to limit you to a single "hero" unit, etc.

See also