Log inGet started
World

Science-Based 100% Dragon MMO

Branchmain
Branchesmain
Commit4c69d78227

README.md

DragonHUD

Every screen the game has, in one component: the flight HUD, the menus, and the Codex. Put it on a scene entity — one instance owns all of them.

What it draws

The component reads dragon.game and renders whichever screen Game.screen names. It simulates nothing and caches no dragon: each frame the active screen is rebuilt from whatever the singleton currently holds, so the HUD cannot drift from the animal.

Game.screenScreen
playingthe flight HUD
maintitle, New Lineage / Continue / Settings / Codex / Gallery, controls
lineagename the lineage, and what generation 1 starts as
settingsvolumes, subtitles, flight assist, colourblind mode
codexone entry per system: the real equation and your dragon's live value
gallerythe roster — where it lives, what it does, what beats it
pauseresume / settings / codex / gallery / main menu, plus the controls
deathcause, what the generation built, respawn as your own hatchling

Each screen is registered separately and only the one Game.screen names is visible. The HUD rebuilds every frame because it is live data; a menu rebuilds only when something on it changed.

The Codex

Thirteen entries: Kleiber's BMR, lift, wing loading, stall speed, the Pennycuick power curve, the square-cube law, insulation and vasomotor tone, evaporative cooling, the methanogen bioreactor, catalytic ignition, jet-flame length, the hoard as a heat sink, and the clock.

Every constant printed there is read out of dragon.sim at build time and every live value is computed with the function the simulation itself calls, so the Codex cannot say one thing while the animal does another. Entry 13 states what is real (the equations) and what is not (the clock: metabolic and thermal processes run at Sim.TIME_SCALE real time so a session is playable).

Accessibility

No instrument depends on hue alone. Every bar prints its number and a status word, every band is bracketed and named, and the reserve pulses as well as reddens. Game.settings.colorblind picks which colour axis carries the redundant channel — off, deuteranopia / protanopia (good→bad runs blue→orange), tritanopia (green→red). Game.settings.flightAssist and subtitles are on the same screen and labelled.

Everything is sized against ui.screenSize() scaled by Game.settings.uiScale, so the layout holds at any canvas size.

Public fields

  • hudLayer (number, default 40) — draw order against other UI in the scene.

Callbacks

Every onClick id is handled in the component's top-level onCallback. Ids are namespaced drg: — drg:nav:<screen>, drg:begin, drg:continue, drg:respawn, drg:back, drg:name:edit, drg:vol:<bus>, drg:set:<flag>, drg:cb:<mode>, drg:grow:<channel>, drg:codex:<n>.

drg:grow:<channel> spends 25% of growthPoints through State.spendGrowth(Game.dragon, channel, amount).