Skip to content

GameMode ​

Interface of @v12-engine/engine/server

ts
export interface GameMode

What a server runs: a game module, the seats of a game of it, and how its world is made. Each game starts from a world made anew, with the lobby's settings

Members ​

ai ​

ts
ai?(seat: ModeSeat, seats: readonly ModeSeat[], settings: Readonly<Record<string, string>>): AiOptions;

How a computer player in a seat plays: with what was chosen for that seat in the lobby (settings, from ServerHooks.seatSettings: a difficulty, a race). No computer players without

brain ​

ts
brain?: ModeBrain;

Which brain plays a seat of the computer (defineBrain), or its id (one the game lists in Rules.brains, or the engine's core.melee): one for every seat, or one by seat, with what was chosen for it in the lobby. The first brain the game lists when left out

id ​

ts
id: string;

The id of the mode, used to name the game it runs

makeWorld ​

ts
makeWorld(settings: Record<string, string>, context?: {
        log?: Logger;
        seats?: Readonly<Record<PlayerId, Readonly<Record<string, string>>>>;
        navigation?: NavigationBuilds;
    }): Promise<World>;

Makes the world of a game. context.log is the server's logger, for the world's own to be made under; context.seats what was chosen for each seat in the lobby, by player (ServerHooks.seatSettings): a race among them, in a game with races (seatSettingsOf), for the world to give each player (MapWorldOptions.races); context.navigation who builds its navigation (the server's worker thread: GameServerOptions.navigationWorker)

name ​

ts
name: string;

The mode's name as shown to players

rules ​

ts
rules: Rules;

The game's rules each world of the mode is made with

seats ​

ts
seats: ModeSeat[];

The seats of a game of this mode, in the order the lobby lists them

seatSettings ​

ts
seatSettings?: NonNullable<ServerHooks['seatSettings']>;

What can be chosen for each seat in the lobby, in place of what the game offers (seatSettingsOf(game)): the races a map offers (GameMap.races)