@v12-engine/client/app
Core
What a game meets first.
| Name | Kind | What |
|---|---|---|
| AppEditorScene | interface | The map editor's scene as the app's scenes make it (appScenes): its id and name, the game, the map it starts on, the scene that plays its maps and where its way out goes. What the editor's editorScene takes, and more |
| appScenes | function | The scenes a game is made of, as a list for startApp: the start screen (home: what the game is, and a button for each scene), the game (play), the settings, a random map when the rules generate one, the map editor and a server when asked. The list is a plain array: a project adds its own scenes to it, or takes one away startApp( target: '#game', game, scenes: appScenes( game, editor, server: true ), start: 'home' ) sceneAsked picks the scene the address names (/?editor), for start |
| cinematicScene | function | A scene that is only a cinematic: see the top of this file cinematicScene( id: 'intro', game, world: makeWorld, cinematic: readCinematic(introFile), then: scene: menu ) |
| defineCampaign | function | A campaign put together: a menu with the mission it is at and the missions won with their times, and a scene that plays any of its missions. A mission won is kept at once, with its time and the heroes it ends with; its end has the next mission and a retry, a mission lost has a retry, and both go back to the menu. A mission starts with the heroes carried out of the one before, in place of the ones its map has for them. Of a file (campaign.json, what the editor's Campaign panel writes) with its code beside it (CampaignFromFile): the file's over the code's |
| exitButton | function | The start menu's Exit (appScenes({ menu: { buttons: [exitButton(shell)] } })): out of the game through the shell, shown only where the shell can do it, so that the same page in a browser has no button that does nothing |
| gameScene | function | A scene of a game, from what launch takes: the world made from the map (or made in code, loaded from a save, or joined: GameSource), what the game starts on it, and the client that shows it. For an app of scenes (startApp) with a menu before the game and the editor beside it: opened from the editor's Play, it plays the map as it is being edited (SceneArgs.editing), and from a save (SceneArgs.from) it goes on from it gameScene( id: 'play', game, map: () = mapNamed(), onStart, debug: true, exit: label: 'Menu', scene: 'home' ) |
| menuScene | function | A menu: its title and buttons, what the game is and its facts, a background, and a game scene played behind its buttons (behind: a cinematic that loops, composed in: menuScene({ ..., behind: cinematicScene({ ... }) })); drawn by the client, a component of the game's or an element of its own (MenuDef). A scene like any other (U2): what names it names the menu itself, and what its buttons go to is what it names (Scene.names) const home = menuScene( id: 'home', name: 'Home', title: 'My game', buttons: [ label: 'Play', scene: play ] ) |
| Scene | interface | Something the app shows, one at a time (U2): every scene is this shape, whatever it shows. It draws itself into the element it is given (open) and gives back what takes it away again: going to another scene ends the one shown, a game disposed with everything it holds (its engine, its canvas, its sounds, its listeners), once the next one is ready and has come in over it (SceneOpenContext.hold, SceneTransition). A scene of a game's own (a campaign map, a lobby, a hero draft) is one as it is; a game, a menu and a scene fetched as it opens are ones their makers build (gameScene, menuScene, lazyScene), with more on them |
| sceneAsked | function | The scene the page's address asks for, by id: /?editor opens the scene with the id editor, /?server the server's, /?find-game the rooms'; fallback (the start screen) when it names none. For startApp's start |
| sceneRef | function | A scene named by its id, before it is there to name itself (one made further on, or in another module): A is what it is opened with |
| startApp | function | Starts an app of scenes on the page: menus, games, map editors and screens of a game's own, one shown at a time, each going to the next with goTo. What a game that is more than one launch is made of: a menu before the game, a campaign's map between its missions, an editor that plays its maps. startApp( target: '#root', scenes: [menu, game, editor], start: 'menu' ) startApp( target: '#game', game ) One game on a page needs none of it: that is launch |
| StartAppOptions | interface | What an app of scenes is started with |
| StartedApp | interface | An app started: its scenes, to add to in code, and what takes it off the page |
Advanced
Classes
| Name | What |
|---|---|
| StoredSettings beta | The settings with no game running: a screen of them before the game (a start menu's Settings, settingsScene). The client's and the game's own (GameView.hud.settings), as a game would list them, their values read from where they are kept (ready) and written back as they are set, for the next game to read as it starts. What a setting does to the client (apply) waits for one; what one is before it was ever set (initial) is its default here |
Interfaces
| Name | What |
|---|---|
| AppSceneChange beta | What a scene appScenes makes is changed in place by (AppScenesOptions.scenes) |
| AppScenesOptions beta | What appScenes makes the scenes from |
| AppShell beta | What a desktop shell says of leaving the game (a project of --desktop: its src/shell.ts): whether it can, and doing so. The client names no shell: a page in a browser's tab, which cannot close itself, has none or one that says it cannot |
| BriefingProps beta | What a mission's briefing screen is given (MissionDef.briefing): the mission, its words, what it asks, and its picture and voice as files |
| CampaignDef beta | A campaign: missions played one after the other, the heroes carried from one to the next, and what else each mission carries (MissionDef.carry) kept as its own data, of the type D |
| CampaignFromFile beta | A campaign of a file (campaign plan EQ8): its campaign.json (file, as imported: checked as it is read) with what is code beside it. What the file says is over the code's: its id, name, menu words, difficulties, chapters, and each mission's fields, the missions in its order. A mission of the code's that the file has not got comes after, with a name and a map of its own |
| CampaignMenuProps beta | What a campaign's menu is given: the campaign between its missions (CampaignController: how far it is, playing a mission, starting over, its saved games), and its words as they were declared |
| CampaignMissionArgs beta | What a campaign's mission scene is opened with: the mission, by its id (its first not won yet when left out) |
| CampaignScenes beta | Its scenes: the menu (<id>), the missions (<id>-mission, opened with { mission }: CampaignMissionArgs), and watching them from another page (<id>-watch), for a campaign that may be watched |
| CinematicSceneOptions beta | What a cinematic scene is made with (cinematicScene): the map and the rules as gameScene takes them, the cinematic, how it is played, and where the scene goes after |
| CreditsSceneOptions beta | What a scene of the credits is made with (creditsScene) |
| CreditsSection beta | A part of the credits: what they did, and who |
| DebriefProps beta | What a mission's debrief screen is given (MissionDef.debrief): the mission, its words, how long it took, the player's stats, a rating of one to three, and where it goes on to |
| FindGameArgs beta | What a scene of the games on a server is opened with: the server's address |
| FindGameProps beta | What the screen of a server's games is given: its games (GameListController), and the way out |
| GameScene beta | A scene that plays a game (asGameScene makes one, gameScene puts one together): which game module, which map, who plays. The rules live in the engine and the game modules, never here. Shown by the app as every scene is (open: playScene, run with its HUD); its client made by what plays games itself with load (the editor's Play here, in canvases it keeps over the editor) |
| GameSceneOptions beta | What a scene of a game is made with (gameScene): what a game is played with, as launch takes it (GamePlayOptions: where the game comes from, its name, its look, its files, its screens), and what the scene says of itself |
| GoTo beta | Opens a scene, ending the one shown as it comes in (SceneTransition), with what it takes. With no scene, the one the app starts with (startApp's start: a game's start screen), or the list of scenes where it starts with none |
| LazyScene beta | A scene whose code is fetched when it is first opened: an import() of the module that makes it. The list of scenes and a menu fetch none of the game it plays, its engine or its art's code. The scene it fetches has the same id, and is kept for the next time it is opened; what it names is said as it is made (names), checked before it is fetched. lazyScene makes one lazyScene('dev', 'Dev sandbox', () = import('./dev').then((module) = module.devScene)) |
| LobbyProps beta | What the lobby's screen is given: the lobby (LobbyController) |
| MapPlayOptions beta | What a game says of playing a map of its own made in the editor (see mapPlayScene) |
| MenuChoice beta | A button of a menu (MenuScene.buttons): where it goes, with what, or what it does (run) |
| MenuDef beta | A screen before or between games, as it is declared (menuScene makes the scene of it): a title and buttons, each going to a scene, or to the list of scenes with none. Each way takes more of it over than the last: - declared: its title, its buttons and where each goes, its background - in code: what a button does (run, given the way to other scenes) - a component in the place of the client's (MenuScreen, which it can wrap) - an element of the game's own (mount): any HTML, any framework |
| MenuProps beta | What a menu's screen is given: the menu as it was declared, and the way to other scenes |
| MenuScene beta | A menu (menuScene): a scene, with what it was declared with (MenuDef) |
| MissionContext beta | What a mission's start and carry are given: the map, the player at the screen, the campaign's progress as the mission began (progress.data: what the missions before carried), whether the game is new or loaded from a save, and the difficulty chosen for the campaign (CampaignDef.difficulties) |
| MissionDef beta | A mission of a campaign: its map, who plays it, what is set up on it, and what it carries on to the next (carry). D is the campaign's own data (CampaignDef<D>): what the missions carry and read back |
| OnlineArgs beta | What an online scene is opened with: the server's address, a ticket its seat lets players in by, to watch rather than play, the name to join by |
| OnlineSceneOptions beta | What an online scene is made with (onlineScene): its id, name, server, games, lobby, settings store and exit |
| ProfileSceneOptions beta | What a scene of a player's profile is made with (profileScene) |
| RandomMapSceneOptions beta | What a scene of a random map is made with (randomMapScene) |
| ReplayArgs beta | What a replay's scene is opened with: one kept in this browser (id) or opened from a file (replay), and the tick to start from (at) |
| ReplayBarProps beta | What the bar over a replay is given: what plays it (ReplayPlayback) |
| ReplaysProps beta | What the replays' screen is given: the replays (ReplaysController), and the way out |
| SceneContext beta | What a game scene is loaded with (GameScene.load): what every scene is given (what it was opened with, the way to others, the app's scenes, its runtime and the builder of its worlds' navigations: as SceneOpenContext), and the canvases the game is drawn on |
| SceneEntry beta | A line of the list of scenes the app starts with: a scene, and what it is opened with |
| SceneExit beta | Where a scene's way out goes (the HUD's Leave, a cinematic's Skip): its words, and the scene, opened with nothing |
| SceneOpenContext beta | What a scene is opened with (Scene.open): what it was opened with (args), the way to the others (goTo), the app's scenes, what the app runs with, who builds the navigations of the worlds it makes, and a way to draw a Solid component in an element under the app's own (its overlays: tooltips, menus, dialogs) |
| SceneRef beta | A scene by its id, with what it is opened with (A): what names a scene to go to (goTo, exit.scene, a menu's button, the list's line, the editor's Play) takes one. Every scene is one, so a scene is named by the scene itself; sceneRef(id) names one made further on, or in another module. startApp checks once, as it starts, that every one an app names is one of its scenes (U2) |
| Scenes beta | The scenes an app has, and the list it starts with: what App shows one of at a time. An app makes its own (createScenes) and hands it to startApp; nothing of it is shared between two apps on a page |
| SceneShows beta | What of a game a scene shows, by name (Scene.shows): the map file it plays, the cinematic it is |
| SceneTransitionProps beta | What a transition of a game's own is given: the two scenes' elements, the new one over the old and shown (hiding it first and moving either is the transition's), and what it calls as it is over, which ends the scene before. What it draws is over both, and goes then |
| ServerSceneOptions beta | What a seat at a server is asked for |
| SettingsLike beta | What a screen of the settings draws: the settings while a game runs (Settings), or kept with no game running (StoredSettings) |
| SettingsSceneOptions beta | What a scene of the settings is made with (settingsScene) |
| SharePanelProps beta | What the panel that shares a game is given: the sharing (GameShare) |
| WatchWaitingProps beta | What the screen of a game watched is given while it waits: what is watched, and what it waits for (WatchingController) |
Functions
| Name | What |
|---|---|
| asGameScene beta | A game scene of what it is made of (GameScene but its open): shown by the app as it plays one (playScene: run with its HUD), naming its way out (names) unless it says what it names. What the client's makers of game scenes use (gameScene, cinematicScene, a campaign's missions, a replay, a seat on a server), and a game's own |
| BriefingScreen beta | A mission's briefing: its name, its picture, its words and what it asks, its voice read out; Begin, or back to the campaign |
| campaignFromFile beta | A campaign made of its file and its code (CampaignFromFile): the file's over the code's, field by field; a mission's debrief merged (the file's words, the code's rating). What defineCampaign({ file }) plays. Throws where the file does not read, or a mission of the code's that the file has not got has no name or map |
| CampaignMenu beta | A campaign's menu: the mission it is at, to go on with; the difficulty, where it offers more than one; every mission, by chapter (each a fold with its picture, the one being played open), with its picture and how long the ones won took and the best time; and starting over, which asks once more before it forgets everything (but the difficulty). Its parts come in one after another (classes.motion.stagger) |
| createScenes beta | The scenes of an app, from those it starts with: more are added in code (register) |
| creditsScene beta | A scene of the credits (campaign plan SH1): the game's title and who made it, by parts, scrolling up on the scene's own clock, a track under them; Esc or Back leaves. What a start menu's Credits goes to creditsScene( sections: [ title: 'Design', names: ['Ada'] ], back: scene: home ) |
| CreditsScreen beta | The client's screen of the credits: the sections scrolling up from under the screen, on a clock of its own that a frame moves on (data-credits-at, seconds), until the last has gone over the top; the way back always there |
| DebriefScreen beta | A mission won: its name, how long it took, its words, a rating in stars, the player's stats; on to the next, or back to the campaign |
| ErrorScreen beta | The client's error screen: what happened in a sentence, and the buttons there are for it (load again, the last save, out). A game that could not be loaded gets it in the place of its loading screen; a game that stopped, over its last picture |
| findGameScene beta | A scene of a server's games (features-plan H1): what its list says (GET /games), read again every few seconds, to join one while it waits for players or watch one, in the scene that plays a game on a server (online, given the game's address and whether to watch). The server is server the scene is opened with (FindGameArgs), ?server= of the page, the scene's server, or port 8787 of the machine the page came from. component or mount is the screen as the game draws it, given the games (GameListController) and the way out; the client's (FindGameScreen) when left out |
| FindGameScreen beta | The client's screen of a server's games (GET /games): each with its game, mode and map, where it is at, its seats and who watches, to join while it waits for players or watch once it plays. Read again every few seconds |
| GameMount beta | A game on the page, as its run is (runGame): its element, the two canvases the client draws on, the screen while it loads, then its HUD and what floats over it, or the screen that says why it could not be loaded or stopped. Everything of the game is inside its element, and goes with it. How the game is loaded, started and ended is the run's: this draws it |
| isGameScene beta | Whether a scene plays a game (GameScene: it has load): what something that plays games itself asks of a scene before it makes its client (the editor's Play here) |
| isLazyScene beta | Whether a scene is fetched as it opens (lazyScene) |
| joinServer beta | A seat at a server of one game: the socket opened, the game's session connected, the seat asked for under the player's name (the playerName setting, or "Player"). What serverScene does; for a scene of one's own |
| lazyScene beta | A scene whose code is fetched when it is first opened (LazyScene): fetch is an import() of the module that makes it, and what it gives must have the same id. What the scene fetched names (its way out, its buttons) is said here (names), so the app checks it is there as it starts, before anything is fetched lazyScene('dev', 'Dev sandbox', () = import('./dev').then((module) = module.devScene), names: [home] ) |
| LoadingMeter beta | The bar of a loading screen and its count of files: nothing until there is something to count |
| LoadingPicture beta | The picture a loading screen says (LoadingLook.picture), none when it says none |
| LoadingScreen beta | The client's loading screen: a picture where the game says one, what is being prepared, and a bar of its files once there are any to count. Children go between the words and the bar. A game composes its own from the three pieces below (LoadingPicture, LoadingText, LoadingMeter), or wraps this one |
| LoadingText beta | The words of a loading screen: the look's text, or "Preparing" with the game's name |
| LobbyScreen beta | The client's lobby of a game on a server: the server and its game, the name one goes by, the seats with their teams and who is in each (a free one to sit in), the game's settings, and ready, start now, leave. A game puts its own in its place (onlineScene({ lobby })), on the same controller |
| mapPlayScene beta | A scene that plays a map of a game made in its editor, as the editor's Play button does: the world made from the map with the game's rules, what the game starts on it, and the game's view. Any game has one with this: what it needs of a map is its own to say (MapEditorDef.check), not a town hall |
| MenuScreen beta | The client's menu: a title, what the game is and its facts where the scene says, over buttons, each going where it says. It comes in as it moves (UX1): the title faded in, the buttons one after another (Stagger), and all of it slides off as the menu goes (classes.motion.leaves); the app's sounds as it opens, and as a button is pointed at and pressed |
| missingScenes beta | Every scene an app's scenes name that is not one of them, said where it is named: the list's lines, what each scene names (Scene.names: a game's way out, a menu's buttons, what a scene fetched as it opens was said to name as it was made, before it is fetched), and the scene the app starts with. Empty where every one is there (U2) |
| onlineScene beta | A scene of a game on a server: its lobby, seen while it waits for the players (lobby, the client's LobbyScreen or the game's own, on a LobbyController), then the game. A dropped connection is tried again, back in the same seat, and the HUD says so (client.connection, the part connection). The server's address is url (OnlineArgs), or ?server= in the page's address, or the scene's url, or port 8787 of the machine the page came from; name the name to join by (the one kept otherwise), and ticket (or ?ticket=) what the server's seat lets players in by |
| OutcomeScreen beta | The client's screen at the end of a game: Victory or Defeat, what the game says under it, the game's buttons, the score (where the game counts one, GameView.hud.score.atEnd) and the client's (retry from the last checkpoint, play again, keep watching, which puts it away). It moves (UX1): it comes in, its buttons one after another, and slides off as it is put away; the game's sounds as it opens and its buttons are pressed (GameView.hud.sounds) |
| playCinematicScene beta | What a cinematic scene does with its client once it is made: the HUD hidden for good, the cinematic played held, and the scene's then once it is over (not when the scene was left before: the client is gone then). Gives the playing |
| playScene beta | Plays a game scene in an element, as the app shows one: run (runGame) and drawn with its HUD, its client made by the scene's load. What a game scene's open is (asGameScene); the code that plays it is fetched with the first game opened. The scene before is held until the game is on, or could not be; a scene with a loading screen of its own (GameScene.loading) comes in at once and shows it. options: told once the game is on (onLoaded) or that it could not be, or stopped (onFailed), the loading screen to show in place of the scene's (loading: a menu's behind shows none), whether the music playing goes on with the game starting none (keepsMusic: behind a menu with music of its own), and that it plays behind a menu (behind), so that the games kept behind menus are not taken away for it |
| profileScene beta | A scene of a player's profile of a game (campaign plan SH3): what they played (games, wins, time) and its achievements, those earned with when, the rest still to earn profileScene( game, back: scene: home ) |
| ProfileScreen beta | The client's screen of a player's profile: what they played, and the achievements |
| randomMapScene beta | A scene of a random map (world plan G3): the game's generator in its form (GeneratorForm: the size, players, symmetry, seed and its parameters, with a preview of the map it makes), and Play, which opens the game's scene (play) with the options (SceneArgs.generated): the game scene makes the same map of them, as a seed always does. What a start menu's Random map goes to randomMapScene( game, play, back: scene: home ) |
| RandomMapScreen beta | The client's screen of a random map: a title, the generator's form, Play and the way back |
| ReplayBar beta | The client's bar over a replay: hold and go on, how fast, and where in it, on a slider to go to any moment |
| replayScene beta | A scene that plays a replay back: kept in this browser (id), or opened from a file (replay), from at (ReplayArgs). bar is the bar over it as the game draws it: a component or an element, given what plays the replay (ReplayPlayback). The client's (ReplayBar) when left out |
| replaysScene beta | A scene of the replays this browser kept, newest first: to watch, keep as a file or throw away; and one opened from a file. component or mount is the screen as the game draws it, given the replays (ReplaysController) and the way out. The client's (ReplaysScreen) when left out. play is the scene that plays one (replay) |
| ReplaysScreen beta | The client's screen of the replays this browser kept, newest first: to watch, keep as a file or throw away; and one opened from a file |
| SavesWindow beta | Saving the game being played, and loading one saved before: a button on the HUD that opens a list of this scene's saves, the quick save and the autosaves first, then newest first, with the time in the game each was saved at. One the game no longer loads (saved by a newer version of it, or by one it has no way from: Rules.saves) is in the list all the same, with why. The view of the saves of where the game is played (client.saves, a SavesController) |
| sceneKind beta | What a scene is (SceneKind): as it says (Scene.kind), else told from it. One fetched as it opens that says nothing is a screen |
| sceneLoaded beta | The scene itself: a lazy one fetched (once, kept for the next time), any other as it is. A fetch that fails is tried again the next time it is asked for |
| serverScene beta | A seat at a game of one server (npm run server, startServer): the scene joins it as it opens, and the game starts once the seats are taken, the computer playing the rest. For a server of many games, findGameScene and onlineScene |
| settingsScene beta | A scene of the settings, before any game runs: the client's and the game's own (GameView.hud.settings), kept where a game reads them as it starts (StoredSettings). What a start menu's Settings goes to settingsScene( game, back: scene: home ) |
| SettingsScreen beta | The client's screen of the settings with no game running: a title, the settings, and the way back |
| sharePanel beta | A panel that shows whether the game is shared for watching (GameShare), how many watch, and starts or stops it: the client's (SharePanel), or the game's own in its place (own: a component or an element, given the sharing) |
| SharePanel beta | The client's panel of a game shared for watching: whether it is, how many watch, and what starts or stops it |
| watchReplay beta | A replay played back where the caller says, as a watcher saw it, with the bar that plays it over it (hold, faster, slower, on to any moment): the client of it, made of the game it is of (game: its rules and its view), from at. What replayScene shows, and what the editor opens a replay of a map in, in the place of the scene. bar as replayScene's. The client is the caller's: what plays the replay goes with it |
| watchScene beta | Watches a game shared under key from another page: everything in sight, from the side of whoever plays it, their lines and cinematics too; nothing to command. It waits for the game to be shared, and when it ends (a mission over), for the next one. waiting is the screen while it waits as the game draws it: a component or an element, given what is watched and what is waited for (WatchingController). The client's (WatchWaiting) when left out |
| WatchWaiting beta | The client's screen while a game watched from another page has not come |
Types
| Name | What |
|---|---|
| CinematicSceneThen beta | Where a cinematic scene goes once its cinematic is over: a scene (with what it is opened with), or code that decides, told how the cinematic ended (ended, skipped, stopped) and given the way to other scenes |
| FullscreenHost beta | A full screen that is not the page's, from a shell around it (StartAppOptions.fullscreenHost): given on, it goes in or out; either way it says whether it is in. In a web view that has no lock of its keys, the page's own full screen leaves on Esc and the system's bars are at its edges: a shell does better with its window |
| MissionCode beta | A mission as a campaign's code gives it beside its file (CampaignFromFile.missions): by its id, what data cannot say (start, carry, unlock, next, player, heroesAt, a debrief's rating), and anything else of MissionDef, which the file's mission of that id says over |
| SceneArgs beta | What a scene is opened with: what any scene may be (SharedSceneArgs), and its own (A: { mission: string }) |
| SceneKind beta | What a scene is: a menu of buttons, a game played, the map editor, or any other screen |
| SceneTransition beta | How a scene comes in over the one before, once it is ready: fade (the default: --animate-scene-in, as long as --vg-motion says), slide (in from the side as it fades: --animate-scene-slide, what the scene before has of classes.motion.leaves sliding off under it), cut, or a component of the game's own (SceneTransitionProps). Where the player or the system asks for no motion, every one of them is a cut |
| SharedSceneArgs beta | What any scene may be opened with (SceneArgs): a map, mods, a save to go on from, a map to generate, the map being edited. What is a scene's own (a mission, a replay, a server's address) is its args' type (SceneRef<A>) |