GameView
Interface of @v12-engine/client
export interface GameView<U extends string = string, R extends string = string, M extends string = string>How a game looks and sounds, grouped by what is drawn (units, ground, world, fx, pings, HUD); the client side of a game module
Members
achievements
achievements?: readonly AchievementDef[];What a player can earn in the game (defineAchievements, campaign plan SH3): checked on their screen as an objective changes and as the game ends, kept in their profile in this browser (browserProfile), told over the game as each is earned
cinematics
cinematics?: ViewCinematics;The cinematics: the game's by id, its own lanes, transitions and eases, the screen's frame, who speaks and how, the dialog and its choices (ViewCinematics)
feel beta
feel?: FeelLook | false;How hits feel on the screen (FeelLook): the struck flashes and flinches, the attacker and the struck pause a few frames on a critical strike or a kill, a streak behind a melee swing, a shake and a sound for what is big. On by default, each piece with its own values or off (false all of it), and a hook for the game's own (on). View only
files
files?: ViewFiles;The game's files: its folder, the categories of its assets, what is kept between visits and what loads late (ViewFiles)
framePhases
framePhases?: GameFramePhase[];Phases of the frame of the game's own (GameFramePhase), among the client's (CLIENT_PHASES): a pass over the picture after render (banners of its own, a minimap of its own), something moved before the camera does. Each is run every frame with the frame (dt, alpha) and the client; one that throws is skipped from then on, as the rest of the view that runs in the frame. client.frame.add is the same, in code
fx
fx?: ViewFx;The effects: the game's own by id and in code, what they may cost, how much of them is drawn, the abilities' looks, the marks on the ground (ViewFx)
ground
ground?: ViewGround;The ground: its tiles, patterns, cliffs, colours, borders and layers, and the scenery on it (ViewGround)
hud
hud?: ViewHud<R, M>;The HUD: its parts, theme, layout and command card, the icons, resources, status and messages, the selection's stats, the minimap, the score, the end, the menu and the settings (ViewHud)
input
input?: ViewInput;The player's hands: the keys, the selection, what a press, a key and a right click do, the commands before they go, the cursor, putting a building down (ViewInput)
languages
languages?: Languages;The languages the game is played in (campaign plan LO1), by id, the first the one it is written in: a table of words each (MessagesFile), or what fetches one as it is chosen (() => import('./he.json')). The setting language chooses one, the browser's where the game has it; a key, a message or a name is said in it, in the first where it has none, as the view and the client have it where neither has. In code: client.words
on
on?: ViewListeners;How the view reacts to the game's own events that come to the screen (see defineEvent and its replicate): listeners in code (viewListener(event, run): a sound, the camera, a panel), or by event id, declared ( 'mine.exploded': fx: 'explosion', sound: 'boom' , EventLook: an effect where the event says, a sound, a shake) or in code. Renderers get them too, in changes.events (see isGameEvent). boundsChanged by that id hears what the view is held in changing (BoundsChanged); client.on hears any of them from code
onHidden
onHidden?: (hidden: boolean, client: GameClientApi) => void;Told each time the page goes out of sight (its tab behind another) and back: a game played in the page holds meanwhile, one on a server goes on. In code: client.onHidden
packs
packs?: ViewPack[];What the view opts into, as its rules do (Rules.packs): the heroes' (heroesViewPack(), the hero's panel, the heroes' portraits, the shop) or a game's own (ViewPack). A game without one computes and draws none of it
pings
pings?: ViewPings;The pings: the kinds a player puts on the map, the wheel they are picked from, the colours of order marks (ViewPings)
races
races?: Record<string, RaceLook>;How each race of the game looks to the player who plays it (RaceLook, campaign plan RC5), by race id: the HUD's theme, the music, an icon, words of its own. The client puts on the look of the race of the player it draws for, as the session says it, and again when it changes (a random race settled)
renderers
renderers?: RendererFactory[];Renderers of the game's own: something it draws that the client does not, like the road of a tower defense lit up, or a marker over the unit that holds a flag. Each is made once, from the client's render kit, and is told every snapshot (sync) and drawn every frame (frame), after the client's own
replace
replace?: Partial<Record<CoreRenderer, RendererFactory | null>>;The client's own renderers, by name, in the place of which the game draws its own, or nothing (null): units and buildings (units), trees, mines and what stands still (statics), the rings under what is selected (rings), the marks on the ground (marks), shots (projectiles), items on the ground (groundItems), blood (blood), damaged looks and hit reactions (damage), what burns (burning). One in the place of the first four provides its service (kit.provide(UNITS, …), STATICS, RINGS, MARKS), which the client and the others ask; one taken away leaves them unasked, and what the game asks of it (kit.model, kit.ring) says nothing provides it. One that replaces groundItems sets metadata.itemId on what it draws, for the pointer to pick the item up
sounds
sounds?: SoundSet;What things sound like, and how each sound is played (SoundSet, its defs). Silent without
tracks
tracks?: TracksFile;Deprecated
A track is a cinematic of three lanes: put each in cinematics as data (readCinematic, cinematicsFrom), played by cut.play(id) or on its own
The game's cinematic tracks by name, made on the editor's timeline (its tracks.json): played in a cinematic by cut.track('name')
units
units: ViewUnits<U>;The units: their looks (looks), the HUD over them, their ring, outline, ink, blood, deaths and building, the models' materials (ViewUnits)
world
world?: ViewWorld;The world as it is drawn: its camera, light, glow, shadows, fog of war, sky, weather and environments, what is drawn at a distance, the picture, the quality and its limits (ViewWorld)