summaryrefslogtreecommitdiff
path: root/platformer/game_feel.md
diff options
context:
space:
mode:
Diffstat (limited to 'platformer/game_feel.md')
-rw-r--r--platformer/game_feel.md118
1 files changed, 115 insertions, 3 deletions
diff --git a/platformer/game_feel.md b/platformer/game_feel.md
index 6fc4a2e..616e649 100644
--- a/platformer/game_feel.md
+++ b/platformer/game_feel.md
@@ -114,14 +114,46 @@ and eased, not snappier.
(19.66 m/s): a full retreat jump reaches **4.67 m** (2.00× the first jump, the highest jump), with
59 ticks of airtime and about 3.9 m of travel; a tap gives about 1.4 m. `retreating_movement` stays
on through the jump and turns off on landing. Landing it **does** open the second-jump window
- (`heightened_movement`, 0.2 s), so skid → retreat jump → second jump chains.
+ (`heightened_movement`, 0.2 s), so skid → retreat jump → second jump chains. `heightened_movement` is
+ also on for the whole retreat jump, so it can grab a wall.
+- **`heightened_movement` rules, all in one place.** It turns on when landing a normal or retreat jump
+ (a 0.2 s window that only counts down while not in a jump), and during a second jump, retreat
+ jump, wall hang, or **any** wall jump (early or late). It turns off when the window runs out, when
+ landing a second jump or plain fall, or when a wall hang runs out. On the ground it means "A
+ gives the second jump"; in the air it means "can wall hang".
+- **The wall hang (`WALL_HANG`).** Grabbing a wall needs all of these: `heightened_movement` is on,
+ the player is in the air (JUMP or FALL), they hit the side of a box with `allows_wall_hang`, and
+ they came in within 45° of head-on (`PLAYER_WALL_HANG_ANGLE_DEG`). A 50° hit slides along the wall
+ as usual. On grabbing, the player **turns to face where the wall jump will launch** (the
+ mirrored direction below, so the nose previews the jump), stops, and slides down with gravity off:
+ `vel.y = −min(3 m/s² × t, 2 m/s)` (`PLAYER_WALL_SLIDE_ACCEL`, `PLAYER_WALL_SLIDE_MAX_SPEED`). That's
+ 0.45 / 0.90 / 1.35 / 1.50 m/s at 0.15 / 0.30 / 0.45 / 0.50 s, and about 0.4 m of slide over the
+ whole hang. (The 2 m/s cap is only reached if the hang lasts past 0.67 s.) After
+ `PLAYER_WALL_HANG_DURATION` (0.5 s, 30 ticks) the player lets go: they drop
+ straight down at normal gravity, with `heightened_movement` off so they can't grab again before
+ landing. Sliding onto a floor is an ordinary landing, and sliding past the wall's bottom or end
+ lets go early.
+- **The wall jump.** A during the hang jumps along the approach direction **mirrored off the wall**:
+ the part along the wall is kept and the part into it flips, so coming in 5° from the left leaves 5°
+ to the right (measured: 175° in → 5° out, 210° in → −30° out). In the first 0.1 s of the hang
+ (`PLAYER_WALL_JUMP_EARLY_TIME`, 6 ticks) it's a **second jump**: 4.08 m up, launched at 5 m/s.
+ After that it's a **normal jump**: 2.33 m up, launched at 6 m/s, and landing it opens the usual
+ 0.2 s window. **Both keep `heightened_movement` on for the whole jump**, so any wall jump can grab
+ the next wall. (At first the late one turned it off, and players found wall jumps that
+ wouldn't grab the next wall.) Each
+ takes on everything about its jump kind (top speed in the air, the variable-height cut, what
+ landing does). **One wall can't be grabbed twice in a row:** the wall *surface* you jumped off (same
+ facing, same face position) is locked out until you land, so holding toward it can't climb it
+ forever. Comparing surfaces rather than boxes matters on the cliff, which is built from side-by-side
+ strips: zigzagging along one face can't climb it. Two walls facing each
+ other can still be chained: in the chimney, each early wall jump gains 3.3 m and crosses in 39 ticks.
- **`heightened_movement` and `retreating_movement` are named player states on purpose.** They're
- fields on `Player`, separate from the IDLE/RUN/SKID/JUMP/FALL action, because later moves are meant
+ fields on `Player`, separate from the IDLE/RUN/SKID/JUMP/FALL/WALL_HANG action, because later moves are meant
to key off them. Which jump the player is in is `jump_kind` (`JUMP_NORMAL`, `JUMP_SECOND`,
`JUMP_RETREAT`); the jumps share the `JUMP` action. The title bar
shows `| heightened` / `| retreating` while they're on (the title refreshes every 0.25 s, so the
0.2 s window may blink briefly or not show at all; the jumps themselves always show
- it). The skid also shows as `SKID` in the state slot.
+ it). The skid and wall hang also show as `SKID` / `WALL_HANG` in the state slot.
- **SM64-style circling is intentional.** Controls stay purely camera-relative even while the camera
swings on its own, so holding the stick sideways during a camera swing makes the player run a
wide arc (about 12 m radius, 24 m across, at 6 m/s). The user explicitly chose this over locking the stick direction.
@@ -210,6 +242,72 @@ New automatic camera behaviors should follow the same approach: slow, eased, and
- **The level is a test space**, like SM64's pre-level sandbox: flat ground plus 40 seeded-random box
platforms (`WORLD_SEED`, so every run is the same layout). Spawn is kept clear (4 m).
+- **Wall hanging is opt-in per box.** `Box.allows_wall_hang` is false by default. The level marks
+ **big terrain surfaces** (cliffs, rock pillars, the wall course's walls) and never small platforms, so
+ ordinary platforming never gets sticky. Hangable walls are drawn **violet** (`COLOR_WALL_HANG`), and
+ hangable rock is **violet-tinted rock** (`COLOR_CLIFF_HANG`), so you can tell at a glance.
+- **Level content lives in `level.c`; `world.c` only stores it, moves it, and answers queries.**
+- **The wall course** (`WALL_COURSE` in `level.c`) is straight ahead of the starting camera, 33–48 m
+ toward −Z and clear of the random platforms. It has a 12 × 8 m main wall (hangable, facing spawn), a
+ chimney (two 10 m hangable walls with a 4 m gap, entered from the end facing spawn), a 1.5 m step
+ block in front of the main wall, a ledge on the main wall at 4–4.5 m (x −2..1), a slab at 5.5–6 m
+ off the wall's left end, and an 8 m terracotta pillar that is *not* hangable, for comparison. The
+ layout is a first guess for tuning. Note the ledge: jumping into the main wall right under it hits
+ the ledge's side first, which isn't hangable.
+- **The cliff course** (`level.c`, seeded from `CLIFF_COURSE_SEED`) is **behind** spawn (+Z, so turn
+ around). It's meant for **expression, not a skill check**: a scatter of platforms you read and
+ choose a way through, some moving, some leading nowhere, some that look possible and aren't.
+ - **The cliff** is a right triangle, 55 m tall. The south face (z = 40, facing spawn, x −30..20) and
+ the east face (x = 20, z 40..90) meet at the south-east corner. The third side faces north-west,
+ built as 10 strips stepping down the diagonal. **The cliff is hangable** (violet-tinted rock), and
+ so are 7 tall rock pillars 3.5–5 m out from the faces, which form random chimneys with it. The rule
+ is that big terrain surfaces are hangable and small platforms aren't.
+ - **How it's generated:** a band wraps the cliff (along the south face, around the corner, up the
+ east face). Each row out from the face turns the corner at its own spot, so distance along the
+ band is continuous. On it:
+ 1. One hidden **route** from the ground to one hop below the top, made of **big platforms (3–4.5
+ m)**, because the player's weight makes small ledges skid-offs. Each step is a comfortable
+ normal-jump rise (0.9–1.7 m) or second-jump rise (2–2.9 m), with the path between the two
+ platforms checked clear (no pillar or platform in the way). About a third of the steps are
+ **switchbacks**, hopping out to the next row or back in instead of along, so the route climbs
+ without running off the end of the face. Hops in toward the hangable face are always normal
+ jumps, because a second jump's overshoot would grab the face instead of landing. The route
+ stays beside the faces and drifts in for its last hop. When boxed in, it tries easier hops,
+ then a scan of nearby spots.
+ 2. A **scatter** of 5 more platforms (mostly moving) for branches and dead ends.
+ 3. **The crossing:** a route on the line from the top's north-west corner over the river to the
+ far cliff (60 m, hangable, the finish), plus 2 extras.
+
+ In total that's **about 37 platforms** (the user asked for 30–40, down from ~135), 8 of them moving.
+ - **Moving platforms:** each slides back and forth along the band, bobs up and down, or loops a
+ flat or upright circle, with its own 3.5–7 s period and phase (`BoxMotion` in `level.h`). Every
+ motion passes through its placed position each cycle, and no two moving route platforms are in a
+ row, so waiting always works. They keep 1.0 m from rock (more than the player is wide, so they
+ can't pin you) and stay 1 m above the ground. The finish **needs** at least one of them.
+ - **Placement rules:** nothing overlaps. Platforms nearly over one another (within 0.3 m sideways)
+ are 4.3 m apart vertically, so none blocks a jump from another.
+ - **Verified by a headless course test** (outside the repo). It builds a reachability graph with a
+ conservative jump model, sampling the moving platforms over 60 s. The bot then plays every
+ plausible upward hop between still platforms and drops the ones that fail (35 played, 1 failed).
+ The top and the finish are reachable. With one route and ~37 platforms, most route platforms are
+ the only way past their spot in the graph. The graph doesn't count wall hangs, though, and the
+ hangable cliff and pillar chimneys offer other ways up. **The user asked for ambiguity:** jumps
+ that fail or dead ends are fine, as long as the course as a whole can be finished. Don't tighten
+ it into a clean, obvious path.
+ - **A snag to know about:** a *second* jump straight at the hangable cliff from a ledge just below
+ the lip grabs the face instead of clearing the top, because `heightened_movement` is on. Topping
+ out works with a normal jump (wait out the 0.2 s window). The generator's hops in toward the face
+ are normal jumps for the same reason. A ledge-climb or "clear the lip" rule is a candidate for later.
+ - **The river** is 13 overlapping water tiles (`BOX_STYLE_WATER`, a solid 5 cm sheet, no swimming)
+ along the diagonal, parallel to the third side.
+ - **Known rough edges:** there's no camera collision, so the camera passes into the cliff and
+ through platforms (it's even more noticeable here). A fall from the top is a 55 m drop with no
+ damage, and Back resets. Jumping off a moving platform doesn't keep its momentum (SM64 mostly
+ doesn't either). Changing the seed gives a new climb; re-run the course test if you do, or after
+ changing movement numbers.
+- **Box styles** (`Box.style`: `BOX_STYLE_PLATFORM` by default, `CLIFF`, `WATER`) only change color
+ in `render.c`; collision ignores them. Every box literal spells out all four fields, since the
+ build warns on missing initializers.
- **Heights are sized to the jump:** ground blocks top out at 2.0 m (below the 2.33 m jump); floating
slabs sit at 2.6–4.2 m, reached by jumping from a block. The 4.08 m second jump can reach 14 of
the 16 slabs straight from the ground; the two with tops at 4.11 m and 4.17 m still need a block. Only 9 of 16 floating slabs have a block close
@@ -222,6 +320,13 @@ New automatic camera behaviors should follow the same approach: slow, eased, and
- The floor check uses the height *before* the move, so even a terminal-velocity fall can't tunnel
through a 0.5 m slab.
- Jumping into an underside bonks.
+ - Every push out of a box's side sets `Body.hit_wall`, the side's `wall_normal` and its `wall` box.
+ That's how the wall hang knows what it touched. `Body.gravity_scale` (normally 1) lets the
+ player switch gravity off while it drives its own wall slide.
+ - **Moving platforms carry you.** `main.c` calls `world_update` before the player each tick. Physics
+ first moves a body by however far its `ground_box` moved (so you ride up, down, sideways and round
+ loops: 0 fall-offs and 4 cm of drift over 16 s on every moving platform). Then it steps the body out
+ of any box that moved into it, along the shortest way. Still boxes never trigger the step-out.
- **Readability is part of feel.** With no lighting, a one-color box is a flat silhouette and jumps
become guesswork. Platforms use a **fixed brightness per face** (tops brightest). The **drop shadow**
sits on whatever surface you'd land on and is the main depth cue, as in SM64. Keep both if you
@@ -275,6 +380,13 @@ New automatic camera behaviors should follow the same approach: slow, eased, and
| Second jump window | 0.5 s → 0.3 s → 0.2 s after landing | 0.2 s |
| Second jump from | normal jump landings → also retreat jump landings | both |
| Normal jump top speed | 6 m/s (run speed) → 7 m/s, built at 1.5 m/s², eased back at 2 m/s² after landing | 7 m/s |
+| Retreat jump | + `heightened_movement` for the whole jump (it can wall hang) | on |
+| Wall hang | added: 45° grab, 0.75 s, slide 3 m/s² capped at 2 m/s, mirrored wall jump (second-jump-like for 0.1 s, then normal) | — |
+| Wall hang duration | 0.75 s → 0.5 s (early wall jump window kept at 0.1 s) | 0.5 s |
+| Cliff course | hand-placed single path → generated (2 routes + ~135 platforms) → 1 route + extras, ~37 big platforms (3–4.5 m), hangable rock, moving platforms | seed 20260930 |
+| Wall lockout | per box → per wall surface (the cliff is several boxes) | surface |
+| Late wall jump heightened | off → on (late wall jumps couldn't grab the next wall) | on |
+| Facing while wall hanging | into the wall → the wall jump's launch direction (a visual preview) | launch dir |
| Second jump top speed | 6 m/s (same as running) → 4 → 5 m/s until it lands (4 felt a tad harsh) | 5 m/s |
| Second jump slowdown | air accel 9 m/s² (0.25 s, "wall of syrup") → own rate 3.5 m/s² (0.60 s) | 3.5 m/s² |
| Skid | none (full-speed U-turn) → 18 m/s² even braking, turn at the end (0.33 s) → face the stick at once, glide-then-plant curve (power 2) | 0.5 s |