Skip to content

Lobby options

GetCurrentGameOptions() returns the lobby settings as a GameOptions value, or nil when there are none. Call its methods with :.

local options = GetCurrentGameOptions()
if options ~= nil then
    LogInfo("map size", options:GetMapSize())
    options:SetPopulation(200)
end

Getters return the setting, or nil when it can't be read.

Setters return true when the local lobby settings were written, and false otherwise. They only work before a match starts: during a match, in the editor or on the end screen they return false. true doesn't mean other players or the host accepted the change. Boolean setters treat nil and false as false and anything else as true. Integer setters write the value without checking that the game supports it.

Get a fresh GameOptions after the lobby changes, check every setter result, and call setters once per user action, not every Update.

Match settings

Setting Get Set Value
Game mode GetGameMode() SetGameMode(value) Integer
Map size GetMapSize() SetMapSize(value) 120, 144, 168, 200, 220, 240 or 480
Map GetLocation() SetLocation(value) Location ID
Starting age GetStartingAge() SetStartingAge(value) Integer
Ending age GetEndingAge() SetEndingAge(value) Integer
Game speed GetGameSpeed() SetGameSpeed(value) Integer
Reveal map GetRevealMap() SetRevealMap(value) Integer
Starting resources GetResources() SetResources(value) Integer
Population limit GetPopulation() SetPopulation(value) Integer
Record game GetRecordGame() SetRecordGame(value) Boolean
Full tech tree GetFullTechTree() SetFullTechTree(value) Boolean
Lock teams GetLockTeams() SetLockTeams(value) Boolean
Lock speed GetLockSpeed() SetLockSpeed(value) Boolean
Turbo mode GetTurboMode() SetTurboMode(value) Boolean
Handicap GetHandicap() SetHandicap(value) Boolean
Walkable farms GetWalkableFarms() Boolean

SetRandomMapPoolLocations(locations) sets the random map pool to one map: pass an array with exactly one location ID, such as { 42 }. Any other length returns false.

Player slots

Slots are numbered 0 to 7. A slot is a lobby position, not a player ID.

Setting Get Set
Team GetPlayerTeam(slot) SetPlayerTeam(slot, team)
Colour GetPlayerColor(slot) SetPlayerColor(slot, color)
Civilization GetPlayerCivilization(slot) SetPlayerCivilization(slot, civilization)

SetAssignedPlayerCivilization(civilization) sets the civilization of your own slot, and returns false when that slot can't be found.

Match setup

These read-only methods describe the loaded match.

GetGameSetup() returns the settings the game reads to define AI script symbols at the start of a match, or nil and a reason (game-setup-unresolved, no-game-options, no-world or game-setup-unreadable):

Field Meaning
victoryType, victoryCondition Victory settings.
subGameModes Sub-game-mode bits.
sessionKind The kind of session.
framesPerSecond Frame rate setting.
nomadResources, groupedByTeam, nomadStyle, michiStyle, extraStyle, teamTogether, pocketDisabled Map setup flags (booleans).
teams Team of players 1 to 8, an array of 8.
startPositions Start positions as { x, y } tiles, up to 8.

GetGameDataKind() returns the game data kind the game tests to define UP-GAME-WK, or nil.

The integers in both are the game's internal values; log them in a match whose settings you know before relying on one.

GetVictory, SetVictory, GetAIDifficulty and others exist but are not implemented.