Aluode commited on
Commit
dec6e30
·
verified ·
1 Parent(s): 9a05ab0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +152 -6
README.md CHANGED
@@ -1,12 +1,158 @@
1
  ---
2
- title: AnttisBrain
3
- emoji: 🐨
4
  colorFrom: gray
5
- colorTo: red
6
  sdk: static
7
  pinned: false
8
- license: mit
9
- short_description: 'A odd chill game. Takes forever to start. '
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Antti's Brain Descent
3
+ emoji: 🌌
4
  colorFrom: gray
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ short_description: Infinite procedural key-hunt in a WebGL2 labyrinth.
 
9
  ---
10
 
11
+ # ANTTI'S BRAIN DESCENT
12
+
13
+ An infinite procedural key-hunt built on the Antti's Brain 2 engine (WebGL2 raymarcher,
14
+ hash-dreamed chambers, refracting crystal moons, webcam boundary). One HTML file, no
15
+ dependencies, no build step. No enemies, no timers, no hand-made levels — only geometry,
16
+ depth, and the hash.
17
+
18
+ > Do not hype. Do not lie. Just show.
19
+
20
+ ## The game
21
+
22
+ - The brain is an endless chain of chambers, a pure function of `(SEED, room index)`.
23
+ - **A level is a run of rooms**: level 1 is 4 rooms, level 2 is 5, … capped at 10 per level.
24
+ - Somewhere in the level, **one crystal is the key**: it is gold and it pulses. Touch it.
25
+ - The corridor after the level's last room is closed by a **red seal** — a glowing
26
+ membrane you cannot pass. Touch the key and the seal dissolves. Walk through: next level.
27
+ - The **resonance meter** in the HUD is your only guide: it tells you how many rooms away
28
+ the key is, and once you're in the right room it runs hot with live distance. Hot / cold,
29
+ nothing more.
30
+
31
+ There is no way to lose. There is only further down.
32
+
33
+ ## What deepens with the level
34
+
35
+ Everything below is still deterministic — same seed, same descent.
36
+
37
+ | property | how it grows |
38
+ |---|---|
39
+ | level length | 4 rooms → 10 rooms (cap) |
40
+ | shape pool | 6 shapes at level 1, +1 new shape per level, 12 total by level 7 |
41
+ | **twist** | rooms shear around their vertical axis, stronger with depth |
42
+ | ripple | from level 3, walls start to breathe with a triple-sine displacement |
43
+ | **mass** | each room has its own mass factor (shown in HUD); moons grow heavier, lensing pulls harder |
44
+ | moons per room | 3 → 5 |
45
+
46
+ The twelve chamber shapes, in unlock order:
47
+
48
+ 1. cube · 2. sphere · 3. hex prism · 4. star (5–7 points) · 5. octahedron · 6. cylinder —
49
+ the classics —
50
+ then 7. **capsule vault** · 8. **cut crystal** (box ∩ octahedron) · 9. **ellipsoid dome** ·
51
+ 10. **cross cathedral** · 11. **gear** (cog-rippled cylinder) · 12. **wheel** (walkable
52
+ torus + hub + four spokes).
53
+
54
+ The moons wear their room's shape, rounded into optical glass, so new room shapes mean
55
+ new crystal shapes too. Twist applies on top of any shape, so a twisted star at level 6
56
+ and a twisted gear at level 9 are genuinely different rooms even with the same base index
57
+ math.
58
+
59
+ ## Controls
60
+
61
+ - **W A S D** — move · **Q / E** — down / up · **Shift** — boost
62
+ - **drag** — look (horizontal inverted, as tradition demands)
63
+ - Modes: **Boundary** (walls are your camera) / **Projection** (moons carry the image) /
64
+ **Cascade** (heavy refracting glass)
65
+ - Sliders: mass gain, lensing strength, music volume
66
+ - **Music: on/off** — toggles the soundtrack
67
+ - **New brain** — fresh seed, back to level 1
68
+
69
+ ## Music
70
+
71
+ Put `game1.mp3` … `game10.mp3` next to the HTML file. They play as an endless
72
+ playlist: a random track starts on your first click (browsers require a gesture
73
+ before audio), then they chain forever — when one ends the next begins, wrapping
74
+ around after `game10.mp3`. Missing files are skipped automatically; if none of
75
+ the ten are found the HUD says `no mp3s found` and the game plays silent.
76
+ Volume slider in the control panel; the Music button pauses/resumes.
77
+
78
+ ## Save / load
79
+
80
+ The entire game state is six numbers: `{version, seed, level, room index, key flag,
81
+ max level reached}`. Everything else is re-dreamed from the hash on load, including the
82
+ key's location and the walk direction of the chain (reconstructed by replaying the turn
83
+ angles — verified bit-exact).
84
+
85
+ - **Save** — writes to localStorage (when the browser allows it) and keeps a code ready.
86
+ - **Save code** — prints the save as a short base64 string and copies it to the clipboard.
87
+ This works everywhere, including `file://` pages and sandboxes where localStorage is
88
+ blocked. Paste it into a text file, an email, a commit message.
89
+ - **Load** — reads the local save, or accepts a pasted code.
90
+ - The game **autosaves** on every level-up and key pickup, and silently resumes on launch
91
+ if a local save exists.
92
+
93
+ Walking backward is always allowed. Levels you have already beaten stay open (the game
94
+ remembers your max level, so re-crossing an old seal never re-locks it), but the current
95
+ level's key must be found each fresh descent into new territory.
96
+
97
+ ## How the infinity works
98
+
99
+ Same principle as Brain 2, extended:
100
+
101
+ - `rng(index, salt)` — an integer hash (multiply/xor/shift mix of `SEED`, index, salt).
102
+ Any room at any depth can be queried in O(1) without generating the rooms before it.
103
+ - `roomDef(i)` now first computes which level room `i` belongs to (cumulative level
104
+ depths are a closed-form loop), then draws shape / size / twist / ripple / mass / turn /
105
+ name from independent salts, with the level scaling the ranges.
106
+ - Per level, a second hash stream `rngL(level, salt)` places the key room. The key is
107
+ always moon 0 of that room, so it can never be hidden by settings.
108
+ - Only 3 rooms exist at a time (prev / current / next). The seal is a single sphere SDF
109
+ in the exit corridor, present only while the key is unfound and you are in the exit room —
110
+ blocked in the JS collision twin and rendered as a pulsing membrane in the shader.
111
+
112
+ ## Technical notes
113
+
114
+ - Single fragment shader, one fullscreen triangle, raymarched SDFs with real Snell
115
+ refraction + total internal reflection through the moons and Beer–Lambert tinting.
116
+ - Rooms and moons share one 12-way shape function; moons are derived from it via
117
+ const scale/rounding tables, which roughly halves the shader the driver must
118
+ compile. Well loops use dynamic bounds so ANGLE doesn't unroll them 15-wide.
119
+ - Shader compilation is deferred until after first paint and uses
120
+ KHR_parallel_shader_compile when available, with a shimmer bar and elapsed
121
+ timer on the boot screen. Loop bounds (march steps, glass-refraction steps,
122
+ wall-escape steps) are uniforms, which blocks driver loop unrolling — the
123
+ main cause of minutes-long first compiles on Windows.
124
+ - The wheel room's four spokes fold to two by symmetry (|x|,|z|), an exact
125
+ identity that trims the hottest SDF.
126
+ - The key crystal orbits wide (up to ~0.34 × room size off the center line) with a
127
+ tight pickup radius, so finding the key room via resonance is only half the hunt.
128
+ - Twist and ripple are applied as domain modifications with a Lipschitz correction
129
+ factor on the returned distance, so marching stays conservative and never tunnels.
130
+ - Every SDF has a JavaScript twin used for collision and gate transitions; the twelve
131
+ room shapes were tested to guarantee the room center is deep interior (transition
132
+ trigger fires at −1.0), so no shape can ever strand you in a wall.
133
+ - Webcam feeds the boundary texture; falls back to an animated test pattern.
134
+ - WebGL2 required.
135
+
136
+ ## Running
137
+
138
+ Open `anttis-brain-descent.html` in any WebGL2 browser, with the mp3s in the
139
+ same folder. Allow the camera if you want the walls to be you; decline and the
140
+ pattern takes over.
141
+
142
+ ## First launch and the "dreaming the shader" bar
143
+
144
+ The boot screen reports its state. `dreaming the shader…` means the GPU driver
145
+ is compiling; an amber shimmer bar and a live seconds counter run while it does
146
+ (compile progress isn't queryable from WebGL, so the counter is honest elapsed
147
+ time rather than a fake percentage). This happens on the FIRST launch only —
148
+ the driver caches the compiled shader on disk, so later launches are near
149
+ instant.
150
+
151
+ It should now be fast even the first time: all raymarch loop bounds are passed
152
+ as uniforms, so the D3D/ANGLE compiler cannot unroll the 180-step march and is
153
+ forced to compile the loop body once instead of 180 times. That, not the shape
154
+ count, was the compile-time bomb — all twelve chamber shapes stay.
155
+
156
+ `ready — click to enter` means go. Any JavaScript or shader error paints itself
157
+ on the boot screen in red with the actual message — send that text and it can
158
+ be fixed.