This mode is triggered when both
(1) the "FFA Mode" modoption is set (it is set on all our FFA hosts)
(2) the map contains a /luarules/configs/ffa_startpoints.lua file
When triggered it overrides the usual options (i.e. random, choose in game, etc).
The effect of this is that maps can choose a different set of startpoints, dependent on the number of allyTeams spawned in the game.
Each allyTeam has a single startpoint. The commanders spawned in that allyTeam will be clustered around its startpoint.
The startpoints are randomly assigned to allyTeams by BAs spawning gadget.
The ffa_startpoints.lua file should contain a lua table of format:
Code: Select all
ffaStartPoints[numAllyTeamIDs][startPointNum] = {x,z}
The i-th value {x,z} of this table should be the x and z co-ordinates of the i-th startpoint to be used when there are numAllyTeamIDs allyteams in the game.
An example ffa_startpoints.lua file (containing only the cases for 1, 2 allyteams) is attached. Typically a FFA game in BA contains up to 16 allyTeams. For more examples, and a widget that autogenerates a matching lua-table/image for the startpoints, see http://imolarpg.dyndns.org/trac/balates ... %20example.
The table doesn't have to be hardcoded - it can be auto-generated and even have randomness. The ffa_startpoints file is included and executed as normal lua.
If there are i allyTeams in the game and the ffaStartPoints table is missing entry , or does not contain i elements, or if it is not present at all (including if the ffa_startpoints.lua file does not exist), then BA will just revert to normal spawning.
I am happy for other games to plunder the code and use the same system.