Sidedata.lua: Difference between revisions

From Spring
Jump to navigationJump to search
added defaults(not completed)
Flozi (talk | contribs)
Undo revision 21881 by Emmanuel (talk)
Line 4: Line 4:
==Purpose==
==Purpose==
This file defines the playable factions/races/sides in a game. (ie ARM & CORE, Terran, Protoss, USA, Bananas,...)
This file defines the playable factions/races/sides in a game. (ie ARM & CORE, Terran, Protoss, USA, Bananas,...)
==Default==
*missing file not crash the engine (=?)
*mandatory for the game(verified)
*not have defaut file loaded by engine (=?)
*missing values dont have defaut (=?)


==Source==
==Source==

Revision as of 20:08, 10 June 2011

Location

sitedata.lua is a file in the Gamedata/ directory of a Spring Game.

Purpose

This file 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:

These values are available to lua via Spring.GetSideData (See Lua_SyncedRead):

local sideName, startUnit = Spring.GetSideData(sideID)

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