Skip to content

GameListController beta ​

Interface of @v12-engine/client

ts
export interface GameListController

The games of a server, as its list says them (GET /games): read, read again every few seconds while shown, and one joined or watched. What the Find a game screen shows (findGameScene)

Members ​

address ​

ts
address(game: GameListing): string;

The address of a game, to connect to: the server's, and its room

draining ​

ts
readonly draining: Accessor<boolean>;

Whether the server takes no new games: stopping

games ​

ts
readonly games: Accessor<GameListing[]>;

The server's games, as last read

join ​

ts
join(game: GameListing): void;

Takes a seat at a game, or watches it

kinds ​

ts
readonly kinds: Accessor<GameKindListing[]>;

The kinds of game the server lets players make (a "New game"), with the settings each offers: none for most

leaveQueue ​

ts
leaveQueue(): void;

Stops waiting

make ​

ts
make(kind: string, settings?: Record<string, string>): Promise<string | undefined>;

Makes a game of a kind the server offers, with settings (the map), and takes a seat at it: its room's name, or nothing when the server said no (said says why)

queue ​

ts
queue(kind: string, name?: string): void;

Waits to be matched with other players for a kind of game (one the server matches for, GameKindListing.queue), and takes a seat at the game made for them once it is: by the ticket the server gives

ratings ​

ts
readonly ratings: Accessor<RatingsListing | undefined>;

The best of a mode where the server keeps ratings (GET /ratings): the top ten, and this browser's player's own place where they played it. Undefined until read, and where the server keeps none

refresh ​

ts
refresh(): Promise<void>;

Reads the list again

refreshRatings ​

ts
refreshRatings(mode?: string): Promise<void>;

Reads the best again, of a mode (the server's first when left out)

said ​

ts
readonly said: Accessor<string>;

What went wrong last, in words: the server is not there. Empty when nothing did

server ​

ts
readonly server: string;

The server, at the address its sockets are: ws://host:8787

start ​

ts
start(seconds?: number): void;

Reads it again every seconds until stop (also called by the screen as it goes)

stop ​

ts
stop(): void;

Stops reading the list every few seconds

waiting ​

ts
readonly waiting: Accessor<{
        kind: string;
        waiting: number;
        needed: number;
    } | undefined>;

What is being waited for: the kind, how many wait of how many it takes. None while not waiting

watch ​

ts
watch(game: GameListing): void;

Opens a game to watch rather than play: connects to it and gives the game with no seat