@origingame/create-game 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -2
- package/archetypes/README.md +99 -0
- package/archetypes/idle/.origin/setup +14 -0
- package/archetypes/idle/LICENSES.md +12 -0
- package/archetypes/idle/README.md +234 -0
- package/archetypes/idle/assets/audio/buy.wav +0 -0
- package/archetypes/idle/assets/audio/milestone.wav +0 -0
- package/archetypes/idle/assets/audio/nova.wav +0 -0
- package/archetypes/idle/assets/audio/orbit.wav +0 -0
- package/archetypes/idle/assets/audio/tap.wav +0 -0
- package/archetypes/idle/assets/audio/ui-close.ogt +9 -0
- package/archetypes/idle/assets/audio/ui-error.ogt +9 -0
- package/archetypes/idle/assets/audio/ui-open.ogt +9 -0
- package/archetypes/idle/assets/audio/ui-press.ogt +9 -0
- package/archetypes/idle/assets/audio/ui-success.ogt +9 -0
- package/archetypes/idle/assets/fonts/NotoSansSC-subset.ttf +0 -0
- package/archetypes/idle/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
- package/archetypes/idle/assets/fonts/OFL.txt +93 -0
- package/archetypes/idle/assets/fx/drift.ogt +21 -0
- package/archetypes/idle/assets/fx/milestone.ogt +21 -0
- package/archetypes/idle/assets/fx/nova.ogt +22 -0
- package/archetypes/idle/assets/fx/stars.ogt +20 -0
- package/archetypes/idle/assets/fx/tap.ogt +23 -0
- package/archetypes/idle/assets/looks/idle.ogt +17 -0
- package/archetypes/idle/assets/skins/sparkorb/ChakraPetch-BoldItalic.ttf +0 -0
- package/archetypes/idle/assets/skins/sparkorb/ChakraPetch-BoldItalic.ttf.ogt +9 -0
- package/archetypes/idle/assets/skins/sparkorb/LICENSES.md +19 -0
- package/archetypes/idle/assets/skins/sparkorb/OFL.txt +95 -0
- package/archetypes/idle/assets/skins/sparkorb/Orbitron-Medium.ttf +0 -0
- package/archetypes/idle/assets/skins/sparkorb/Orbitron-Medium.ttf.ogt +9 -0
- package/archetypes/idle/assets/skins/sparkorb/Rajdhani-Bold.ttf +0 -0
- package/archetypes/idle/assets/skins/sparkorb/Rajdhani-Bold.ttf.ogt +9 -0
- package/archetypes/idle/assets/skins/sparkorb/atlas.png +0 -0
- package/archetypes/idle/assets/skins/sparkorb/atlas.png.ogt +7 -0
- package/archetypes/idle/assets/skins/sparkorb/icons.png +0 -0
- package/archetypes/idle/assets/skins/sparkorb/icons.png.ogt +7 -0
- package/archetypes/idle/assets/skins/sparkorb/skin.ogt +113 -0
- package/archetypes/idle/assets/sprites/glow.png +0 -0
- package/archetypes/idle/assets/sprites/glow.png.ogt +8 -0
- package/archetypes/idle/assets/sprites/mote-crystal.png +0 -0
- package/archetypes/idle/assets/sprites/mote-crystal.png.ogt +7 -0
- package/archetypes/idle/assets/sprites/mote-ember.png +0 -0
- package/archetypes/idle/assets/sprites/mote-ember.png.ogt +7 -0
- package/archetypes/idle/assets/sprites/mote-star.png +0 -0
- package/archetypes/idle/assets/sprites/mote-star.png.ogt +7 -0
- package/archetypes/idle/assets/sprites/mote-storm.png +0 -0
- package/archetypes/idle/assets/sprites/mote-storm.png.ogt +7 -0
- package/archetypes/idle/assets/sprites/orb.png +0 -0
- package/archetypes/idle/assets/sprites/orb.png.ogt +7 -0
- package/archetypes/idle/assets/sprites/spark.png +0 -0
- package/archetypes/idle/assets/sprites/spark.png.ogt +7 -0
- package/archetypes/idle/assets/strings/en.ogt +62 -0
- package/archetypes/idle/assets/strings/zh-CN.ogt +62 -0
- package/archetypes/idle/gitattributes +22 -0
- package/archetypes/idle/host.d.ts +46 -0
- package/archetypes/idle/package.json +18 -0
- package/archetypes/idle/project.ogt +14 -0
- package/archetypes/idle/references/metal/card.png +0 -0
- package/archetypes/idle/references/metal/orbit.png +0 -0
- package/archetypes/idle/references/metal/title.png +0 -0
- package/archetypes/idle/src/components.ts +139 -0
- package/archetypes/idle/src/main.ts +247 -0
- package/archetypes/idle/src/numbers.ts +126 -0
- package/archetypes/idle/src/systems.ts +340 -0
- package/archetypes/idle/src/ui.ts +412 -0
- package/archetypes/idle/tests/away.og.ts +42 -0
- package/archetypes/idle/tests/flow.og.ts +57 -0
- package/archetypes/idle/tests/frames.og.ts +33 -0
- package/archetypes/idle/tests/frames.ts +134 -0
- package/archetypes/idle/tests/lib.ts +74 -0
- package/archetypes/idle/tests/milestone.og.ts +32 -0
- package/archetypes/idle/tests/nova.og.ts +52 -0
- package/archetypes/idle/tests/offline.og.ts +60 -0
- package/archetypes/idle/tests/pad.og.ts +55 -0
- package/archetypes/idle/tests/pause.og.ts +68 -0
- package/archetypes/idle/tests/phone.og.ts +50 -0
- package/archetypes/idle/tests/replay.og.ts +28 -0
- package/archetypes/idle/tools/make-assets.py +448 -0
- package/archetypes/idle/tools/oglite.py +285 -0
- package/archetypes/idle/tsconfig.json +17 -0
- package/archetypes/match3/.origin/setup +14 -0
- package/archetypes/match3/LICENSES.md +7 -0
- package/archetypes/match3/README.md +205 -0
- package/archetypes/match3/assets/audio/cascade.wav +0 -0
- package/archetypes/match3/assets/audio/clear.wav +0 -0
- package/archetypes/match3/assets/audio/lost.wav +0 -0
- package/archetypes/match3/assets/audio/refused.wav +0 -0
- package/archetypes/match3/assets/audio/select.wav +0 -0
- package/archetypes/match3/assets/audio/swap.wav +0 -0
- package/archetypes/match3/assets/audio/won.wav +0 -0
- package/archetypes/match3/assets/fonts/OFL.txt +93 -0
- package/archetypes/match3/assets/fonts/ui.ttf +0 -0
- package/archetypes/match3/assets/fonts/ui.ttf.ogt +11 -0
- package/archetypes/match3/assets/scenes/main.ogt +24 -0
- package/archetypes/match3/assets/sprites/backdrop.png +0 -0
- package/archetypes/match3/assets/sprites/board.ogt +21 -0
- package/archetypes/match3/assets/sprites/cells.ogt +7 -0
- package/archetypes/match3/assets/sprites/cells.png +0 -0
- package/archetypes/match3/assets/sprites/cells.png.ogt +7 -0
- package/archetypes/match3/assets/sprites/gems.ogt +75 -0
- package/archetypes/match3/assets/sprites/gems.png +0 -0
- package/archetypes/match3/assets/sprites/panel.png +0 -0
- package/archetypes/match3/assets/sprites/ring.png +0 -0
- package/archetypes/match3/gitattributes +22 -0
- package/archetypes/match3/host.d.ts +46 -0
- package/archetypes/match3/package.json +18 -0
- package/archetypes/match3/project.ogt +18 -0
- package/archetypes/match3/references/metal/cascade.png +0 -0
- package/archetypes/match3/references/metal/clearing.png +0 -0
- package/archetypes/match3/references/metal/dealt.png +0 -0
- package/archetypes/match3/src/art.ts +54 -0
- package/archetypes/match3/src/board.ts +112 -0
- package/archetypes/match3/src/components.ts +95 -0
- package/archetypes/match3/src/layout.ts +25 -0
- package/archetypes/match3/src/main.ts +199 -0
- package/archetypes/match3/src/systems.ts +631 -0
- package/archetypes/match3/tests/drag.og.ts +31 -0
- package/archetypes/match3/tests/endings.og.ts +40 -0
- package/archetypes/match3/tests/frames.og.ts +49 -0
- package/archetypes/match3/tests/frames.ts +134 -0
- package/archetypes/match3/tests/hidpi.og.ts +41 -0
- package/archetypes/match3/tests/lib.ts +64 -0
- package/archetypes/match3/tests/replay.og.ts +28 -0
- package/archetypes/match3/tests/sounds.og.ts +50 -0
- package/archetypes/match3/tests/swap.og.ts +67 -0
- package/archetypes/match3/tools/make-assets.py +404 -0
- package/archetypes/match3/tools/oglite.py +285 -0
- package/archetypes/match3/tsconfig.json +17 -0
- package/archetypes/rhythm/.origin/setup +14 -0
- package/archetypes/rhythm/LICENSES.md +13 -0
- package/archetypes/rhythm/README.md +235 -0
- package/archetypes/rhythm/assets/audio/bass0.wav +0 -0
- package/archetypes/rhythm/assets/audio/bass1.wav +0 -0
- package/archetypes/rhythm/assets/audio/bass2.wav +0 -0
- package/archetypes/rhythm/assets/audio/bass3.wav +0 -0
- package/archetypes/rhythm/assets/audio/chords0.wav +0 -0
- package/archetypes/rhythm/assets/audio/chords1.wav +0 -0
- package/archetypes/rhythm/assets/audio/chords2.wav +0 -0
- package/archetypes/rhythm/assets/audio/chords3.wav +0 -0
- package/archetypes/rhythm/assets/audio/clear.wav +0 -0
- package/archetypes/rhythm/assets/audio/click.wav +0 -0
- package/archetypes/rhythm/assets/audio/drums.wav +0 -0
- package/archetypes/rhythm/assets/audio/fail.wav +0 -0
- package/archetypes/rhythm/assets/audio/leadA.wav +0 -0
- package/archetypes/rhythm/assets/audio/leadB.wav +0 -0
- package/archetypes/rhythm/assets/audio/miss.wav +0 -0
- package/archetypes/rhythm/assets/audio/tap0.wav +0 -0
- package/archetypes/rhythm/assets/audio/tap1.wav +0 -0
- package/archetypes/rhythm/assets/audio/tap2.wav +0 -0
- package/archetypes/rhythm/assets/audio/ui-close.ogt +9 -0
- package/archetypes/rhythm/assets/audio/ui-error.ogt +9 -0
- package/archetypes/rhythm/assets/audio/ui-open.ogt +9 -0
- package/archetypes/rhythm/assets/audio/ui-press.ogt +9 -0
- package/archetypes/rhythm/assets/audio/ui-success.ogt +9 -0
- package/archetypes/rhythm/assets/charts/neon-pulse.ogt +919 -0
- package/archetypes/rhythm/assets/fonts/NotoSansSC-subset.ttf +0 -0
- package/archetypes/rhythm/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
- package/archetypes/rhythm/assets/fonts/OFL.txt +93 -0
- package/archetypes/rhythm/assets/fx/hit.ogt +22 -0
- package/archetypes/rhythm/assets/skins/lanebeat/ChakraPetch-Medium.ttf +0 -0
- package/archetypes/rhythm/assets/skins/lanebeat/ChakraPetch-Medium.ttf.ogt +9 -0
- package/archetypes/rhythm/assets/skins/lanebeat/JetBrainsMono-Regular.ttf +0 -0
- package/archetypes/rhythm/assets/skins/lanebeat/JetBrainsMono-Regular.ttf.ogt +9 -0
- package/archetypes/rhythm/assets/skins/lanebeat/LICENSES.md +17 -0
- package/archetypes/rhythm/assets/skins/lanebeat/OFL.txt +95 -0
- package/archetypes/rhythm/assets/skins/lanebeat/Orbitron-Bold.ttf +0 -0
- package/archetypes/rhythm/assets/skins/lanebeat/Orbitron-Bold.ttf.ogt +9 -0
- package/archetypes/rhythm/assets/skins/lanebeat/atlas.png +0 -0
- package/archetypes/rhythm/assets/skins/lanebeat/atlas.png.ogt +7 -0
- package/archetypes/rhythm/assets/skins/lanebeat/icons.png +0 -0
- package/archetypes/rhythm/assets/skins/lanebeat/icons.png.ogt +7 -0
- package/archetypes/rhythm/assets/skins/lanebeat/skin.ogt +110 -0
- package/archetypes/rhythm/assets/sprites/lane.png +0 -0
- package/archetypes/rhythm/assets/sprites/lane.png.ogt +7 -0
- package/archetypes/rhythm/assets/sprites/note.png +0 -0
- package/archetypes/rhythm/assets/sprites/note.png.ogt +7 -0
- package/archetypes/rhythm/assets/sprites/ring.png +0 -0
- package/archetypes/rhythm/assets/sprites/ring.png.ogt +7 -0
- package/archetypes/rhythm/assets/sprites/spark.png +0 -0
- package/archetypes/rhythm/assets/sprites/spark.png.ogt +7 -0
- package/archetypes/rhythm/assets/strings/en.ogt +61 -0
- package/archetypes/rhythm/assets/strings/zh-CN.ogt +61 -0
- package/archetypes/rhythm/gitattributes +22 -0
- package/archetypes/rhythm/host.d.ts +46 -0
- package/archetypes/rhythm/package.json +18 -0
- package/archetypes/rhythm/project.ogt +14 -0
- package/archetypes/rhythm/references/metal/highway.png +0 -0
- package/archetypes/rhythm/references/metal/results.png +0 -0
- package/archetypes/rhythm/references/metal/title.png +0 -0
- package/archetypes/rhythm/src/components.ts +147 -0
- package/archetypes/rhythm/src/main.ts +202 -0
- package/archetypes/rhythm/src/systems.ts +490 -0
- package/archetypes/rhythm/src/ui.ts +421 -0
- package/archetypes/rhythm/tests/band.og.ts +45 -0
- package/archetypes/rhythm/tests/calibrate.og.ts +49 -0
- package/archetypes/rhythm/tests/clear.og.ts +51 -0
- package/archetypes/rhythm/tests/fail.og.ts +40 -0
- package/archetypes/rhythm/tests/flow.og.ts +54 -0
- package/archetypes/rhythm/tests/frames.og.ts +35 -0
- package/archetypes/rhythm/tests/frames.ts +134 -0
- package/archetypes/rhythm/tests/lib.ts +123 -0
- package/archetypes/rhythm/tests/pad.og.ts +41 -0
- package/archetypes/rhythm/tests/pause.og.ts +77 -0
- package/archetypes/rhythm/tests/phone.og.ts +44 -0
- package/archetypes/rhythm/tests/replay.og.ts +27 -0
- package/archetypes/rhythm/tests/timing.og.ts +37 -0
- package/archetypes/rhythm/tools/make-assets.py +383 -0
- package/archetypes/rhythm/tools/oglite.py +285 -0
- package/archetypes/rhythm/tsconfig.json +17 -0
- package/archetypes/roguelike/.origin/setup +14 -0
- package/archetypes/roguelike/LICENSES.md +14 -0
- package/archetypes/roguelike/README.md +256 -0
- package/archetypes/roguelike/assets/ai/foe.ogt +28 -0
- package/archetypes/roguelike/assets/ai/guardian.ogt +26 -0
- package/archetypes/roguelike/assets/audio/bump.wav +0 -0
- package/archetypes/roguelike/assets/audio/drink.wav +0 -0
- package/archetypes/roguelike/assets/audio/fall.wav +0 -0
- package/archetypes/roguelike/assets/audio/hit.wav +0 -0
- package/archetypes/roguelike/assets/audio/hurt.wav +0 -0
- package/archetypes/roguelike/assets/audio/item.wav +0 -0
- package/archetypes/roguelike/assets/audio/kill.wav +0 -0
- package/archetypes/roguelike/assets/audio/pickup.wav +0 -0
- package/archetypes/roguelike/assets/audio/roar.wav +0 -0
- package/archetypes/roguelike/assets/audio/stairs.wav +0 -0
- package/archetypes/roguelike/assets/audio/step.ogt +9 -0
- package/archetypes/roguelike/assets/audio/telegraph.wav +0 -0
- package/archetypes/roguelike/assets/audio/tomb.wav +0 -0
- package/archetypes/roguelike/assets/audio/ui-close.ogt +9 -0
- package/archetypes/roguelike/assets/audio/ui-error.ogt +9 -0
- package/archetypes/roguelike/assets/audio/ui-open.ogt +9 -0
- package/archetypes/roguelike/assets/audio/ui-press.ogt +9 -0
- package/archetypes/roguelike/assets/audio/ui-success.ogt +9 -0
- package/archetypes/roguelike/assets/audio/won.wav +0 -0
- package/archetypes/roguelike/assets/fonts/NotoSansSC-subset.ttf +0 -0
- package/archetypes/roguelike/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
- package/archetypes/roguelike/assets/fonts/OFL.txt +93 -0
- package/archetypes/roguelike/assets/maps/dive.ogt +106 -0
- package/archetypes/roguelike/assets/skins/lampdive/DotGothic16-Regular.ttf +0 -0
- package/archetypes/roguelike/assets/skins/lampdive/DotGothic16-Regular.ttf.ogt +9 -0
- package/archetypes/roguelike/assets/skins/lampdive/LICENSES.md +16 -0
- package/archetypes/roguelike/assets/skins/lampdive/OFL.txt +93 -0
- package/archetypes/roguelike/assets/skins/lampdive/atlas.png +0 -0
- package/archetypes/roguelike/assets/skins/lampdive/atlas.png.ogt +7 -0
- package/archetypes/roguelike/assets/skins/lampdive/icons.png +0 -0
- package/archetypes/roguelike/assets/skins/lampdive/icons.png.ogt +7 -0
- package/archetypes/roguelike/assets/skins/lampdive/skin.ogt +115 -0
- package/archetypes/roguelike/assets/sprites/dive.ogt +50 -0
- package/archetypes/roguelike/assets/sprites/dive.png +0 -0
- package/archetypes/roguelike/assets/sprites/dive.png.ogt +7 -0
- package/archetypes/roguelike/assets/sprites/glow.png +0 -0
- package/archetypes/roguelike/assets/sprites/glow.png.ogt +7 -0
- package/archetypes/roguelike/assets/strings/en.ogt +57 -0
- package/archetypes/roguelike/assets/strings/zh-CN.ogt +57 -0
- package/archetypes/roguelike/assets/tiles/tomb.ogt +31 -0
- package/archetypes/roguelike/assets/tiles/tomb.png +0 -0
- package/archetypes/roguelike/assets/tiles/tomb.png.ogt +7 -0
- package/archetypes/roguelike/gitattributes +22 -0
- package/archetypes/roguelike/host.d.ts +46 -0
- package/archetypes/roguelike/package.json +18 -0
- package/archetypes/roguelike/project.ogt +14 -0
- package/archetypes/roguelike/references/metal/dive.png +0 -0
- package/archetypes/roguelike/references/metal/over.png +0 -0
- package/archetypes/roguelike/references/metal/title.png +0 -0
- package/archetypes/roguelike/src/art.ts +23 -0
- package/archetypes/roguelike/src/components.ts +169 -0
- package/archetypes/roguelike/src/dive.ts +144 -0
- package/archetypes/roguelike/src/foes.ts +174 -0
- package/archetypes/roguelike/src/main.ts +258 -0
- package/archetypes/roguelike/src/systems.ts +620 -0
- package/archetypes/roguelike/src/ui.ts +350 -0
- package/archetypes/roguelike/tests/flow.og.ts +54 -0
- package/archetypes/roguelike/tests/foes.og.ts +45 -0
- package/archetypes/roguelike/tests/frames.og.ts +32 -0
- package/archetypes/roguelike/tests/frames.ts +134 -0
- package/archetypes/roguelike/tests/lib.ts +83 -0
- package/archetypes/roguelike/tests/lose.og.ts +44 -0
- package/archetypes/roguelike/tests/pad.og.ts +54 -0
- package/archetypes/roguelike/tests/pause.og.ts +59 -0
- package/archetypes/roguelike/tests/phone.og.ts +54 -0
- package/archetypes/roguelike/tests/replay.og.ts +24 -0
- package/archetypes/roguelike/tests/win.og.ts +60 -0
- package/archetypes/roguelike/tools/make-assets.py +518 -0
- package/archetypes/roguelike/tools/oglite.py +285 -0
- package/archetypes/roguelike/tsconfig.json +17 -0
- package/archetypes/runner/.origin/setup +14 -0
- package/archetypes/runner/LICENSES.md +10 -0
- package/archetypes/runner/README.md +225 -0
- package/archetypes/runner/assets/audio/coin.wav +0 -0
- package/archetypes/runner/assets/audio/crash.wav +0 -0
- package/archetypes/runner/assets/audio/hold.ogt +9 -0
- package/archetypes/runner/assets/audio/jump.wav +0 -0
- package/archetypes/runner/assets/audio/start.wav +0 -0
- package/archetypes/runner/assets/fonts/OFL.txt +93 -0
- package/archetypes/runner/assets/fonts/ui.ttf +0 -0
- package/archetypes/runner/assets/fonts/ui.ttf.ogt +11 -0
- package/archetypes/runner/assets/maps/far.ogt +25 -0
- package/archetypes/runner/assets/maps/near.ogt +25 -0
- package/archetypes/runner/assets/maps/roofs.ogt +19 -0
- package/archetypes/runner/assets/scenes/main.ogt +35 -0
- package/archetypes/runner/assets/sprites/coin.ogt +11 -0
- package/archetypes/runner/assets/sprites/coin.png +0 -0
- package/archetypes/runner/assets/sprites/coin.png.ogt +7 -0
- package/archetypes/runner/assets/sprites/courier.ogt +32 -0
- package/archetypes/runner/assets/sprites/courier.png +0 -0
- package/archetypes/runner/assets/sprites/courier.png.ogt +7 -0
- package/archetypes/runner/assets/sprites/props.ogt +21 -0
- package/archetypes/runner/assets/sprites/props.png +0 -0
- package/archetypes/runner/assets/sprites/props.png.ogt +7 -0
- package/archetypes/runner/assets/sprites/sky.png +0 -0
- package/archetypes/runner/assets/sprites/sky.png.ogt +7 -0
- package/archetypes/runner/assets/tiles/city.ogt +18 -0
- package/archetypes/runner/assets/tiles/city.png +0 -0
- package/archetypes/runner/assets/tiles/city.png.ogt +7 -0
- package/archetypes/runner/gitattributes +22 -0
- package/archetypes/runner/host.d.ts +46 -0
- package/archetypes/runner/package.json +18 -0
- package/archetypes/runner/project.ogt +18 -0
- package/archetypes/runner/references/metal/frames-coin.png +0 -0
- package/archetypes/runner/references/metal/frames-crash.png +0 -0
- package/archetypes/runner/references/metal/frames-title.png +0 -0
- package/archetypes/runner/src/art.ts +57 -0
- package/archetypes/runner/src/components.ts +94 -0
- package/archetypes/runner/src/main.ts +241 -0
- package/archetypes/runner/src/systems.ts +553 -0
- package/archetypes/runner/tests/coins.og.ts +30 -0
- package/archetypes/runner/tests/flow.og.ts +72 -0
- package/archetypes/runner/tests/frames.og.ts +37 -0
- package/archetypes/runner/tests/frames.ts +134 -0
- package/archetypes/runner/tests/jump.og.ts +44 -0
- package/archetypes/runner/tests/lib.ts +42 -0
- package/archetypes/runner/tests/records.og.ts +43 -0
- package/archetypes/runner/tests/replay.og.ts +36 -0
- package/archetypes/runner/tests/sounds.og.ts +43 -0
- package/archetypes/runner/tests/tune.og.ts +36 -0
- package/archetypes/runner/tools/make-assets.py +603 -0
- package/archetypes/runner/tools/oglite.py +285 -0
- package/archetypes/runner/tsconfig.json +17 -0
- package/archetypes/third-person/.origin/setup +14 -0
- package/archetypes/third-person/LICENSES.md +23 -0
- package/archetypes/third-person/README.md +249 -0
- package/archetypes/third-person/assets/ai/sentinel-east.ogt +69 -0
- package/archetypes/third-person/assets/ai/sentinel-north.ogt +69 -0
- package/archetypes/third-person/assets/ai/sentinel-west.ogt +69 -0
- package/archetypes/third-person/assets/anims/humanoid-clips.glb +0 -0
- package/archetypes/third-person/assets/audio/alarm.wav +0 -0
- package/archetypes/third-person/assets/audio/dawn.wav +0 -0
- package/archetypes/third-person/assets/audio/grab.wav +0 -0
- package/archetypes/third-person/assets/audio/ignite.wav +0 -0
- package/archetypes/third-person/assets/audio/jump.wav +0 -0
- package/archetypes/third-person/assets/audio/night.wav +0 -0
- package/archetypes/third-person/assets/audio/splash.wav +0 -0
- package/archetypes/third-person/assets/audio/step.ogt +9 -0
- package/archetypes/third-person/assets/audio/ui-close.ogt +9 -0
- package/archetypes/third-person/assets/audio/ui-error.ogt +9 -0
- package/archetypes/third-person/assets/audio/ui-open.ogt +9 -0
- package/archetypes/third-person/assets/audio/ui-press.ogt +9 -0
- package/archetypes/third-person/assets/audio/ui-success.ogt +9 -0
- package/archetypes/third-person/assets/audio/vale.wav +0 -0
- package/archetypes/third-person/assets/fonts/NotoSansSC-subset.ttf +0 -0
- package/archetypes/third-person/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
- package/archetypes/third-person/assets/fonts/OFL.txt +93 -0
- package/archetypes/third-person/assets/fx/burst.ogt +25 -0
- package/archetypes/third-person/assets/fx/fire.ogt +24 -0
- package/archetypes/third-person/assets/fx/smoke.ogt +24 -0
- package/archetypes/third-person/assets/fx/splash.ogt +24 -0
- package/archetypes/third-person/assets/luts/teal-orange.cube +4917 -0
- package/archetypes/third-person/assets/models/stout.glb +0 -0
- package/archetypes/third-person/assets/models/strider.glb +0 -0
- package/archetypes/third-person/assets/models/strider.glb.ogt +9 -0
- package/archetypes/third-person/assets/nav/vale.ogt +43 -0
- package/archetypes/third-person/assets/rigs/strider.ogt +6 -0
- package/archetypes/third-person/assets/skins/ember/Cinzel-Bold.ttf +0 -0
- package/archetypes/third-person/assets/skins/ember/Cinzel-Bold.ttf.ogt +9 -0
- package/archetypes/third-person/assets/skins/ember/LICENSES.md +13 -0
- package/archetypes/third-person/assets/skins/ember/Newsreader-Medium.ttf +0 -0
- package/archetypes/third-person/assets/skins/ember/Newsreader-Medium.ttf.ogt +9 -0
- package/archetypes/third-person/assets/skins/ember/OFL.txt +94 -0
- package/archetypes/third-person/assets/skins/ember/atlas.png +0 -0
- package/archetypes/third-person/assets/skins/ember/atlas.png.ogt +7 -0
- package/archetypes/third-person/assets/skins/ember/icons.png +0 -0
- package/archetypes/third-person/assets/skins/ember/icons.png.ogt +7 -0
- package/archetypes/third-person/assets/skins/ember/skin.ogt +109 -0
- package/archetypes/third-person/assets/strings/en.ogt +47 -0
- package/archetypes/third-person/assets/strings/zh-CN.ogt +47 -0
- package/archetypes/third-person/assets/terrain/vale-control.png +0 -0
- package/archetypes/third-person/assets/terrain/vale.ogt +42 -0
- package/archetypes/third-person/assets/terrain/vale.png +0 -0
- package/archetypes/third-person/assets/textures/decals.png +0 -0
- package/archetypes/third-person/assets/textures/flame.png +0 -0
- package/archetypes/third-person/assets/textures/smoke.png +0 -0
- package/archetypes/third-person/assets/textures/spark.png +0 -0
- package/archetypes/third-person/assets/textures/terrain-grass.png +0 -0
- package/archetypes/third-person/assets/textures/terrain-path.png +0 -0
- package/archetypes/third-person/assets/textures/terrain-rock.png +0 -0
- package/archetypes/third-person/assets/textures/terrain-sand.png +0 -0
- package/archetypes/third-person/gitattributes +22 -0
- package/archetypes/third-person/host.d.ts +46 -0
- package/archetypes/third-person/package.json +18 -0
- package/archetypes/third-person/project.ogt +14 -0
- package/archetypes/third-person/references/metal/beacon.png +0 -0
- package/archetypes/third-person/references/metal/dawn.png +0 -0
- package/archetypes/third-person/references/metal/title.png +0 -0
- package/archetypes/third-person/references/webgl2/beacon.png +0 -0
- package/archetypes/third-person/src/anim.ts +87 -0
- package/archetypes/third-person/src/beacons.ts +80 -0
- package/archetypes/third-person/src/components.ts +148 -0
- package/archetypes/third-person/src/hero.ts +293 -0
- package/archetypes/third-person/src/main.ts +164 -0
- package/archetypes/third-person/src/sentinels.ts +159 -0
- package/archetypes/third-person/src/sound.ts +66 -0
- package/archetypes/third-person/src/ui.ts +451 -0
- package/archetypes/third-person/src/world.ts +212 -0
- package/archetypes/third-person/tests/flow.og.ts +70 -0
- package/archetypes/third-person/tests/frames.og.ts +35 -0
- package/archetypes/third-person/tests/frames.ts +134 -0
- package/archetypes/third-person/tests/hitstop.og.ts +26 -0
- package/archetypes/third-person/tests/lib.ts +87 -0
- package/archetypes/third-person/tests/lose.og.ts +44 -0
- package/archetypes/third-person/tests/pause.og.ts +64 -0
- package/archetypes/third-person/tests/phone.og.ts +65 -0
- package/archetypes/third-person/tests/replay.og.ts +32 -0
- package/archetypes/third-person/tests/restart.og.ts +28 -0
- package/archetypes/third-person/tests/sentinels.og.ts +48 -0
- package/archetypes/third-person/tests/win.og.ts +62 -0
- package/archetypes/third-person/tools/make-assets.py +353 -0
- package/archetypes/third-person/tools/oglite.py +285 -0
- package/archetypes/third-person/tsconfig.json +17 -0
- package/archetypes/topdown/.origin/setup +14 -0
- package/archetypes/topdown/LICENSES.md +10 -0
- package/archetypes/topdown/README.md +235 -0
- package/archetypes/topdown/assets/ai/slime.ogt +49 -0
- package/archetypes/topdown/assets/audio/coin.wav +0 -0
- package/archetypes/topdown/assets/audio/door.wav +0 -0
- package/archetypes/topdown/assets/audio/hit.wav +0 -0
- package/archetypes/topdown/assets/audio/hurt.wav +0 -0
- package/archetypes/topdown/assets/audio/key.wav +0 -0
- package/archetypes/topdown/assets/audio/step.ogt +9 -0
- package/archetypes/topdown/assets/fonts/OFL.txt +93 -0
- package/archetypes/topdown/assets/fonts/ui.ttf +0 -0
- package/archetypes/topdown/assets/fonts/ui.ttf.ogt +9 -0
- package/archetypes/topdown/assets/maps/tomb.tmj +2183 -0
- package/archetypes/topdown/assets/sprites/hero.ogt +58 -0
- package/archetypes/topdown/assets/sprites/hero.png +0 -0
- package/archetypes/topdown/assets/sprites/hero.png.ogt +7 -0
- package/archetypes/topdown/assets/sprites/items.ogt +15 -0
- package/archetypes/topdown/assets/sprites/items.png +0 -0
- package/archetypes/topdown/assets/sprites/items.png.ogt +7 -0
- package/archetypes/topdown/assets/sprites/slime.ogt +17 -0
- package/archetypes/topdown/assets/sprites/slime.png +0 -0
- package/archetypes/topdown/assets/sprites/slime.png.ogt +7 -0
- package/archetypes/topdown/assets/tiles/dungeon.ogt +65 -0
- package/archetypes/topdown/assets/tiles/dungeon.png +0 -0
- package/archetypes/topdown/assets/tiles/dungeon.png.ogt +7 -0
- package/archetypes/topdown/gitattributes +22 -0
- package/archetypes/topdown/host.d.ts +46 -0
- package/archetypes/topdown/package.json +18 -0
- package/archetypes/topdown/project.ogt +14 -0
- package/archetypes/topdown/references/metal/crit.png +0 -0
- package/archetypes/topdown/references/metal/dash.png +0 -0
- package/archetypes/topdown/references/metal/east.png +0 -0
- package/archetypes/topdown/references/metal/start.png +0 -0
- package/archetypes/topdown/src/art.ts +48 -0
- package/archetypes/topdown/src/components.ts +128 -0
- package/archetypes/topdown/src/main.ts +275 -0
- package/archetypes/topdown/src/systems.ts +503 -0
- package/archetypes/topdown/tests/ai.og.ts +64 -0
- package/archetypes/topdown/tests/combat.og.ts +72 -0
- package/archetypes/topdown/tests/door.og.ts +62 -0
- package/archetypes/topdown/tests/flee.og.ts +49 -0
- package/archetypes/topdown/tests/frames.og.ts +45 -0
- package/archetypes/topdown/tests/frames.ts +134 -0
- package/archetypes/topdown/tests/lib.ts +71 -0
- package/archetypes/topdown/tests/replay.og.ts +40 -0
- package/archetypes/topdown/tests/walk.og.ts +46 -0
- package/archetypes/topdown/tools/make-assets.py +623 -0
- package/archetypes/topdown/tools/oglite.py +285 -0
- package/archetypes/topdown/tsconfig.json +17 -0
- package/archetypes/tower-defense/.origin/setup +14 -0
- package/archetypes/tower-defense/LICENSES.md +15 -0
- package/archetypes/tower-defense/README.md +240 -0
- package/archetypes/tower-defense/assets/ai/plant.ogt +16 -0
- package/archetypes/tower-defense/assets/audio/clear.wav +0 -0
- package/archetypes/tower-defense/assets/audio/frost.wav +0 -0
- package/archetypes/tower-defense/assets/audio/leak.wav +0 -0
- package/archetypes/tower-defense/assets/audio/lost.wav +0 -0
- package/archetypes/tower-defense/assets/audio/night.wav +0 -0
- package/archetypes/tower-defense/assets/audio/plant.wav +0 -0
- package/archetypes/tower-defense/assets/audio/pop.wav +0 -0
- package/archetypes/tower-defense/assets/audio/thorn.wav +0 -0
- package/archetypes/tower-defense/assets/audio/ui-close.ogt +9 -0
- package/archetypes/tower-defense/assets/audio/ui-error.ogt +9 -0
- package/archetypes/tower-defense/assets/audio/ui-open.ogt +9 -0
- package/archetypes/tower-defense/assets/audio/ui-press.ogt +9 -0
- package/archetypes/tower-defense/assets/audio/ui-success.ogt +9 -0
- package/archetypes/tower-defense/assets/audio/wave.wav +0 -0
- package/archetypes/tower-defense/assets/audio/won.wav +0 -0
- package/archetypes/tower-defense/assets/fonts/NotoSansSC-subset.ttf +0 -0
- package/archetypes/tower-defense/assets/fonts/NotoSansSC-subset.ttf.ogt +10 -0
- package/archetypes/tower-defense/assets/fonts/OFL.txt +93 -0
- package/archetypes/tower-defense/assets/fx/fireflies.ogt +21 -0
- package/archetypes/tower-defense/assets/fx/pop.ogt +21 -0
- package/archetypes/tower-defense/assets/maps/garden.ogt +91 -0
- package/archetypes/tower-defense/assets/skins/pathguard/Fredoka-SemiBold.ttf +0 -0
- package/archetypes/tower-defense/assets/skins/pathguard/Fredoka-SemiBold.ttf.ogt +9 -0
- package/archetypes/tower-defense/assets/skins/pathguard/LICENSES.md +13 -0
- package/archetypes/tower-defense/assets/skins/pathguard/LilitaOne-Regular.ttf +0 -0
- package/archetypes/tower-defense/assets/skins/pathguard/LilitaOne-Regular.ttf.ogt +9 -0
- package/archetypes/tower-defense/assets/skins/pathguard/OFL.txt +94 -0
- package/archetypes/tower-defense/assets/skins/pathguard/atlas.png +0 -0
- package/archetypes/tower-defense/assets/skins/pathguard/atlas.png.ogt +7 -0
- package/archetypes/tower-defense/assets/skins/pathguard/icons.png +0 -0
- package/archetypes/tower-defense/assets/skins/pathguard/icons.png.ogt +7 -0
- package/archetypes/tower-defense/assets/skins/pathguard/skin.ogt +111 -0
- package/archetypes/tower-defense/assets/sprites/garden.ogt +66 -0
- package/archetypes/tower-defense/assets/sprites/garden.png +0 -0
- package/archetypes/tower-defense/assets/sprites/garden.png.ogt +7 -0
- package/archetypes/tower-defense/assets/sprites/glow.png +0 -0
- package/archetypes/tower-defense/assets/sprites/glow.png.ogt +7 -0
- package/archetypes/tower-defense/assets/sprites/ring.png +0 -0
- package/archetypes/tower-defense/assets/sprites/ring.png.ogt +7 -0
- package/archetypes/tower-defense/assets/sprites/spark.png +0 -0
- package/archetypes/tower-defense/assets/sprites/spark.png.ogt +7 -0
- package/archetypes/tower-defense/assets/strings/en.ogt +47 -0
- package/archetypes/tower-defense/assets/strings/zh-CN.ogt +47 -0
- package/archetypes/tower-defense/assets/tiles/garden.ogt +10 -0
- package/archetypes/tower-defense/assets/tiles/garden.png +0 -0
- package/archetypes/tower-defense/assets/tiles/garden.png.ogt +7 -0
- package/archetypes/tower-defense/gitattributes +22 -0
- package/archetypes/tower-defense/host.d.ts +46 -0
- package/archetypes/tower-defense/package.json +18 -0
- package/archetypes/tower-defense/project.ogt +14 -0
- package/archetypes/tower-defense/references/metal/end.png +0 -0
- package/archetypes/tower-defense/references/metal/title.png +0 -0
- package/archetypes/tower-defense/references/metal/wave.png +0 -0
- package/archetypes/tower-defense/src/art.ts +24 -0
- package/archetypes/tower-defense/src/components.ts +156 -0
- package/archetypes/tower-defense/src/main.ts +253 -0
- package/archetypes/tower-defense/src/systems.ts +658 -0
- package/archetypes/tower-defense/src/ui.ts +382 -0
- package/archetypes/tower-defense/tests/flow.og.ts +56 -0
- package/archetypes/tower-defense/tests/frames.og.ts +31 -0
- package/archetypes/tower-defense/tests/frames.ts +134 -0
- package/archetypes/tower-defense/tests/lib.ts +81 -0
- package/archetypes/tower-defense/tests/lose.og.ts +40 -0
- package/archetypes/tower-defense/tests/maze.og.ts +53 -0
- package/archetypes/tower-defense/tests/pad.og.ts +41 -0
- package/archetypes/tower-defense/tests/pause.og.ts +59 -0
- package/archetypes/tower-defense/tests/phone.og.ts +49 -0
- package/archetypes/tower-defense/tests/replay.og.ts +28 -0
- package/archetypes/tower-defense/tests/win.og.ts +58 -0
- package/archetypes/tower-defense/tools/make-assets.py +640 -0
- package/archetypes/tower-defense/tools/oglite.py +285 -0
- package/archetypes/tower-defense/tsconfig.json +17 -0
- package/bin/create.ts +496 -0
- package/looks/catalogue.json +1871 -0
- package/package.json +31 -4
- package/template/.origin/setup +14 -0
- package/template/LICENSES.md +23 -0
- package/template/README.md +37 -0
- package/template/assets/ai/guard.ogt +48 -0
- package/template/assets/audio/blip.wav +0 -0
- package/template/assets/audio/click.ogt +9 -0
- package/template/assets/fonts/NotoSansSC-Regular-subset.ttf +0 -0
- package/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
- package/template/assets/fonts/OFL.txt +93 -0
- package/template/assets/looks/origin-game.ogt +12 -0
- package/template/assets/models/dropship.glb +0 -0
- package/template/assets/models/walker.glb +0 -0
- package/template/assets/nav/yard.ogt +27 -0
- package/template/assets/scenes/main.ogt +34 -0
- package/template/assets/strings/en.ogt +14 -0
- package/template/assets/textures/stone.png +0 -0
- package/template/assets/textures/stone_n.png +0 -0
- package/template/assets/textures/stone_n.png.ogt +7 -0
- package/template/gitattributes +22 -0
- package/template/package.json +18 -0
- package/template/project.ogt +25 -0
- package/template/src/main.ts +246 -0
- package/template/tests/guard.og.ts +67 -0
- package/template/tests/smoke.og.ts +43 -0
- package/template/tsconfig.json +17 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
// Ember Vale's screens on og.ui and the skin in assets/skins/ember (the
|
|
2
|
+
// engine's fantasy pack): the title over an orbit of the vale, the HUD
|
|
3
|
+
// (hearts and beacons top-left, the dusk clock and pause top-right, the
|
|
4
|
+
// kindling prompt and its progress at the bottom; on a touch screen a
|
|
5
|
+
// joystick, Jump and Kindle, and a drag on the right half turning the
|
|
6
|
+
// view), the pause menu, the settings dialog and
|
|
7
|
+
// the run's summary. Screens change through a dissolve (a fade with
|
|
8
|
+
// reduced motion). Every string is a key of assets/strings/*.ogt.
|
|
9
|
+
//
|
|
10
|
+
// The Ui system also starts runs, moves the clock (og.DayNight, held by
|
|
11
|
+
// the game so a pause holds it), ends runs (every beacon lit, the hearts
|
|
12
|
+
// gone, or night), holds the world while paused, sets the buses and keeps
|
|
13
|
+
// the settings and the record in og.platform (the record written at the
|
|
14
|
+
// revision read, and merged when another device wrote it first).
|
|
15
|
+
|
|
16
|
+
import { og, defineSystem } from "@origingame/engine";
|
|
17
|
+
import type { Value, World } from "@origingame/engine";
|
|
18
|
+
import { BEACONS, Ending, Game, HEARTS, Phase, Prefs, Sound, Tuning } from "./components.ts";
|
|
19
|
+
import { lazyTuning } from "./hero.ts";
|
|
20
|
+
import { HOURS, must, setHour } from "./world.ts";
|
|
21
|
+
|
|
22
|
+
export const LANGUAGES = [
|
|
23
|
+
{ code: "en", key: "lang.en" },
|
|
24
|
+
{ code: "zh-CN", key: "lang.zh" },
|
|
25
|
+
] as const;
|
|
26
|
+
|
|
27
|
+
/** Ticks between a run's end and its summary: the moment plays out first. */
|
|
28
|
+
export const OVER_DELAY = 90;
|
|
29
|
+
|
|
30
|
+
/** The tokens' spacing scale in CSS px. */
|
|
31
|
+
const S = { xxs: 2, xs: 4, sm: 8, md: 12, lg: 16 } as const;
|
|
32
|
+
|
|
33
|
+
type GameV = Value<typeof Game>;
|
|
34
|
+
type PrefsV = Value<typeof Prefs>;
|
|
35
|
+
|
|
36
|
+
export function say(world: World, key: string, args?: Record<string, string | number>): string {
|
|
37
|
+
return og.i18n.t(world, key, args);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const grow = { kind: "grow" } as const;
|
|
41
|
+
const px = (n: number) => ({ kind: "fixed", px: n }) as const;
|
|
42
|
+
|
|
43
|
+
/** A new run: the hero at the start, hearts full, the beacons dark, the clock at mid-afternoon. */
|
|
44
|
+
export function startRun(world: World, g: GameV): void {
|
|
45
|
+
g.phase = Phase.Play;
|
|
46
|
+
g.ending = Ending.None;
|
|
47
|
+
g.paused = false;
|
|
48
|
+
g.hearts = HEARTS;
|
|
49
|
+
g.hurts = 0;
|
|
50
|
+
g.lit = 0;
|
|
51
|
+
g.litMask = 0;
|
|
52
|
+
g.time = 0;
|
|
53
|
+
g.hour = HOURS.start;
|
|
54
|
+
g.kindle = 0;
|
|
55
|
+
g.near = -1;
|
|
56
|
+
g.jumps = 0;
|
|
57
|
+
g.splashes = 0;
|
|
58
|
+
g.grabs = 0;
|
|
59
|
+
g.alarms = 0;
|
|
60
|
+
g.overTicks = 0;
|
|
61
|
+
g.newBest = false;
|
|
62
|
+
g.start = true;
|
|
63
|
+
g.runs += 1;
|
|
64
|
+
setHour(world, g.hour);
|
|
65
|
+
saveRecord(world, g);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Back to the title: the vale reset behind it, the beacons burning. */
|
|
69
|
+
export function toTitle(world: World, g: GameV): void {
|
|
70
|
+
g.phase = Phase.Title;
|
|
71
|
+
g.paused = false;
|
|
72
|
+
g.ending = Ending.None;
|
|
73
|
+
g.start = true;
|
|
74
|
+
g.hour = HOURS.title;
|
|
75
|
+
setHour(world, g.hour);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The record ({runs, wins, best}) written at the revision last read or
|
|
80
|
+
* written. One call at a time: while a read or a write is in flight the
|
|
81
|
+
* newer record waits (recordDirty) and goes out when that answers, at the
|
|
82
|
+
* revision the answer gives, so a late answer never stands for a newer
|
|
83
|
+
* local record.
|
|
84
|
+
*/
|
|
85
|
+
function saveRecord(world: World, g: GameV): void {
|
|
86
|
+
if (g.recordRequest !== 0 || g.recordWrite !== 0) {
|
|
87
|
+
g.recordDirty = true;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
g.recordDirty = false;
|
|
91
|
+
const r = og.platform.storeSet(world, { key: "record", value: { runs: g.runs, wins: g.wins, best: g.best }, revision: g.recordRevision });
|
|
92
|
+
if (!r.ok) return;
|
|
93
|
+
g.recordWrite = r.value;
|
|
94
|
+
g.recordSentRuns = g.runs;
|
|
95
|
+
g.recordSentWins = g.wins;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function applyPrefs(world: World, p: PrefsV): void {
|
|
99
|
+
const audio = world.resource(og.Audio);
|
|
100
|
+
if (audio.ok) {
|
|
101
|
+
audio.value.master = p.master;
|
|
102
|
+
audio.value.music = p.music;
|
|
103
|
+
audio.value.sfx = p.effects;
|
|
104
|
+
audio.value.ui = p.effects;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function setLanguage(world: World, p: PrefsV, index: number): void {
|
|
109
|
+
p.language = Math.max(0, Math.min(LANGUAGES.length - 1, index));
|
|
110
|
+
og.i18n.setLocale(world, LANGUAGES[p.language]!.code);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function prefsValue(p: PrefsV) {
|
|
114
|
+
return { masterVolume: p.master, musicVolume: p.music, sfxVolume: p.effects, language: LANGUAGES[p.language]!.code, reducedMotion: p.reducedMotion };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* og.platform: the settings and the record asked for on tick 0 and applied
|
|
119
|
+
* when they answer; a record write refused for a stale revision (another
|
|
120
|
+
* device played meanwhile) is read again, merged (the stored counts plus
|
|
121
|
+
* what this device added since it last read or wrote them, the better of
|
|
122
|
+
* the two best times) and written at the new revision.
|
|
123
|
+
*/
|
|
124
|
+
function platform(world: World, g: GameV, p: PrefsV): void {
|
|
125
|
+
if (world.tick === 0) {
|
|
126
|
+
p.loadRequest = og.platform.loadSettings(world);
|
|
127
|
+
const r = og.platform.storeGet(world, "record");
|
|
128
|
+
g.recordRequest = r.ok ? r.value : 0;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (p.loadRequest !== 0) {
|
|
132
|
+
const r = og.platform.result(world, p.loadRequest);
|
|
133
|
+
if (r !== null) {
|
|
134
|
+
p.loadRequest = 0;
|
|
135
|
+
const s = ((r.ok ? r.data : null) as { value?: Record<string, unknown> } | null)?.value ?? null;
|
|
136
|
+
if (s && typeof s === "object") {
|
|
137
|
+
if (typeof s.masterVolume === "number") p.master = s.masterVolume;
|
|
138
|
+
if (typeof s.musicVolume === "number") p.music = s.musicVolume;
|
|
139
|
+
if (typeof s.sfxVolume === "number") p.effects = s.sfxVolume;
|
|
140
|
+
if (typeof s.reducedMotion === "boolean") p.reducedMotion = s.reducedMotion;
|
|
141
|
+
const at = LANGUAGES.findIndex((l) => l.code === s.language);
|
|
142
|
+
if (at >= 0) setLanguage(world, p, at);
|
|
143
|
+
applyPrefs(world, p);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (g.recordRequest !== 0) {
|
|
148
|
+
const r = og.platform.result(world, g.recordRequest);
|
|
149
|
+
if (r !== null) {
|
|
150
|
+
g.recordRequest = 0;
|
|
151
|
+
const d = (r.ok ? r.data : null) as { value?: { runs?: number; wins?: number; best?: number } | null; revision?: number } | null;
|
|
152
|
+
const runs = d?.value?.runs ?? 0;
|
|
153
|
+
const wins = d?.value?.wins ?? 0;
|
|
154
|
+
const best = d?.value?.best ?? 0;
|
|
155
|
+
g.runs = runs + g.runs - g.recordRuns;
|
|
156
|
+
g.wins = wins + g.wins - g.recordWins;
|
|
157
|
+
if (best > 0 && (g.best === 0 || best < g.best)) g.best = best;
|
|
158
|
+
g.recordRuns = runs;
|
|
159
|
+
g.recordWins = wins;
|
|
160
|
+
if (typeof d?.revision === "number") g.recordRevision = d.revision;
|
|
161
|
+
if (g.recordMerge || g.recordDirty) {
|
|
162
|
+
g.recordMerge = false;
|
|
163
|
+
saveRecord(world, g);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (g.recordWrite !== 0) {
|
|
168
|
+
const r = og.platform.result(world, g.recordWrite);
|
|
169
|
+
if (r !== null) {
|
|
170
|
+
g.recordWrite = 0;
|
|
171
|
+
if (r.ok) {
|
|
172
|
+
// The store now holds what was sent, at the revision it answers.
|
|
173
|
+
g.recordRevision = (r.data as { revision: number }).revision;
|
|
174
|
+
g.recordRuns = g.recordSentRuns;
|
|
175
|
+
g.recordWins = g.recordSentWins;
|
|
176
|
+
if (g.recordDirty) saveRecord(world, g);
|
|
177
|
+
} else if (r.error?.code === "conflict") {
|
|
178
|
+
// Someone else wrote the record: read it again and write the merge.
|
|
179
|
+
g.recordConflicts += 1;
|
|
180
|
+
g.recordMerge = true;
|
|
181
|
+
const again = og.platform.storeGet(world, "record");
|
|
182
|
+
g.recordRequest = again.ok ? again.value : 0;
|
|
183
|
+
} else if (g.recordDirty) saveRecord(world, g);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** The clock and the endings: night at HOURS.night, the hearts gone, or (the Beacons system) every beacon lit. */
|
|
189
|
+
function clock(world: World, g: GameV, dt: number): void {
|
|
190
|
+
const t = lazyTuning(world);
|
|
191
|
+
// The summary's moments (its burst) count on from the run's end.
|
|
192
|
+
if (g.phase === Phase.Over) g.overTicks += 1;
|
|
193
|
+
if (g.phase !== Phase.Play) return;
|
|
194
|
+
if (g.ending === Ending.None) {
|
|
195
|
+
g.time += dt;
|
|
196
|
+
g.hour = Math.min(HOURS.night, HOURS.start + (g.time / t.duskSeconds) * (HOURS.night - HOURS.start));
|
|
197
|
+
if (g.hearts <= 0) g.ending = Ending.Caught;
|
|
198
|
+
else if (g.hour >= HOURS.night) {
|
|
199
|
+
g.ending = Ending.Night;
|
|
200
|
+
g.sfx |= Sound.Night;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
setHour(world, g.hour);
|
|
204
|
+
if (g.ending === Ending.None) return;
|
|
205
|
+
g.overTicks += 1;
|
|
206
|
+
if (g.overTicks === OVER_DELAY) {
|
|
207
|
+
g.phase = Phase.Over;
|
|
208
|
+
if (g.ending === Ending.Dawn) {
|
|
209
|
+
g.wins += 1;
|
|
210
|
+
g.newBest = g.best === 0 || g.time < g.best;
|
|
211
|
+
if (g.newBest) g.best = g.time;
|
|
212
|
+
}
|
|
213
|
+
saveRecord(world, g);
|
|
214
|
+
must(og.platform.telemetry(world, "run.over", { ending: ["none", "dawn", "night", "caught"][g.ending]!, time: Math.round(g.time), lit: g.lit, hurts: g.hurts }));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function capsule(id: string, build: () => void): void {
|
|
219
|
+
og.ui.row(id, { gap: S.xs, cross: "center", padding: { left: S.sm, top: S.xs, right: S.md, bottom: S.xs }, frame: "capsule", background: { token: "surface" } }, build);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function clockText(g: GameV): string {
|
|
223
|
+
const h = Math.floor(g.hour);
|
|
224
|
+
const m = Math.floor((g.hour - h) * 60);
|
|
225
|
+
return `${h}:${m < 10 ? "0" : ""}${m}`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function hud(world: World, g: GameV): void {
|
|
229
|
+
const vp = og.ui.frameViewport();
|
|
230
|
+
const touch = vp.coarsePointer;
|
|
231
|
+
const t = lazyTuning(world);
|
|
232
|
+
og.ui.setNavigation(false);
|
|
233
|
+
og.ui.anchor("Status", { anchor: "topLeft", direction: "column", gap: S.sm }, () => {
|
|
234
|
+
capsule("Hearts", () => {
|
|
235
|
+
for (let i = 0; i < HEARTS; i++) og.ui.icon(`Heart${i}`, "heart", { size: 22, tint: { token: i < g.hearts ? "danger" : "fillStrong" } });
|
|
236
|
+
});
|
|
237
|
+
capsule("Beacons", () => {
|
|
238
|
+
og.ui.icon("Fire", "fire", { size: 22, tint: { token: "accent" } });
|
|
239
|
+
og.ui.label("Count", say(world, "hud.beacons", { n: g.lit, total: BEACONS }), { step: "lg", font: "mono", nowrap: true });
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
let paused = false;
|
|
243
|
+
og.ui.anchor("Dusk", { anchor: "topRight", gap: S.sm, cross: "center" }, () => {
|
|
244
|
+
capsule("Clock", () => {
|
|
245
|
+
const left = 1 - (g.hour - HOURS.start) / (HOURS.night - HOURS.start);
|
|
246
|
+
og.ui.icon("Glyph", "clock", { size: 20, tint: { token: left < 0.25 ? "danger" : "fg" } });
|
|
247
|
+
og.ui.label("Hour", clockText(g), { font: "mono", nowrap: true, width: px(48) });
|
|
248
|
+
og.ui.meter("Left", Math.max(0, left), 1, { kind: "accent", width: px(touch ? 70 : 110) });
|
|
249
|
+
});
|
|
250
|
+
if (og.ui.actionButton("Pause", say(world, "hud.pause"), { icon: "pause", size: 48 }).clicked) paused = true;
|
|
251
|
+
});
|
|
252
|
+
if (paused) g.paused = true;
|
|
253
|
+
// The prompt by an unlit beacon, then the kindling's progress.
|
|
254
|
+
if (g.near >= 0 && g.ending === Ending.None) {
|
|
255
|
+
og.ui.anchor("Prompt", { anchor: "bottom", offsetY: touch ? -150 : -24, direction: "column", cross: "center", gap: S.xs }, () => {
|
|
256
|
+
capsule("Hint", () => {
|
|
257
|
+
og.ui.icon("Fire", "fire", { size: 18, tint: { token: "accent" } });
|
|
258
|
+
const pad = must(world.resource(og.Gamepad)).connected();
|
|
259
|
+
og.ui.label("Text", say(world, touch ? "hud.hint.touch" : pad ? "hud.hint.pad" : "hud.hint.keys"), { nowrap: true });
|
|
260
|
+
});
|
|
261
|
+
if (g.kindle > 0) og.ui.progress("Kindle", g.kindle / t.kindleSeconds, { width: px(200) });
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
let stickX = 0;
|
|
265
|
+
let stickY = 0;
|
|
266
|
+
let kindle = false;
|
|
267
|
+
if (touch) {
|
|
268
|
+
og.ui.anchor("Move", { anchor: "bottomLeft" }, () => {
|
|
269
|
+
const s = og.ui.joystick("Stick", { size: 140, deadZone: 0.12 });
|
|
270
|
+
// A thumb landing on the stick answers on the ui bus too (Sound.Tap).
|
|
271
|
+
const held = og.ui.memory("Held", 0);
|
|
272
|
+
if (s.active && held === 0) g.sfx |= Sound.Tap;
|
|
273
|
+
if ((s.active ? 1 : 0) !== held) og.ui.remember("Held", s.active ? 1 : 0);
|
|
274
|
+
if (s.active) {
|
|
275
|
+
stickX = s.x;
|
|
276
|
+
stickY = s.y;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
og.ui.anchor("Hands", { anchor: "bottomRight", gap: S.md, cross: "end" }, () => {
|
|
280
|
+
kindle = og.ui.actionButton("Kindle", say(world, "hud.kindle"), { icon: "fire", size: 64, primary: g.near >= 0 }).pressed;
|
|
281
|
+
// Each answers on the ui bus as it is touched (Sound.Tap), then acts.
|
|
282
|
+
if (kindle && !g.padKindle) g.sfx |= Sound.Tap;
|
|
283
|
+
const jump = og.ui.actionButton("Jump", say(world, "hud.jump"), { icon: "play", size: 72 });
|
|
284
|
+
if (jump.clicked) {
|
|
285
|
+
g.padJump = true;
|
|
286
|
+
g.sfx |= Sound.Tap;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
if (stickX !== g.stickX) g.stickX = stickX;
|
|
291
|
+
if (stickY !== g.stickY) g.stickY = stickY;
|
|
292
|
+
if (kindle !== g.padKindle) g.padKindle = kindle;
|
|
293
|
+
look(world, g, touch ? vp : null);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Radians the view turns per CSS px a finger drags across the look zone. */
|
|
297
|
+
const LOOK_RAD_PER_PX = 0.008;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* The touch view turn: a finger that lands in the look zone (the right
|
|
301
|
+
* half, below the clock and above Jump and Kindle) turns the view as it
|
|
302
|
+
* drags sideways, alongside the stick's thumb, until it lifts. The turn
|
|
303
|
+
* goes to View through Game.lookTurn.
|
|
304
|
+
*/
|
|
305
|
+
function look(world: World, g: GameV, vp: ReturnType<typeof og.ui.frameViewport> | null): void {
|
|
306
|
+
let turn = 0;
|
|
307
|
+
let id = g.lookId;
|
|
308
|
+
if (vp === null) id = -1;
|
|
309
|
+
else {
|
|
310
|
+
const ptr = must(world.resource(og.Pointers));
|
|
311
|
+
if (id >= 0 && !ptr.down(id)) id = -1;
|
|
312
|
+
if (id >= 0) {
|
|
313
|
+
const x = ptr.position(id).x;
|
|
314
|
+
turn = (x - g.lookX) * LOOK_RAD_PER_PX;
|
|
315
|
+
if (x !== g.lookX) g.lookX = x;
|
|
316
|
+
} else {
|
|
317
|
+
const top = vp.safeArea.top + 96;
|
|
318
|
+
const bottom = vp.height - vp.safeArea.bottom - 220;
|
|
319
|
+
for (let n = 0; n < ptr.count(); n++) {
|
|
320
|
+
if (!ptr.pressed(n)) continue;
|
|
321
|
+
const at = ptr.start(n);
|
|
322
|
+
if (at.x < vp.width / 2 || at.y < top || at.y > bottom) continue;
|
|
323
|
+
id = n;
|
|
324
|
+
g.lookX = ptr.position(n).x;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (id !== g.lookId) g.lookId = id;
|
|
330
|
+
if (turn !== g.lookTurn) g.lookTurn = turn;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function settings(world: World, g: GameV, p: PrefsV): void {
|
|
334
|
+
let done = false;
|
|
335
|
+
const before = JSON.stringify(prefsValue(p));
|
|
336
|
+
const m = og.ui.modal("Settings", g.settingsOpen, { title: say(world, "settings.title"), width: px(Math.min(420, og.ui.frameViewport().width - 32)) }, () => {
|
|
337
|
+
const slider = (id: string, key: string, value: number): number => {
|
|
338
|
+
let out = value;
|
|
339
|
+
og.ui.row(id, { width: grow, gap: S.md, cross: "center" }, () => {
|
|
340
|
+
og.ui.label("Label", say(world, key), { width: px(110), nowrap: true });
|
|
341
|
+
out = og.ui.slider("Slider", value, { step: 0.05 }).value;
|
|
342
|
+
og.ui.label("Value", `${Math.round(out * 100)}`, { width: px(40), align: "end", font: "mono", nowrap: true });
|
|
343
|
+
});
|
|
344
|
+
return out;
|
|
345
|
+
};
|
|
346
|
+
p.master = slider("Master", "settings.master", p.master);
|
|
347
|
+
p.music = slider("Music", "settings.music", p.music);
|
|
348
|
+
p.effects = slider("Effects", "settings.effects", p.effects);
|
|
349
|
+
og.ui.label("LanguageLabel", say(world, "settings.language"), { color: { token: "fgMuted" } });
|
|
350
|
+
const r = og.ui.radio("Language", LANGUAGES.map((l) => say(world, l.key)), p.language, { horizontal: true });
|
|
351
|
+
if (r.selected !== p.language) setLanguage(world, p, r.selected);
|
|
352
|
+
p.reducedMotion = og.ui.toggle("Motion", p.reducedMotion, say(world, "settings.motion")).on;
|
|
353
|
+
og.ui.row("Footer", { width: grow, align: "end" }, () => {
|
|
354
|
+
if (og.ui.button("Done", say(world, "settings.done"), { variant: "primary" }).clicked) done = true;
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
if (JSON.stringify(prefsValue(p)) !== before) applyPrefs(world, p);
|
|
358
|
+
if (g.settingsOpen && (done || m.dismissed)) {
|
|
359
|
+
g.settingsOpen = false;
|
|
360
|
+
must(og.platform.saveSettings(world, prefsValue(p)));
|
|
361
|
+
p.saves += 1;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function seconds(s: number): string {
|
|
366
|
+
const m = Math.floor(s / 60);
|
|
367
|
+
const r = Math.floor(s % 60);
|
|
368
|
+
return `${m}:${r < 10 ? "0" : ""}${r}`;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** The run's summary: how it ended, how long it took, what was lit and lost, the record. */
|
|
372
|
+
function summary(world: World, g: GameV): "again" | "menu" | null {
|
|
373
|
+
let chose: "again" | "menu" | null = null;
|
|
374
|
+
const won = g.ending === Ending.Dawn;
|
|
375
|
+
const title = won ? "over.won" : g.ending === Ending.Caught ? "over.caught" : "over.night";
|
|
376
|
+
og.ui.modal("Summary", g.phase === Phase.Over, { title: say(world, title), locked: true, width: px(Math.min(400, og.ui.frameViewport().width - 32)) }, () => {
|
|
377
|
+
og.ui.row("Mark", { width: grow, align: "center" }, () => {
|
|
378
|
+
og.ui.transition("Icon", true, { kind: "pop" }, () => og.ui.icon("Glyph", won ? "fire" : g.ending === Ending.Caught ? "skull" : "clock", { size: 48, tint: { token: won ? "accent" : "fgMuted" } }));
|
|
379
|
+
// From a third of a second into the summary, every frame: a burst plays only while it is called.
|
|
380
|
+
if (won && g.overTicks >= OVER_DELAY + 20) og.ui.burst({ count: 14 });
|
|
381
|
+
});
|
|
382
|
+
og.ui.column("Stats", { width: grow, gap: 0 }, () => {
|
|
383
|
+
og.ui.keyValue("Time", say(world, "over.time"), seconds(g.time), true);
|
|
384
|
+
og.ui.keyValue("Beacons", say(world, "over.beacons"), `${g.lit}/${BEACONS}`, true);
|
|
385
|
+
og.ui.keyValue("Hurts", say(world, "over.hurts"), `${g.hurts}`, true);
|
|
386
|
+
og.ui.keyValue("Best", say(world, "over.best"), g.best > 0 ? seconds(g.best) + (g.newBest ? " ★" : "") : say(world, "over.none"), false);
|
|
387
|
+
});
|
|
388
|
+
og.ui.label("Record", say(world, "over.record", { runs: g.runs, wins: g.wins }), { color: { token: "fgMuted" }, align: "center", width: grow });
|
|
389
|
+
og.ui.row("Actions", { width: grow, gap: S.sm }, () => {
|
|
390
|
+
if (og.ui.button("Again", say(world, "over.again"), { variant: "primary", width: grow }).clicked) chose = "again";
|
|
391
|
+
if (og.ui.button("Menu", say(world, "over.menu"), { width: grow }).clicked) chose = "menu";
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
return chose;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** The screens, the run's start, clock and end, the hold, the buses, the platform's answers. */
|
|
398
|
+
export const Ui = defineSystem("Ui", { reads: [Tuning, og.Gamepad, og.Pointers], writes: [Game, Prefs, og.Audio, og.DayNight] }, (_q, time, world) => {
|
|
399
|
+
const g = must(world.resource(Game));
|
|
400
|
+
const p = must(world.resource(Prefs));
|
|
401
|
+
platform(world, g, p);
|
|
402
|
+
if (time.tick === 0) applyPrefs(world, p);
|
|
403
|
+
const hold = g.phase === Phase.Play && (g.paused || g.settingsOpen);
|
|
404
|
+
if (hold !== g.held) {
|
|
405
|
+
must(og.time.setScale(world, hold ? 0 : 1));
|
|
406
|
+
g.held = hold;
|
|
407
|
+
}
|
|
408
|
+
clock(world, g, time.scaledDt);
|
|
409
|
+
|
|
410
|
+
const screen = g.phase === Phase.Title ? "title" : g.phase === Phase.Play ? "play" : "over";
|
|
411
|
+
const shown = og.ui.screenTransition("Screens", screen, { kind: p.reducedMotion ? "fade" : "dissolve", durationMs: 600 }).shown;
|
|
412
|
+
if (shown !== "title") g.leftTitle = true;
|
|
413
|
+
if (shown === "title") {
|
|
414
|
+
og.ui.setNavigation(true);
|
|
415
|
+
const r = og.ui.mainMenu("Title", {
|
|
416
|
+
title: say(world, "title.name"),
|
|
417
|
+
subtitle: say(world, "title.tagline"),
|
|
418
|
+
items: [
|
|
419
|
+
{ id: "play", label: say(world, "title.play"), primary: true },
|
|
420
|
+
{ id: "settings", label: say(world, "title.settings") },
|
|
421
|
+
],
|
|
422
|
+
footer: say(world, og.ui.frameViewport().coarsePointer ? "title.footer.touch" : "title.footer"),
|
|
423
|
+
// The title the game opens on is built settled: the web draws it behind the play gate, where
|
|
424
|
+
// the skin's entrance would stand part-way until the tap (og-platform-sdk §3). Later titles enter.
|
|
425
|
+
instant: !g.leftTitle,
|
|
426
|
+
});
|
|
427
|
+
if (!g.settingsOpen && r.selected === "play" && g.phase === Phase.Title) startRun(world, g);
|
|
428
|
+
if (r.selected === "settings") g.settingsOpen = true;
|
|
429
|
+
} else if (shown === "play") {
|
|
430
|
+
hud(world, g);
|
|
431
|
+
const m = og.ui.pauseMenu("Pause", {
|
|
432
|
+
open: g.paused && !g.settingsOpen,
|
|
433
|
+
title: say(world, "pause.title"),
|
|
434
|
+
items: [
|
|
435
|
+
{ id: "resume", label: say(world, "pause.resume"), primary: true },
|
|
436
|
+
{ id: "settings", label: say(world, "pause.settings") },
|
|
437
|
+
{ id: "quit", label: say(world, "pause.quit") },
|
|
438
|
+
],
|
|
439
|
+
});
|
|
440
|
+
if (m.selected === "resume") g.paused = false;
|
|
441
|
+
if (m.selected === "settings") g.settingsOpen = true;
|
|
442
|
+
if (m.selected === "quit") toTitle(world, g);
|
|
443
|
+
} else {
|
|
444
|
+
og.ui.setNavigation(true);
|
|
445
|
+
const c = summary(world, g);
|
|
446
|
+
if (c === "again") startRun(world, g);
|
|
447
|
+
if (c === "menu") toTitle(world, g);
|
|
448
|
+
}
|
|
449
|
+
settings(world, g, p);
|
|
450
|
+
if (g.language !== p.language) g.language = p.language;
|
|
451
|
+
});
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// The vale itself: the terrain and its collider, the lake, the sky, the sun
|
|
2
|
+
// and its day running down to night, the fog, the post stack, the edge of
|
|
3
|
+
// the world and the four beacons on their knolls (a plinth, an iron bowl,
|
|
4
|
+
// the fire, smoke and embers waiting to be lit, a light, a scorch mark on
|
|
5
|
+
// the ground and a rune on the plinth's face towards the lake).
|
|
6
|
+
//
|
|
7
|
+
// Keep the numbers in step with tools/make-assets.py (BEACONS, LAKE, the
|
|
8
|
+
// knolls' heights) and assets/nav/vale.ogt (the plinths' boxes).
|
|
9
|
+
|
|
10
|
+
import { og, SHAPE_BOX, SHAPE_HEIGHTFIELD, WEATHER_NONE } from "@origingame/engine";
|
|
11
|
+
import type { Entity, Quaternion, TerrainData, Vector3, World } from "@origingame/engine";
|
|
12
|
+
import { Beacon, BEACONS, Game } from "./components.ts";
|
|
13
|
+
|
|
14
|
+
export function must<T>(r: { ok: true; value: T } | { ok: false; reason: string }): T;
|
|
15
|
+
export function must(r: { ok: true } | { ok: false; reason: string }): void;
|
|
16
|
+
export function must<T>(r: { ok: true; value?: T } | { ok: false; reason: string }): T | void {
|
|
17
|
+
if (!r.ok) throw new Error(r.reason);
|
|
18
|
+
return r.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The beacons' knolls (x, z), clockwise from the north-west. */
|
|
22
|
+
export const BEACON_AT: readonly { x: number; z: number }[] = [
|
|
23
|
+
{ x: -34, z: -30 },
|
|
24
|
+
{ x: 34, z: -32 },
|
|
25
|
+
{ x: 36, z: 26 },
|
|
26
|
+
{ x: -36, z: 24 },
|
|
27
|
+
];
|
|
28
|
+
/** The lake's centre and its surface. */
|
|
29
|
+
export const LAKE = { x: 0, z: -6 };
|
|
30
|
+
export const WATER_Y = 1;
|
|
31
|
+
/** Where a run starts: the south end of the spur path. */
|
|
32
|
+
export const START = { x: 0, z: 36 };
|
|
33
|
+
/** The plinth (also the navmesh's box): its size, and its top above the knoll's height. */
|
|
34
|
+
export const PLINTH = { width: 1.6, height: 1.2, top: 1 };
|
|
35
|
+
/** The bowl on the plinth. */
|
|
36
|
+
const BOWL = { width: 1.1, height: 0.34 };
|
|
37
|
+
/** The hours a run spans: the light is low at the start and night falls at the end. */
|
|
38
|
+
export const HOURS = { start: 15.5, night: 19.5, title: 16.6 };
|
|
39
|
+
|
|
40
|
+
/** The decal atlas's regions (textures/decals.png). */
|
|
41
|
+
const ATLAS = {
|
|
42
|
+
scorch: { uvMin: { x: 0, y: 0 }, uvMax: { x: 0.5, y: 0.5 } },
|
|
43
|
+
rune: { uvMin: { x: 0.5, y: 0 }, uvMax: { x: 1, y: 0.5 } },
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
/** The terrain's height and normal at a point. */
|
|
47
|
+
export function ground(world: World, g: { terrain: number }, x: number, z: number): { height: number; normal: Vector3 } {
|
|
48
|
+
const s = og.terrain.sample(world, { data: g.terrain as unknown as TerrainData, origin: { x: 0, y: 0, z: 0 }, x, z });
|
|
49
|
+
return s.ok ? s.value : { height: 0, normal: { x: 0, y: 1, z: 0 } };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Builds the vale once, in `start`. */
|
|
53
|
+
export function buildVale(world: World): void {
|
|
54
|
+
const g = must(world.resource(Game));
|
|
55
|
+
const info = must(og.terrain.load(world, "terrain/vale.ogt"));
|
|
56
|
+
const vale = must(world.spawn({ name: "vale", position: { x: 0, y: 0, z: 0 } }));
|
|
57
|
+
must(world.insert(vale, og.Terrain, { data: info.data }));
|
|
58
|
+
must(world.insert(vale, og.Collider, { shape: SHAPE_HEIGHTFIELD, mesh: info.geometry }));
|
|
59
|
+
g.terrain = info.data as unknown as number;
|
|
60
|
+
g.nav = must(og.nav.load(world, "nav/vale.ogt")).mesh as unknown as number;
|
|
61
|
+
|
|
62
|
+
const lake = must(world.spawn({ name: "lake", position: { x: LAKE.x, y: WATER_Y, z: LAKE.z } }));
|
|
63
|
+
must(world.insert(lake, og.Water, {
|
|
64
|
+
size: { x: 34, y: 34 },
|
|
65
|
+
segments: 64,
|
|
66
|
+
waveStrength: 0.12,
|
|
67
|
+
waveScale: 0.8,
|
|
68
|
+
planarReflection: 0.5,
|
|
69
|
+
reflectivity: 0.45,
|
|
70
|
+
shadows: 0.8,
|
|
71
|
+
caustics: 1,
|
|
72
|
+
depthFade: 1.2,
|
|
73
|
+
shallow: { r: 0.42, g: 0.7, b: 0.66 },
|
|
74
|
+
deep: { r: 0.04, g: 0.14, b: 0.17 },
|
|
75
|
+
foamWidth: 0.3,
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
// The edge of the world: walls beyond the cliffs' foot, for a hero who climbs them anyway.
|
|
79
|
+
const walls: [number, number, number, number][] = [[0, -52, 110, 2], [0, 52, 110, 2], [-52, 0, 2, 110], [52, 0, 2, 110]];
|
|
80
|
+
walls.forEach(([x, z, w, d], i) => {
|
|
81
|
+
const e = must(world.spawn({ name: `edge-${i}`, position: { x, y: 10, z } }));
|
|
82
|
+
must(world.insert(e, og.Collider, { shape: SHAPE_BOX, size: { x: w, y: 40, z: d } }));
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const settings = must(world.resource(og.RenderSettings));
|
|
86
|
+
settings.sky = true;
|
|
87
|
+
settings.bloom = true;
|
|
88
|
+
settings.bloomIntensity = 0.35;
|
|
89
|
+
settings.environmentIntensity = 0.7;
|
|
90
|
+
settings.decalAtlas = must(og.load.texture(world, "textures/decals.png"));
|
|
91
|
+
const post = must(world.resource(og.PostEffects));
|
|
92
|
+
Object.assign(post, {
|
|
93
|
+
ao: true,
|
|
94
|
+
aoRadius: 0.8,
|
|
95
|
+
aoIntensity: 0.9,
|
|
96
|
+
godRays: true,
|
|
97
|
+
godRaysIntensity: 0.35,
|
|
98
|
+
vignette: true,
|
|
99
|
+
vignetteIntensity: 0.3,
|
|
100
|
+
lut: must(og.load.lut(world, "luts/teal-orange.cube")),
|
|
101
|
+
lutIntensity: 0.35,
|
|
102
|
+
filmGrain: 0.035,
|
|
103
|
+
});
|
|
104
|
+
const sky = must(world.resource(og.Sky));
|
|
105
|
+
Object.assign(sky, { enabled: true, sunSize: 1.2, glow: 0.45 });
|
|
106
|
+
const fog = must(world.resource(og.Fog));
|
|
107
|
+
Object.assign(fog, { enabled: true, density: 0.0035, start: 30, heightDensity: 0.02, height: 1, falloff: 0.6, maxOpacity: 0.75, sky: 0.15, color: { r: 0.7, g: 0.62, b: 0.55 } });
|
|
108
|
+
must(world.resource(og.Weather)).kind = WEATHER_NONE;
|
|
109
|
+
const sun = must(world.spawn({ name: "sun", position: { x: 0, y: 40, z: 0 } }));
|
|
110
|
+
must(world.insert(sun, og.DirectionalLight, { intensity: 3, castShadow: true }));
|
|
111
|
+
const day = must(world.resource(og.DayNight));
|
|
112
|
+
Object.assign(day, { enabled: true, start: HOURS.title, speed: 0, tilt: 20, azimuth: 0, lightIntensity: 1, tintFog: true, step: 5 });
|
|
113
|
+
|
|
114
|
+
buildBeacons(world, g.terrain);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Sets the time of day. og.DayNight counts unscaled ticks (a pause would not
|
|
119
|
+
* hold it), so the clock is held here (speed 0) and moved by the game: the
|
|
120
|
+
* Ui system sets it from the seconds played each tick.
|
|
121
|
+
*/
|
|
122
|
+
export function setHour(world: World, hour: number): void {
|
|
123
|
+
const day = must(world.resource(og.DayNight));
|
|
124
|
+
day.speed = 0;
|
|
125
|
+
day.start = hour;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buildBeacons(world: World, terrain: number): void {
|
|
129
|
+
const stone = must(og.render.standardMaterial(world, { color: { r: 0.42, g: 0.4, b: 0.37 }, roughness: 0.92 }));
|
|
130
|
+
const iron = must(og.render.standardMaterial(world, { color: { r: 0.12, g: 0.1, b: 0.09 }, roughness: 0.55, metalness: 0.8 }));
|
|
131
|
+
const coals = must(og.render.standardMaterial(world, { color: { r: 0.05, g: 0.04, b: 0.04 }, roughness: 1, emissive: { r: 1, g: 0.3, b: 0.05 }, emissiveIntensity: 0 }));
|
|
132
|
+
const plinth = must(og.render.boxGeometry(world, { width: PLINTH.width, height: PLINTH.height, depth: PLINTH.width }));
|
|
133
|
+
const bowl = must(og.render.boxGeometry(world, { width: BOWL.width, height: BOWL.height, depth: BOWL.width }));
|
|
134
|
+
const bed = must(og.render.boxGeometry(world, { width: BOWL.width - 0.2, height: 0.04, depth: BOWL.width - 0.2 }));
|
|
135
|
+
const fire = must(og.load.emitter(world, "fx/fire.ogt"));
|
|
136
|
+
const smoke = must(og.load.emitter(world, "fx/smoke.ogt"));
|
|
137
|
+
const burst = must(og.load.emitter(world, "fx/burst.ogt"));
|
|
138
|
+
BEACON_AT.forEach((at, i) => {
|
|
139
|
+
const h = ground(world, { terrain }, at.x, at.z).height;
|
|
140
|
+
const y = h + PLINTH.top - PLINTH.height / 2;
|
|
141
|
+
const b = must(world.spawn({ name: `beacon-${i}`, position: { x: at.x, y, z: at.z } }));
|
|
142
|
+
must(world.insert(b, og.Mesh, { geometry: plinth, material: stone, castShadow: true, receiveShadow: true }));
|
|
143
|
+
must(world.insert(b, og.Collider, { shape: SHAPE_BOX, size: { x: PLINTH.width, y: PLINTH.height, z: PLINTH.width } }));
|
|
144
|
+
const top = PLINTH.height / 2;
|
|
145
|
+
must(world.insert(b, Beacon, { index: i, top: y + top + BOWL.height }));
|
|
146
|
+
const child = (name: string, position: Vector3, quaternion?: Quaternion): Entity => must(world.spawn({ name: `beacon-${i}-${name}`, parent: b, position, ...(quaternion ? { quaternion } : {}) }));
|
|
147
|
+
const pan = child("bowl", { x: 0, y: top + BOWL.height / 2, z: 0 });
|
|
148
|
+
must(world.insert(pan, og.Mesh, { geometry: bowl, material: iron, castShadow: true, receiveShadow: true }));
|
|
149
|
+
must(world.insert(pan, og.Collider, { shape: SHAPE_BOX, size: { x: BOWL.width, y: BOWL.height, z: BOWL.width } }));
|
|
150
|
+
// Each bowl's coals have their own material, so one glowing leaves the others dark.
|
|
151
|
+
const glow = i === 0 ? coals : must(og.render.standardMaterial(world, { color: { r: 0.05, g: 0.04, b: 0.04 }, roughness: 1, emissive: { r: 1, g: 0.3, b: 0.05 }, emissiveIntensity: 0 }));
|
|
152
|
+
const embers = child("coals", { x: 0, y: top + BOWL.height + 0.02, z: 0 });
|
|
153
|
+
must(world.insert(embers, og.Mesh, { geometry: bed, material: glow }));
|
|
154
|
+
const flame = child("fire", { x: 0, y: top + BOWL.height + 0.05, z: 0 });
|
|
155
|
+
must(world.insert(flame, og.ParticleSystem, { emitter: fire, seed: 11 + i, visible: false }));
|
|
156
|
+
const plume = child("smoke", { x: 0, y: top + BOWL.height + 1, z: 0 });
|
|
157
|
+
must(world.insert(plume, og.ParticleSystem, { emitter: smoke, seed: 21 + i, visible: false }));
|
|
158
|
+
const sparks = child("burst", { x: 0, y: top + BOWL.height + 0.2, z: 0 });
|
|
159
|
+
must(world.insert(sparks, og.ParticleSystem, { emitter: burst, seed: 31 + i, visible: false }));
|
|
160
|
+
const light = child("light", { x: 0, y: top + BOWL.height + 1.2, z: 0 });
|
|
161
|
+
must(world.insert(light, og.PointLight, { color: { r: 1, g: 0.56, b: 0.24 }, intensity: 0, distance: 16, castShadow: false }));
|
|
162
|
+
// The scorch on the knoll, projected down; shown once the beacon burns.
|
|
163
|
+
const scorch = child("scorch", { x: 0, y: h - y, z: 0 }, og.transform.fromAxisAngle({ x: 1, y: 0, z: 0 }, -Math.PI / 2));
|
|
164
|
+
must(world.set(scorch, og.Transform, { scale: { x: 4.6, y: 4.6, z: 2.4 } }));
|
|
165
|
+
must(world.insert(scorch, og.Decal, { ...ATLAS.scorch, color: { r: 0.25, g: 0.2, b: 0.18 }, opacity: 0.85, visible: false }));
|
|
166
|
+
// The rune on the face towards the lake: dark stone, then glowing once lit.
|
|
167
|
+
const toLake = { x: LAKE.x - at.x, z: LAKE.z - at.z };
|
|
168
|
+
const face = Math.abs(toLake.x) > Math.abs(toLake.z) ? { x: Math.sign(toLake.x), z: 0 } : { x: 0, z: Math.sign(toLake.z) };
|
|
169
|
+
const yaw = Math.atan2(face.x, face.z);
|
|
170
|
+
const rune = child("rune", { x: (face.x * PLINTH.width) / 2, y: 0.05, z: (face.z * PLINTH.width) / 2 }, og.transform.fromAxisAngle({ x: 0, y: 1, z: 0 }, yaw));
|
|
171
|
+
must(world.set(rune, og.Transform, { scale: { x: 1, y: 1, z: 0.5 } }));
|
|
172
|
+
must(world.insert(rune, og.Decal, { ...ATLAS.rune, color: { r: 0.3, g: 0.27, b: 0.24 }, opacity: 0.9, angleFade: 80 }));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** The beacon's parts, by name. */
|
|
177
|
+
export function part(world: World, i: number, name: string): Entity {
|
|
178
|
+
const e = world.find(`beacon-${i}-${name}`);
|
|
179
|
+
if (e === null) throw new Error(`beacon-${i}-${name} is missing`);
|
|
180
|
+
return e;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Puts every beacon out (a new run or the title). */
|
|
184
|
+
export function douseBeacons(world: World): void {
|
|
185
|
+
for (let i = 0; i < BEACONS; i++) {
|
|
186
|
+
const b = world.find(`beacon-${i}`);
|
|
187
|
+
if (b === null) continue;
|
|
188
|
+
must(world.set(b, Beacon, { lit: false, litAt: 0 }));
|
|
189
|
+
for (const p of ["fire", "smoke", "burst"]) must(world.set(part(world, i, p), og.ParticleSystem, { visible: false }));
|
|
190
|
+
must(world.set(part(world, i, "light"), og.PointLight, { intensity: 0 }));
|
|
191
|
+
must(world.set(part(world, i, "scorch"), og.Decal, { visible: false }));
|
|
192
|
+
must(world.set(part(world, i, "rune"), og.Decal, { color: { r: 0.3, g: 0.27, b: 0.24 }, emissive: { r: 0, g: 0, b: 0 } }));
|
|
193
|
+
setCoals(world, i, 0);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Lights beacon i: the fire, the smoke, one burst of embers, the light, the scorch and the rune. */
|
|
198
|
+
export function lightBeacon(world: World, i: number, time: number): void {
|
|
199
|
+
const b = world.find(`beacon-${i}`);
|
|
200
|
+
if (b === null) return;
|
|
201
|
+
must(world.set(b, Beacon, { lit: true, litAt: time }));
|
|
202
|
+
const tick = world.tick;
|
|
203
|
+
for (const p of ["fire", "smoke", "burst"]) must(world.set(part(world, i, p), og.ParticleSystem, { visible: true, startTick: tick }));
|
|
204
|
+
must(world.set(part(world, i, "scorch"), og.Decal, { visible: true }));
|
|
205
|
+
must(world.set(part(world, i, "rune"), og.Decal, { color: { r: 1, g: 0.75, b: 0.45 }, emissive: { r: 2.2, g: 0.9, b: 0.25 } }));
|
|
206
|
+
setCoals(world, i, 3);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function setCoals(world: World, i: number, glow: number): void {
|
|
210
|
+
const mesh = world.get(part(world, i, "coals"), og.Mesh);
|
|
211
|
+
if (mesh.ok) must(og.render.updateMaterial(world, mesh.value.material, { emissiveIntensity: glow }));
|
|
212
|
+
}
|