create-threenative 0.2.7 → 0.2.8
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 +3 -1
- package/agent-docs/references/capability-reference.md +177 -7
- package/capabilities.json +247 -4
- package/dist/index.js +6 -1
- package/dist/threenative.js +3 -2
- package/package.json +4 -4
- package/templates/action-rpg/package.json +1 -1
- package/templates/minimal/package.json +1 -1
- package/templates/platformer/package.json +1 -1
- package/templates/puzzle/package.json +1 -1
- package/templates/racing/package.json +1 -1
- package/templates/rain/.codex/config.toml +19 -0
- package/templates/rain/.cursor/mcp.json +32 -0
- package/templates/rain/.gemini/settings.json +32 -0
- package/templates/rain/.mcp.json +32 -0
- package/templates/rain/.vscode/mcp.json +36 -0
- package/templates/rain/.zed/settings.json +36 -0
- package/templates/rain/AGENTS.md +96 -0
- package/templates/rain/CLAUDE.md +98 -0
- package/templates/rain/assets/rain-loop.wav +0 -0
- package/templates/rain/assets/thunder.wav +0 -0
- package/templates/rain/assets/wind-loop.wav +0 -0
- package/templates/rain/index.html +18 -0
- package/templates/rain/kit.json +7 -0
- package/templates/rain/native-playtests/boot.playtest.json +13 -0
- package/templates/rain/native-playtests/lightning.playtest.json +173 -0
- package/templates/rain/opencode.json +41 -0
- package/templates/rain/package.json +56 -0
- package/templates/rain/playtests/auto-lightning-clear.playtest.json +66 -0
- package/templates/rain/playtests/auto-lightning.playtest.json +26 -0
- package/templates/rain/playtests/automation.playtest.json +133 -0
- package/templates/rain/playtests/cinematic.playtest.json +59 -0
- package/templates/rain/playtests/flash.playtest.json +27 -0
- package/templates/rain/playtests/fly.playtest.json +54 -0
- package/templates/rain/playtests/lightning.playtest.json +220 -0
- package/templates/rain/playtests/loading.playtest.json +57 -0
- package/templates/rain/playtests/paused.playtest.json +59 -0
- package/templates/rain/playtests/performance.playtest.json +22 -0
- package/templates/rain/playtests/reduced-motion.playtest.json +87 -0
- package/templates/rain/playtests/simulation.playtest.json +20 -0
- package/templates/rain/playtests/storm.playtest.json +150 -0
- package/templates/rain/playtests/survives.playtest.json +58 -0
- package/templates/rain/playtests/tiers.playtest.json +179 -0
- package/templates/rain/playtests/weather.playtest.json +77 -0
- package/templates/rain/public/favicon.svg +5 -0
- package/templates/rain/src/audio/storm.ts +314 -0
- package/templates/rain/src/game.ts +114 -0
- package/templates/rain/src/main.ts +15 -0
- package/templates/rain/src/render/bloom-shader.ts +65 -0
- package/templates/rain/src/render/camera.ts +160 -0
- package/templates/rain/src/render/clouds-shader.ts +242 -0
- package/templates/rain/src/render/clouds.ts +142 -0
- package/templates/rain/src/render/lighting.ts +39 -0
- package/templates/rain/src/render/lightning.ts +360 -0
- package/templates/rain/src/render/loading.ts +327 -0
- package/templates/rain/src/render/materials.ts +19 -0
- package/templates/rain/src/render/noise-volume.ts +159 -0
- package/templates/rain/src/render/palette.ts +18 -0
- package/templates/rain/src/render/post-shader.ts +178 -0
- package/templates/rain/src/render/postprocessing.ts +226 -0
- package/templates/rain/src/render/quality.ts +135 -0
- package/templates/rain/src/render/rain.ts +299 -0
- package/templates/rain/src/render/sky.ts +28 -0
- package/templates/rain/src/render/world-shader.ts +680 -0
- package/templates/rain/src/render/world.ts +146 -0
- package/templates/rain/src/render/worldEnvironment.ts +809 -0
- package/templates/rain/src/scenes/Boot.ts +334 -0
- package/templates/rain/src/state.ts +257 -0
- package/templates/rain/src/style.css +1160 -0
- package/templates/rain/src/ui/App.tsx +29 -0
- package/templates/rain/src/ui/GameUi.tsx +187 -0
- package/templates/rain/src/ui/Hud.tsx +327 -0
- package/templates/rain/src/ui/LoadingOverlay.tsx +46 -0
- package/templates/rain/src/ui/Menu.tsx +370 -0
- package/templates/rain/src/ui/automation.ts +60 -0
- package/templates/rain/src/ui/main.tsx +7 -0
- package/templates/rain/src/ui/tempest.ts +149 -0
- package/templates/rain/tailwind.config.ts +2 -0
- package/templates/rain/threenative.config.ts +66 -0
- package/templates/rain/tools/generate-shaders.mjs +656 -0
- package/templates/rain/tools/make-storm-audio.mjs +387 -0
- package/templates/rain/tools/storm-dsp.mjs +177 -0
- package/templates/rain/tools/tempest-bloom.frag +10 -0
- package/templates/rain/tools/tempest-clouds.frag +86 -0
- package/templates/rain/tools/tempest-post.frag +47 -0
- package/templates/rain/tools/tempest-world.frag +210 -0
- package/templates/rain/tools/verify-noise-volume.mjs +61 -0
- package/templates/rain/tsconfig.json +17 -0
- package/templates/rain/vite.config.ts +37 -0
- package/templates/rts/package.json +1 -1
- package/templates/runner/package.json +1 -1
- package/templates/sailing/package.json +1 -1
- package/templates/shooter/package.json +1 -1
- package/templates/snow/.codex/config.toml +19 -0
- package/templates/snow/.cursor/mcp.json +32 -0
- package/templates/snow/.gemini/settings.json +32 -0
- package/templates/snow/.mcp.json +32 -0
- package/templates/snow/.vscode/mcp.json +36 -0
- package/templates/snow/.zed/settings.json +36 -0
- package/templates/snow/AGENTS.md +88 -0
- package/templates/snow/CLAUDE.md +90 -0
- package/templates/snow/README.md +26 -0
- package/templates/snow/assets/crunch.wav +0 -0
- package/templates/snow/assets/wind.wav +0 -0
- package/templates/snow/index.html +12 -0
- package/templates/snow/kit.json +7 -0
- package/templates/snow/native-playtests/snow-physics.playtest.json +150 -0
- package/templates/snow/native-playtests/survives.playtest.json +47 -0
- package/templates/snow/opencode.json +41 -0
- package/templates/snow/package.json +58 -0
- package/templates/snow/playtests/footsteps.playtest.json +95 -0
- package/templates/snow/playtests/performance.playtest.json +36 -0
- package/templates/snow/playtests/snow-physics.playtest.json +154 -0
- package/templates/snow/playtests/survives.playtest.json +56 -0
- package/templates/snow/playtests/touch-controls.playtest.json +71 -0
- package/templates/snow/playtests/weather.playtest.json +119 -0
- package/templates/snow/public/favicon.svg +5 -0
- package/templates/snow/src/audio.ts +58 -0
- package/templates/snow/src/commands.ts +8 -0
- package/templates/snow/src/entities/Explorer.ts +279 -0
- package/templates/snow/src/game.ts +69 -0
- package/templates/snow/src/main.ts +15 -0
- package/templates/snow/src/render/bootPrint.ts +50 -0
- package/templates/snow/src/render/camera.ts +84 -0
- package/templates/snow/src/render/explorer.ts +321 -0
- package/templates/snow/src/render/lighting.ts +50 -0
- package/templates/snow/src/render/loading.ts +325 -0
- package/templates/snow/src/render/materials.ts +36 -0
- package/templates/snow/src/render/palette.ts +17 -0
- package/templates/snow/src/render/postprocessing.ts +44 -0
- package/templates/snow/src/render/props.ts +42 -0
- package/templates/snow/src/render/quality.ts +135 -0
- package/templates/snow/src/render/scenery.ts +244 -0
- package/templates/snow/src/render/sky.ts +57 -0
- package/templates/snow/src/render/snowSurface.ts +259 -0
- package/templates/snow/src/render/touch-controls.ts +143 -0
- package/templates/snow/src/render/weather.ts +279 -0
- package/templates/snow/src/render/worldEnvironment.ts +809 -0
- package/templates/snow/src/scenes/Boot.ts +12 -0
- package/templates/snow/src/scenes/Snow.ts +635 -0
- package/templates/snow/src/state.ts +46 -0
- package/templates/snow/src/style.css +143 -0
- package/templates/snow/src/terrain.ts +64 -0
- package/templates/snow/src/ui/App.tsx +15 -0
- package/templates/snow/src/ui/Controls.tsx +322 -0
- package/templates/snow/src/ui/GameUi.tsx +354 -0
- package/templates/snow/src/ui/icons.tsx +54 -0
- package/templates/snow/src/ui/main.tsx +7 -0
- package/templates/snow/tailwind.config.ts +2 -0
- package/templates/snow/threenative.config.ts +51 -0
- package/templates/snow/tsconfig.json +17 -0
- package/templates/snow/vite.config.ts +37 -0
- package/templates/starter/package.json +1 -1
- package/templates/tower-defense/package.json +1 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { UiLayer, useUiIntent, useUiState } from "@threenative/ui";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { type GameState, PROBE_COLUMNS } from "../state.js";
|
|
4
|
+
import { BallActions, Controls } from "./Controls.js";
|
|
5
|
+
import { Icon, Mark } from "./icons.js";
|
|
6
|
+
|
|
7
|
+
const VIEW_LABELS: Record<GameState["view"], string> = {
|
|
8
|
+
follow: "Follow view",
|
|
9
|
+
overhead: "Overhead view",
|
|
10
|
+
surface: "Surface view",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function IconButton({
|
|
14
|
+
icon,
|
|
15
|
+
label,
|
|
16
|
+
onClick,
|
|
17
|
+
pressed,
|
|
18
|
+
className = "",
|
|
19
|
+
}: {
|
|
20
|
+
readonly icon: Parameters<typeof Icon>[0]["name"];
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly onClick: () => void;
|
|
23
|
+
readonly pressed?: boolean;
|
|
24
|
+
readonly className?: string;
|
|
25
|
+
}) {
|
|
26
|
+
return (
|
|
27
|
+
<button
|
|
28
|
+
aria-label={label}
|
|
29
|
+
aria-pressed={pressed}
|
|
30
|
+
className={`grid h-11 w-11 place-items-center rounded-full border backdrop-blur-md transition hover:brightness-110 ${
|
|
31
|
+
pressed ? "border-aqua text-aqua" : "border-[rgb(233_247_252/0.22)] text-text"
|
|
32
|
+
} bg-[rgb(21_41_54/0.37)] ${className}`}
|
|
33
|
+
data-tn-interactive
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
title={label}
|
|
36
|
+
type="button"
|
|
37
|
+
>
|
|
38
|
+
<Icon name={icon} />
|
|
39
|
+
</button>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The last footprint's floor, drawn as a small depth map: darker blue is deeper. */
|
|
44
|
+
function Probe({ values }: { readonly values: readonly number[] }) {
|
|
45
|
+
const rows = Math.max(1, Math.ceil(values.length / PROBE_COLUMNS));
|
|
46
|
+
return (
|
|
47
|
+
<svg
|
|
48
|
+
aria-label="Depth map of the last footprint"
|
|
49
|
+
className="h-[113px] w-[89px] shrink-0 overflow-hidden rounded-[7px] border border-[#d5e2e955] bg-[#cbdce6]"
|
|
50
|
+
preserveAspectRatio="none"
|
|
51
|
+
role="img"
|
|
52
|
+
viewBox={`0 0 ${PROBE_COLUMNS} ${rows}`}
|
|
53
|
+
>
|
|
54
|
+
<defs>
|
|
55
|
+
{/* The grid is coarse; a slight blur reads as a pressed surface rather than pixels. */}
|
|
56
|
+
<filter id="probe-soften">
|
|
57
|
+
<feGaussianBlur stdDeviation="0.22" />
|
|
58
|
+
</filter>
|
|
59
|
+
</defs>
|
|
60
|
+
<g filter="url(#probe-soften)">
|
|
61
|
+
{values.map((value, index) => {
|
|
62
|
+
const shade = Math.max(0, Math.min(1, value / 0.18));
|
|
63
|
+
const bank = Math.max(0, Math.min(1, -value / 0.045));
|
|
64
|
+
const r = Math.round(214 - shade * 109 + bank * 33);
|
|
65
|
+
const g = Math.round(230 - shade * 92 + bank * 21);
|
|
66
|
+
const b = Math.round(240 - shade * 64 + bank * 15);
|
|
67
|
+
return (
|
|
68
|
+
<rect
|
|
69
|
+
fill={`rgb(${r} ${g} ${b})`}
|
|
70
|
+
height={1.02}
|
|
71
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a fixed grid whose cells never reorder.
|
|
72
|
+
key={index}
|
|
73
|
+
width={1.02}
|
|
74
|
+
x={index % PROBE_COLUMNS}
|
|
75
|
+
y={Math.floor(index / PROBE_COLUMNS)}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</g>
|
|
80
|
+
</svg>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function Metric({
|
|
85
|
+
label,
|
|
86
|
+
value,
|
|
87
|
+
unit,
|
|
88
|
+
}: { readonly label: string; readonly value: string; readonly unit?: string }) {
|
|
89
|
+
return (
|
|
90
|
+
<div>
|
|
91
|
+
<div className="mb-1 text-[9px] uppercase tracking-[0.14em] text-[#9cb7c4]">{label}</div>
|
|
92
|
+
<div className="text-[22px] font-[450] leading-none tracking-tight tabular-nums">
|
|
93
|
+
{value}
|
|
94
|
+
{unit === undefined ? null : (
|
|
95
|
+
<em className="ml-1 text-[10px] not-italic text-[#99b8c6]">{unit}</em>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function Help({ onClose }: { readonly onClose: () => void }) {
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const close = (event: KeyboardEvent) => {
|
|
105
|
+
if (event.key === "Escape") onClose();
|
|
106
|
+
};
|
|
107
|
+
window.addEventListener("keydown", close);
|
|
108
|
+
return () => window.removeEventListener("keydown", close);
|
|
109
|
+
}, [onClose]);
|
|
110
|
+
return (
|
|
111
|
+
<div className="pointer-events-auto fixed inset-0 z-30 grid place-items-center bg-[#05182677] p-4 backdrop-blur-sm">
|
|
112
|
+
<dialog
|
|
113
|
+
aria-labelledby="help-title"
|
|
114
|
+
aria-modal="true"
|
|
115
|
+
className="static m-0 w-[420px] max-w-full rounded-[15px] border border-[#647f8e] bg-[#172f3d] p-7 text-[#dbe9ed] shadow-[0_35px_90px_#04121daa]"
|
|
116
|
+
open
|
|
117
|
+
>
|
|
118
|
+
<h2 className="m-0 mb-2 text-[23px] font-[450]" id="help-title">
|
|
119
|
+
Leave a little trace.
|
|
120
|
+
</h2>
|
|
121
|
+
<p className="text-[12px] leading-relaxed text-[#a9c0cd]">
|
|
122
|
+
Walk the glade, push the ball through the powder, or switch on the blizzard and watch the
|
|
123
|
+
tracks fill.
|
|
124
|
+
</p>
|
|
125
|
+
<table className="my-5 w-full border-collapse text-[12px]">
|
|
126
|
+
<tbody>
|
|
127
|
+
{[
|
|
128
|
+
["Walk / run", "WASD or arrows / Shift"],
|
|
129
|
+
["Orbit / zoom", "Drag / scroll"],
|
|
130
|
+
["Drop / push the ball", "F / G"],
|
|
131
|
+
["Blizzard / camera", "B / C"],
|
|
132
|
+
["Auto-explore / compaction", "P / V"],
|
|
133
|
+
["Clear footprints / sound", "R / M"],
|
|
134
|
+
].map(([action, keys]) => (
|
|
135
|
+
<tr className="border-b border-white/10" key={action}>
|
|
136
|
+
<td className="py-2">{action}</td>
|
|
137
|
+
<td className="py-2 text-right text-[#b5dbd5]">{keys}</td>
|
|
138
|
+
</tr>
|
|
139
|
+
))}
|
|
140
|
+
</tbody>
|
|
141
|
+
</table>
|
|
142
|
+
<p className="text-[11px] leading-relaxed text-[#a9c0cd]">
|
|
143
|
+
The snow is a deformable heightfield with approximate compaction and deposition, not a
|
|
144
|
+
granular solver.
|
|
145
|
+
</p>
|
|
146
|
+
<button
|
|
147
|
+
className="mt-2 min-h-11 w-full rounded-[7px] bg-aqua text-[12px] text-aqua-ink"
|
|
148
|
+
data-tn-interactive
|
|
149
|
+
// biome-ignore lint/a11y/noAutofocus: a modal moves focus to its one action.
|
|
150
|
+
autoFocus
|
|
151
|
+
onClick={onClose}
|
|
152
|
+
type="button"
|
|
153
|
+
>
|
|
154
|
+
Back to the snow
|
|
155
|
+
</button>
|
|
156
|
+
</dialog>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function Toast({ state }: { readonly state: GameState }) {
|
|
162
|
+
const [shown, setShown] = useState(false);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (state.toastId === 0) return;
|
|
165
|
+
setShown(true);
|
|
166
|
+
const timer = setTimeout(() => setShown(false), 2800);
|
|
167
|
+
return () => clearTimeout(timer);
|
|
168
|
+
}, [state.toastId]);
|
|
169
|
+
return (
|
|
170
|
+
<output
|
|
171
|
+
aria-live="polite"
|
|
172
|
+
className={`fixed bottom-[100px] left-1/2 z-20 max-w-[85vw] -translate-x-1/2 rounded-[9px] border border-line bg-[rgb(16_35_46/0.88)] px-4 py-3 text-center text-[12px] backdrop-blur-lg transition-opacity max-[850px]:bottom-[250px] ${
|
|
173
|
+
shown ? "opacity-100" : "opacity-0"
|
|
174
|
+
}`}
|
|
175
|
+
>
|
|
176
|
+
{state.toast}
|
|
177
|
+
</output>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function Hud() {
|
|
182
|
+
const state = useUiState<GameState>();
|
|
183
|
+
const send = useUiIntent();
|
|
184
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
185
|
+
const [helpOpen, setHelpOpen] = useState(false);
|
|
186
|
+
if (state === undefined) return null;
|
|
187
|
+
const weatherWords = state.blizzard ? "Incoming gusts · spindrift" : "Light air · dry powder";
|
|
188
|
+
return (
|
|
189
|
+
<div className="pointer-events-none absolute inset-0 select-none text-text">
|
|
190
|
+
{/* Vignette and storm veil: atmosphere only, never in the way of a click. */}
|
|
191
|
+
<div className="absolute inset-0 bg-[linear-gradient(90deg,rgb(5_20_31/0.24),transparent_42%),linear-gradient(0deg,rgb(9_24_35/0.46),transparent_18%,transparent_80%,rgb(7_22_32/0.18))]" />
|
|
192
|
+
{/* A soft scrim under the header and readouts keeps small light text legible over snow. */}
|
|
193
|
+
<div className="absolute inset-x-0 top-0 h-[210px] bg-[linear-gradient(180deg,rgb(10_26_36/0.42),transparent)]" />
|
|
194
|
+
<div
|
|
195
|
+
className="absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_30%,rgb(224_239_246/0.23))]"
|
|
196
|
+
style={{ opacity: state.storm * 0.8 }}
|
|
197
|
+
/>
|
|
198
|
+
|
|
199
|
+
<header className="absolute left-5 right-5 top-5 flex items-center justify-between gap-3 min-[851px]:left-[34px] min-[851px]:right-[34px] min-[851px]:top-[25px]">
|
|
200
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
201
|
+
<div className="grid h-[38px] w-[38px] shrink-0 place-items-center rounded-[11px] border border-[rgb(238_246_250/0.55)] bg-[rgb(28_50_61/0.16)]">
|
|
202
|
+
<Mark />
|
|
203
|
+
</div>
|
|
204
|
+
<div className="min-w-0">
|
|
205
|
+
<div className="truncate text-[15px] font-semibold tracking-[0.26em]">SNOW GLADE</div>
|
|
206
|
+
<div className="mt-1 truncate text-[9px] tracking-[0.2em] opacity-80">
|
|
207
|
+
DEFORMABLE SNOW STUDY
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
212
|
+
<div className="mr-1 hidden items-center gap-2 rounded-full border border-[rgb(222_242_249/0.25)] bg-[rgb(20_39_51/0.24)] px-4 py-2.5 text-[10px] tracking-[0.13em] backdrop-blur-md min-[560px]:flex">
|
|
213
|
+
<span
|
|
214
|
+
className={`h-[5px] w-[5px] rounded-full ${state.paused ? "bg-[#c4c6c0]" : "bg-aqua shadow-[0_0_9px_rgb(159_226_204/0.5)]"}`}
|
|
215
|
+
/>
|
|
216
|
+
<span>{state.paused ? "SIMULATION PAUSED" : "LIVE SIMULATION"}</span>
|
|
217
|
+
</div>
|
|
218
|
+
<IconButton
|
|
219
|
+
icon={state.muted ? "muted" : "sound"}
|
|
220
|
+
label={state.muted ? "Turn sound on" : "Turn sound off"}
|
|
221
|
+
onClick={() => send("mute")}
|
|
222
|
+
pressed={!state.muted}
|
|
223
|
+
/>
|
|
224
|
+
<IconButton
|
|
225
|
+
className="max-[850px]:hidden"
|
|
226
|
+
icon="help"
|
|
227
|
+
label="Controls and notes"
|
|
228
|
+
onClick={() => setHelpOpen(true)}
|
|
229
|
+
/>
|
|
230
|
+
<IconButton
|
|
231
|
+
className="min-[851px]:hidden"
|
|
232
|
+
icon={menuOpen ? "close" : "menu"}
|
|
233
|
+
label={menuOpen ? "Close settings" : "Open settings"}
|
|
234
|
+
onClick={() => setMenuOpen(!menuOpen)}
|
|
235
|
+
pressed={menuOpen}
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
</header>
|
|
239
|
+
|
|
240
|
+
{/* Left column: title, then the controls. On a phone the controls live behind the menu. */}
|
|
241
|
+
<section className="absolute bottom-[98px] left-[34px] top-[120px] w-[285px] [@media(max-height:800px)]:top-[92px] [@media(max-height:800px)]:bottom-[84px] overflow-y-auto [scrollbar-width:none] max-[1100px]:w-[264px] max-[850px]:left-4 max-[850px]:right-4 max-[850px]:top-[84px] max-[850px]:w-auto max-[850px]:bottom-[88px]">
|
|
242
|
+
<div
|
|
243
|
+
className={`mb-6 [text-shadow:0_1px_10px_rgb(16_40_54/0.35)] max-[850px]:mb-3 [@media(max-height:800px)]:mb-5 ${menuOpen ? "max-[850px]:hidden" : ""}`}
|
|
244
|
+
>
|
|
245
|
+
<div className="text-[9px] font-medium tracking-[0.28em] text-[#dfedf2]">
|
|
246
|
+
A STUDY IN WINTER
|
|
247
|
+
</div>
|
|
248
|
+
<h1 className="mb-3 mt-3 text-[46px] font-[450] leading-[1.04] tracking-[-0.05em] max-[1100px]:text-[40px] max-[850px]:text-[32px] [@media(max-height:800px)]:mb-0 [@media(max-height:800px)]:mt-2 [@media(max-height:800px)]:text-[30px]">
|
|
249
|
+
Snow,
|
|
250
|
+
<br className="[@media(max-height:800px)]:hidden" />{" "}
|
|
251
|
+
<span className="font-light text-[#e2eef1]">in motion.</span>
|
|
252
|
+
</h1>
|
|
253
|
+
<p className="m-0 max-w-[250px] text-[12px] leading-[1.7] opacity-90 max-[850px]:hidden [@media(max-height:800px)]:hidden">
|
|
254
|
+
Fresh powder. Every step remembered. A ball that carves its own track.
|
|
255
|
+
</p>
|
|
256
|
+
</div>
|
|
257
|
+
<div className={`pointer-events-auto ${menuOpen ? "" : "max-[850px]:hidden"}`}>
|
|
258
|
+
<Controls send={send} state={state} />
|
|
259
|
+
<p className="mt-3 text-[10px] tracking-[0.05em] text-[#e2ecf0] opacity-90 [text-shadow:0_1px_5px_#264452] max-[850px]:hidden">
|
|
260
|
+
Take over at any time with WASD.
|
|
261
|
+
</p>
|
|
262
|
+
</div>
|
|
263
|
+
</section>
|
|
264
|
+
|
|
265
|
+
<div
|
|
266
|
+
className={`absolute right-[34px] top-[103px] text-right [text-shadow:0_1px_3px_rgb(10_30_40/0.55),0_0_12px_rgb(16_40_54/0.35)] max-[850px]:right-4 max-[850px]:top-[84px] ${menuOpen ? "max-[850px]:hidden" : ""}`}
|
|
267
|
+
>
|
|
268
|
+
<div className="text-[28px] font-light leading-none tabular-nums">
|
|
269
|
+
{state.windNow.toFixed(1)}
|
|
270
|
+
<small className="ml-0.5 text-[10px] opacity-80">m/s</small>
|
|
271
|
+
</div>
|
|
272
|
+
<div className="mt-2 text-[9px] font-medium tracking-[0.2em]">WIND AT SNOWFIELD</div>
|
|
273
|
+
<div className="mt-1.5 text-[9px] font-medium uppercase tracking-[0.18em] opacity-90">
|
|
274
|
+
{weatherWords}
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<aside
|
|
279
|
+
aria-label="Snow readouts"
|
|
280
|
+
className="pointer-events-auto absolute bottom-[115px] right-[31px] w-[236px] rounded-[15px] border border-line bg-panel p-4 backdrop-blur-xl max-[1100px]:w-[216px] max-[850px]:hidden"
|
|
281
|
+
>
|
|
282
|
+
<div className="mb-3 flex items-center justify-between text-[9px] tracking-[0.2em] text-[#c2d6e0]">
|
|
283
|
+
<span>LAST FOOTFALL</span>
|
|
284
|
+
<i className="h-[5px] w-[5px] rounded-full bg-aqua" />
|
|
285
|
+
</div>
|
|
286
|
+
<div className="flex items-center gap-4">
|
|
287
|
+
<Probe values={state.probe} />
|
|
288
|
+
<div className="flex flex-col gap-3">
|
|
289
|
+
<Metric label="Boot sink" unit="cm" value={(state.lastSink * 100).toFixed(1)} />
|
|
290
|
+
<Metric label="Contacts" value={state.contacts.toLocaleString("en-US")} />
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
<div className="mt-3 flex justify-between border-t border-line pt-3 text-[10px] text-[#9ebac8]">
|
|
294
|
+
<span>Ground speed</span>
|
|
295
|
+
<span className="tabular-nums text-[#d0e7e7]">{state.speed.toFixed(2)} m/s</span>
|
|
296
|
+
</div>
|
|
297
|
+
<div className="mt-4 flex items-center justify-between border-t border-line pt-3 text-[9px] tracking-[0.2em] text-[#c2d6e0]">
|
|
298
|
+
<span>BALL</span>
|
|
299
|
+
<span className="text-[10px] tracking-normal tabular-nums text-[#d0e7e7]">
|
|
300
|
+
{(state.ballSink * 100).toFixed(1)} cm · {Math.round(state.ballLoad)} N
|
|
301
|
+
</span>
|
|
302
|
+
</div>
|
|
303
|
+
<div className="mt-3">
|
|
304
|
+
<BallActions send={send} />
|
|
305
|
+
</div>
|
|
306
|
+
</aside>
|
|
307
|
+
|
|
308
|
+
<footer className="absolute bottom-[26px] left-[34px] right-[34px] flex items-center justify-between gap-4 max-[850px]:bottom-4 max-[850px]:left-4 max-[850px]:right-4">
|
|
309
|
+
<div className="min-w-[200px] text-[9px] tracking-[0.2em] text-[#e0ecf1] opacity-80 [text-shadow:0_1px_5px_#264452] max-[1100px]:invisible max-[850px]:hidden">
|
|
310
|
+
THREENATIVE <span className="text-[#b9d8de]">/</span> SNOW STUDY
|
|
311
|
+
</div>
|
|
312
|
+
<div className="flex items-center gap-4 rounded-full border border-[rgb(210_233_244/0.18)] bg-[rgb(17_35_46/0.59)] px-[18px] py-[11px] text-[11px] text-[#d8e5eb] backdrop-blur-xl max-[850px]:hidden">
|
|
313
|
+
{[
|
|
314
|
+
["W A S D", "Walk"],
|
|
315
|
+
["SHIFT", "Run"],
|
|
316
|
+
["F / G", "Ball"],
|
|
317
|
+
["B", "Blizzard"],
|
|
318
|
+
["DRAG", "Orbit"],
|
|
319
|
+
].map(([key, action]) => (
|
|
320
|
+
<span className="flex items-center gap-1.5 whitespace-nowrap" key={action}>
|
|
321
|
+
<kbd className="rounded border border-[rgb(206_232_244/0.35)] px-1 py-0.5 font-sans text-[9px] text-[#e6f1f5]">
|
|
322
|
+
{key}
|
|
323
|
+
</kbd>
|
|
324
|
+
{action}
|
|
325
|
+
</span>
|
|
326
|
+
))}
|
|
327
|
+
</div>
|
|
328
|
+
<div className="flex min-w-[150px] justify-end max-[850px]:w-full">
|
|
329
|
+
<button
|
|
330
|
+
className="pointer-events-auto flex min-h-11 items-center gap-2 rounded-[9px] border border-line bg-[rgb(20_39_50/0.75)] px-3.5 text-[11px] backdrop-blur-md transition hover:brightness-110"
|
|
331
|
+
data-tn-interactive
|
|
332
|
+
onClick={() => send("view")}
|
|
333
|
+
title="Cycle camera view (C)"
|
|
334
|
+
type="button"
|
|
335
|
+
>
|
|
336
|
+
<Icon name="camera" />
|
|
337
|
+
{VIEW_LABELS[state.view]}
|
|
338
|
+
</button>
|
|
339
|
+
</div>
|
|
340
|
+
</footer>
|
|
341
|
+
|
|
342
|
+
<Toast state={state} />
|
|
343
|
+
{helpOpen ? <Help onClose={() => setHelpOpen(false)} /> : null}
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function GameUi() {
|
|
349
|
+
return (
|
|
350
|
+
<UiLayer>
|
|
351
|
+
<Hud />
|
|
352
|
+
</UiLayer>
|
|
353
|
+
);
|
|
354
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Stroke icons drawn at 24 px; colour follows the text around them.
|
|
2
|
+
const PATHS = {
|
|
3
|
+
blizzard: "M3 8h13a3 3 0 1 0-3-3M2 12h17a3 3 0 1 1-3 3M4 17h6",
|
|
4
|
+
camera: "M3 8h4l2-3h6l2 3h4v12H3V8zM12 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
|
|
5
|
+
drop: "M12 3v12M7 10l5 5 5-5M5 20h14",
|
|
6
|
+
help: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.5 9a2.5 2.5 0 1 1 4.5 1.5c-1.4 1-2 1-2 3M12 17h.01",
|
|
7
|
+
menu: "M4 6h16M4 12h16M4 18h16",
|
|
8
|
+
muted: "M11 5L6 9H3v6h3l5 4V5zM16 9l5 6m0-6l-5 6",
|
|
9
|
+
pause: "M8 5v14M16 5v14",
|
|
10
|
+
play: "M8 5l11 7-11 7V5z",
|
|
11
|
+
push: "M4 12h12M12 7l5 5-5 5M20 5v14",
|
|
12
|
+
reset: "M3 10a9 9 0 1 1 2 8M3 4v6h6",
|
|
13
|
+
snow: "M12 3v18M4.2 7.5l15.6 9M4.2 16.5l15.6-9M9 5l3 3 3-3m-6 14l3-3 3 3",
|
|
14
|
+
sound: "M11 5L6 9H3v6h3l5 4V5zM15 8a6 6 0 0 1 0 8m3-11a10 10 0 0 1 0 14",
|
|
15
|
+
close: "M6 6l12 12M18 6L6 18",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type IconName = keyof typeof PATHS;
|
|
19
|
+
|
|
20
|
+
export function Icon({
|
|
21
|
+
name,
|
|
22
|
+
className = "h-[17px] w-[17px]",
|
|
23
|
+
}: { name: IconName; className?: string }) {
|
|
24
|
+
return (
|
|
25
|
+
<svg
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
className={`shrink-0 ${className}`}
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke="currentColor"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
strokeWidth={1.6}
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
>
|
|
35
|
+
<path d={PATHS[name]} />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The snowflake mark beside the title. */
|
|
41
|
+
export function Mark() {
|
|
42
|
+
return (
|
|
43
|
+
<svg
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
className="h-[25px] w-[25px]"
|
|
46
|
+
fill="none"
|
|
47
|
+
stroke="#f0f7f8"
|
|
48
|
+
strokeWidth={1.25}
|
|
49
|
+
viewBox="0 0 32 32"
|
|
50
|
+
>
|
|
51
|
+
<path d="M16 3v26M4.7 9.5l22.6 13M4.7 22.5l22.6-13M12 6l4 4 4-4M12 26l4-4 4 4M6 14l5-1-1-5M26 18l-5 1 1 5M6 18l5 1-1 5M26 14l-5-1 1-5" />
|
|
52
|
+
</svg>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IThreeNativeConfig } from "@threenative/core";
|
|
2
|
+
|
|
3
|
+
const config: IThreeNativeConfig = {
|
|
4
|
+
app: {
|
|
5
|
+
id: "com.threenative.__PROJECT_ID__",
|
|
6
|
+
name: "__PROJECT_NAME__",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
build: 1,
|
|
9
|
+
icon: "public/icon.png",
|
|
10
|
+
icons: { web: { favicon: "public/favicon.svg" } },
|
|
11
|
+
},
|
|
12
|
+
display: {
|
|
13
|
+
orientation: "landscape",
|
|
14
|
+
fullscreen: true,
|
|
15
|
+
keepScreenOn: true,
|
|
16
|
+
maxFps: 60,
|
|
17
|
+
},
|
|
18
|
+
window: {
|
|
19
|
+
title: "__PROJECT_NAME__",
|
|
20
|
+
width: 1280,
|
|
21
|
+
height: 720,
|
|
22
|
+
maximized: false,
|
|
23
|
+
resizable: true,
|
|
24
|
+
},
|
|
25
|
+
bootSplash: { backgroundColor: "#0c1c28" },
|
|
26
|
+
nativeEntry: "src/game.ts",
|
|
27
|
+
renderer: {
|
|
28
|
+
preferWebGPU: true,
|
|
29
|
+
resolutionScale: "auto",
|
|
30
|
+
// Multisampling resolves triangle edges. A cutout silhouette — foliage, a fence, hair — is
|
|
31
|
+
// carved inside the triangle by an alpha test, so it resolves through the coverage mask or
|
|
32
|
+
// not at all, which is what this spends the samples above on. It costs no target and no
|
|
33
|
+
// extra pass; set it false for a deliberately hard-edged look. `TN_ALPHA_ANTIALIASING`
|
|
34
|
+
// reports what it did, and says so when a single-sampled surface leaves it nothing to do.
|
|
35
|
+
alphaAntialiasing: true,
|
|
36
|
+
},
|
|
37
|
+
ui: { renderer: "web" },
|
|
38
|
+
// One asset tree, one compiler, one representation per artifact. Uncomment, then cook:
|
|
39
|
+
// threenative build --target android # cooks defaults.android; --profile <name> beats it
|
|
40
|
+
// buildProfiles: {
|
|
41
|
+
// defaults: { android: "compact" },
|
|
42
|
+
// profiles: {
|
|
43
|
+
// compact: {
|
|
44
|
+
// assets: { textures: { maxSize: 1024 }, models: { textures: { maxSize: 1024 } } },
|
|
45
|
+
// } },
|
|
46
|
+
// },
|
|
47
|
+
// Contract, byte definitions, the build report:
|
|
48
|
+
// node_modules/create-threenative/agent-docs/references/build-profiles.md
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"types": ["vite/client"],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUncheckedIndexedAccess": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"isolatedModules": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "*.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import { watchAssets } from "@threenative/assets";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import { createEngineFreshnessPlugin, createWebBrandPlugin } from "create-threenative";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
import type { Plugin } from "vite";
|
|
7
|
+
import config from "./threenative.config.js";
|
|
8
|
+
|
|
9
|
+
function assetsWatchPlugin(): Plugin {
|
|
10
|
+
return {
|
|
11
|
+
name: "threenative-assets-watch",
|
|
12
|
+
apply: "serve",
|
|
13
|
+
async configureServer(server) {
|
|
14
|
+
const handle = watchAssets({ config: config.assets, cwd: server.config.root });
|
|
15
|
+
server.httpServer?.once("close", () => handle.close());
|
|
16
|
+
// Nothing is served before the first cook settles: until it does, `public/` has no
|
|
17
|
+
// `assets.manifest.json` and every asset answers from its source fallback.
|
|
18
|
+
await handle.ready;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
plugins: [
|
|
25
|
+
createEngineFreshnessPlugin(),
|
|
26
|
+
createWebBrandPlugin(),
|
|
27
|
+
react(),
|
|
28
|
+
tailwindcss(),
|
|
29
|
+
assetsWatchPlugin(),
|
|
30
|
+
],
|
|
31
|
+
server: {
|
|
32
|
+
watch: {
|
|
33
|
+
ignored: ["**/artifacts/**", "**/screenshots/**", "**/playtests/**"],
|
|
34
|
+
usePolling: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|