Skip to content

StartServerOptions beta ​

Interface of @v12-engine/engine/server

ts
export interface StartServerOptions extends Omit<GameServerOptions, 'mode' | 'port'>

What a game server is started with: the game, where its worlds come from, and the server's own options

Members ​

computer ​

ts
computer?: GameMode['ai'] | BrainDef | null;

How a computer player in a seat plays (ai says which seats, and those nobody took are its too): its options by seat (GameMode.ai), or the brain that plays every seat of the computer (defineBrain), against everyone else's base; the first brain the game lists, against everyone else's base when left out; null for a game the computer does not play. mode for a brain by seat (GameMode.brain)

game ​

ts
game?: Game<unknown>;

The game (createGame): its rules, its start (Game.onStart) where onStart is left out, and its first map where map, makeWorld and mode are. A server never fetches a game's view. Or rules in its place

makeWorld ​

ts
makeWorld?: (settings: Record<string, string>, context?: {
        log?: Logger;
    }) => World | Promise<World>;

A world made in code for each game, with the lobby's settings: in the place of a map. Says its seats too

map ​

ts
map?: GameMap;

A map of the game: each game is played on a world made from it, with a seat for each of its players with a start

mode ​

ts
mode?: GameMode;

A mode put together elsewhere, in the place of all of the above but the game

name ​

ts
name?: string;

What the mode is called. The map's name, or the game's

onStart ​

ts
onStart?: (world: World, context: {
        map?: GameMap;
        settings: Record<string, string>;
    }) => void | Promise<void>;

What the game does once a world is made, before anyone plays: a mission given, the first wave sent

port ​

ts
port?: number;

The port to listen on: 8787 when left out, 0 for any free one

rules ​

ts
rules?: Rules;

The module of the game (Rules), in the place of game: the full API underneath, its start and map said here

seats ​

ts
seats?: ModeSeat[];

The seats a player may take. Those of the map when left out