Skip to content

Lobby options

GetCurrentGameOptions() returns a GameOptions value when lobby settings are available. It returns nil when no lobby option set is available.

local options = GetCurrentGameOptions()
if options ~= nil then
    local map_size = options:GetMapSize()
end

CAUTION: Call setters only before a match starts. A setter returns false during an active match, editor session, or end-game screen.

Call every GameOptions method with :.

Match settings

Getter Setter
GetGameMode() SetGameMode(value)
GetMapSize() SetMapSize(value)
GetStartingAge() SetStartingAge(value)
GetEndingAge() SetEndingAge(value)
GetGameSpeed() SetGameSpeed(value)
GetRevealMap() SetRevealMap(value)
GetResources() SetResources(value)
GetPopulation() SetPopulation(value)
GetLocation() SetLocation(value)
GetRecordGame() SetRecordGame(value)
GetFullTechTree() SetFullTechTree(value)
GetLockTeams() SetLockTeams(value)
GetLockSpeed() SetLockSpeed(value)
GetTurboMode() SetTurboMode(value)
GetHandicap() SetHandicap(value)

A getter returns nil when it cannot read the setting. A setter returns true only when it writes the setting.

GetMapSize returns one of these public sizes when it recognizes the value:

120    144    168    200    220    240    480

Use one of those values with SetMapSize. Other integers are written as-is; the binding does not verify that the game recognizes them.

Random map pool

SetRandomMapPoolLocations(locations) accepts an array with exactly one map location ID.

local options = GetCurrentGameOptions()
if options ~= nil then
    options:SetRandomMapPoolLocations({ 42 })
end

The call returns false when the array length is not one.

Player slots

Player-slot methods use an index from 0 through 7. A slot index is not necessarily the same as a game player ID.

Getter Setter
GetPlayerTeam(slot) SetPlayerTeam(slot, team)
GetPlayerColor(slot) SetPlayerColor(slot, color)
GetPlayerCivilization(slot) SetPlayerCivilization(slot, civilization)
None SetAssignedPlayerCivilization(civilization)

SetAssignedPlayerCivilization finds the assigned player slot. It returns false when that slot is unavailable.

Rules

  • Get a new GameOptions value after a lobby or game state change.
  • Check every setter result.
  • Call a setter once for a user action, not in every Update.
  • Do not use unavailable compatibility methods from the API name index.

Methods such as GetVictory, SetVictory, and GetAIDifficulty are not implemented placeholders. See the complete placeholder list for their fixed return values.