The game screen is where the story happens. It holds the scene (backgrounds, characters, images, particles) and the interface around it: the Text Box, the Quick Menu and the Dialog Log. A click or tap anywhere on it moves the story to the next statement.

The game screen: the Palacio de Bellas Artes in the afternoon with Yui standing in the middle, her line in the text box at the bottom and the quick menu below it
The game screen during the story

Tag <game-screen>
Where it lives In index.html, inside <visual-novel> (the starter game has it)
Built on ScreenComponent
Screen name game
Source src/components/game-screen/

Where it lives

<game-screen>
  <dialog-log></dialog-log>
  <text-box></text-box>
  <quick-menu></quick-menu>
</game-screen>

It opens when the player starts or loads a game, or right after loading when the ShowMainScreen setting is false. While it’s open, any other screen (save, load, settings) replaces it until the player presses that screen’s back button.

How the player moves the story forward

  • A click or tap anywhere on the game screen runs the next statement. Clicks on buttons and links that have a data-action (the quick menu, a message’s Close), on choices, and on a save slot’s delete button don’t count.
  • The → key or the space bar do the same.
  • The ← key goes back one step, while the AllowRollback setting is true (the starter game’s value).

The engine asks every action and component first, and any of them can refuse: a line still being typed finishes typing instead (at once, with the starter game’s InstantText setting), and choices, text inputs and messages wait for the player’s answer. Nothing moves forward while another screen is open.

Markup

The screen draws one element of its own, the visuals, before the elements you wrote inside it:

<game-screen data-screen="game" class="animated active" data-label="Start">
  <div data-content="visuals">
    <div id="tsparticles" data-ui="particles"></div>
    <div id="background" data-ui="background" class="animated" style="background-image: url('assets/scenes/afternoon.jpg')"></div>
    <img src="assets/characters/yui/happy.png" class="animated center fadeIn focus" data-character="y" data-sprite="happy" data-position="center" alt="Yui, happy">
  </div>
  <dialog-log>…</dialog-log>
  <text-box>…</text-box>
  <quick-menu>…</quick-menu>
</game-screen>

The script actions fill it while the game runs:

Hook What it is
[data-content="visuals"] The scene: everything the actions show.
[data-ui="background"] The background of show scene and show background, as a CSS background. A background video goes inside it.
[data-ui="particles"] Where show particles draws.
[data-character="…"] A character’s sprite (an <img>, or a Character Sprite), with its data-sprite and data-position.
.focus On the sprite of the character who’s speaking.
[data-image="…"] An image from show image.
[data-video] A video from show video, with data-mode.
[data-label] On the screen: the label the game is in. Useful to style a chapter differently.
.splash-screen On the screen while the splash screen label plays.

Choices, text inputs, messages, timers and centered lines are added directly inside <game-screen> (see their pages).

Properties and attributes

Name Type Default What it does
open (state) boolean false Whether the screen is shown.
data-label attribute The first label The label the game is in, updated whenever it changes.

Events

None of its own. The screen listens to the engine’s didUpdateState event to keep data-label up to date.

Style it

The game screen has a black background, hides whatever overflows it, and doesn’t let the player select text. Its stylesheet places the visuals:

  • Characters stand on the bottom edge, at most 80vh tall. The position words of show character are classes: center (the default), left and right.
  • with move on a show character statement makes the sprite slide to its new position instead of jumping, with --character-move-speed (0.2s) and --character-move-easing (ease).
  • Images from show image are centered, and the classes top, bottom, left and right push them to an edge.
/* style/main.css */
:root {
  --character-move-speed: 0.6s;
}

game-screen [data-character] {
  max-height: 90vh;
}

game-screen[data-label="Epilogue"] [data-ui="background"] {
  filter: grayscale(1);
}

The last rule turns every background gray while the game is in a label named Epilogue.

Replace or extend it

The engine finds the game screen by [data-screen="game"] and puts the scene in its [data-content="visuals"] element, so a replacement must keep both. To add something that stays on the game screen for the whole game (a clock, a status bar), write it inside <game-screen> in index.html, give it a data-action or handle its clicks yourself, and position it in style/main.css. A click on an element without data-action moves the story forward.