Sidedata.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
Flozi (talk | contribs)
Cleanup a bit and correct some information. Follow jK's style as in http://springrts.com/wiki/MouseCursors
Line 1: Line 1:
==What and & Where is it?==
==Location==
'''sitedata.lua''' is a file in the '''gamedata\''' folder of a Spring Game.
<code>sitedata.lua</code> is a file in the <code>Gamedata/</code> directory of a Spring Game.
It defines the playable factions/races/sides in a game. (ie ARM & CORE, Terran, Protoss, USA, Bananas,...)
It defines the playable factions/races/sides in a game. (ie ARM & CORE, Terran, Protoss, USA, Bananas,...)
==Source==
The engine source code which parses the data from this file is viewable here: https://github.com/spring/spring/blob/master/rts/Sim/Misc/SideParser.cpp


==Details==
==Details==
A faction can have several properties, commonly used are:<br>
Each faction can have two properties:<br>
-a name (displayed in lobby)<br>
* <code>name</code> (displayed in lobby)<br>
-a startunit (must be read by [http://springrts.com/phpbb/viewtopic.php?f=67&t=21883&p=417021 a gadget to actually spawn the start unit])<br>
*<code>startUnit</code> (must be read by [http://springrts.com/phpbb/viewtopic.php?f=67&t=21883&p=417021 a gadget to actually spawn the start unit])<br>
-an icon (displayed in lobby)


==Example==
==Example==
Single faction:
===Single Faction===


<code><pre>
<code><pre>
Line 22: Line 24:
</pre></code>
</pre></code>


Multiple factions:
===Multiple Factions===
<code><pre>
<code><pre>
local sideData = {
local sideData = {
Line 38: Line 40:


==Faction Icons==
==Faction Icons==
It seems they are not defined in this file but just read from a folder '''sidepics\'''
Faction icons are not defined in this file but just read from the <code>Sidepics/</code> directory.


<span class="note">(NB: Some widgets, such as advanced playerlist, may complain about missing faction icon if they are not present)</span>
<span class="note">(NB: Some widgets, such as advanced playerlist, may complain about missing faction icon if they are not present)</span>
Line 44: Line 46:
Can be .bmp and maybe other formats.
Can be .bmp and maybe other formats.
Filename is same as Faction name ie for above examples:
Filename is same as Faction name ie for above examples:
AwesomeDudes.bmp NKG.bmp Drone.bmp
<code>AwesomeDudes.bmp NKG.bmp Drone.bmp</code>


[[Category:Game development]]
[[Category:Game development]]
[[Category:gamedata]]
[[Category:gamedata]]

Revision as of 13:33, 2 April 2011

Location

sitedata.lua is a file in the Gamedata/ directory of a Spring Game. It defines the playable factions/races/sides in a game. (ie ARM & CORE, Terran, Protoss, USA, Bananas,...)

Source

The engine source code which parses the data from this file is viewable here: https://github.com/spring/spring/blob/master/rts/Sim/Misc/SideParser.cpp

Details

Each faction can have two properties:

Example

Single Faction

local sideData = {
	{
	name		= 'AwesomeDudes',
	startunit	= 'awesomedudebase',
	},
}
return sideData

Multiple Factions

local sideData = {
	{
	name		= 'NKG',
	startunit	= 'bflagship2',
	},
	{
	name		= 'Drone',
	startunit	= 'kdroneengineer',
	},
}
return sideData

Faction Icons

Faction icons are not defined in this file but just read from the Sidepics/ directory.

(NB: Some widgets, such as advanced playerlist, may complain about missing faction icon if they are not present)

Can be .bmp and maybe other formats. Filename is same as Faction name ie for above examples: AwesomeDudes.bmp NKG.bmp Drone.bmp