defineGame
defineGame<
Room,Worlds,SavesOff>(options):GameDescriptor
Declares a game: its name, the scene it starts in, its room, its
plugins and what the room and the page must agree on. It composes the
plugins as the module loads, so a requirement missing, a cycle, a bad
anchor, a bad omit, a replacement conflict or two plugins under one name
with different options fail there, with the composer’s message, and so
does a world’s record or a save kept per world in a game whose rooms
hold no world. Export it as game from src/game.ts, mount it with
<Game game={game}>, and re-export it from the room’s scene file, as
export { game } from "../game". As React Router’s
createBrowserRouter and Chakra’s createSystem build one
configuration object before a provider consumes it.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Room extends RoomSettings | undefined |
undefined |
Worlds extends true | WorldsOptions | undefined |
undefined |
SavesOff extends false | undefined |
undefined |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
GameOptions<Room, Worlds, SavesOff> |
Returns
Section titled “Returns”Example
Section titled “Example”export const game = defineGame({ name: "three-mmorpg", start: "meadow", room: defineRoom(), worlds: true, plugins: [characters(), stats(), resources()], });