diff options
Diffstat (limited to 'platformer')
| -rw-r--r-- | platformer/README.md | 4 | ||||
| -rw-r--r-- | platformer/game_feel.md | 98 | ||||
| -rw-r--r-- | platformer/movement_feedback_1.md | 142 | ||||
| -rw-r--r-- | platformer/src/config.h | 12 | ||||
| -rw-r--r-- | platformer/src/level.c | 465 | ||||
| -rw-r--r-- | platformer/src/player.c | 71 | ||||
| -rw-r--r-- | platformer/src/player.h | 9 |
7 files changed, 538 insertions, 263 deletions
diff --git a/platformer/README.md b/platformer/README.md index 570a105..9adbe7b 100644 --- a/platformer/README.md +++ b/platformer/README.md @@ -93,9 +93,9 @@ The game is designed for a gamepad (Xbox-style layout names; GLFW maps other pad | Left stick | move (tilt amount = speed, relative to the camera) | | Right stick | orbit camera (around the player; their spot on screen is kept) | | Right stick click | recenter: swing the camera behind the player, centered | -| A (south button) | jump (hold longer to jump higher); press again within 0.2 s of landing for a second jump 1.75× as high | +| A (south button) | jump (hold longer to jump higher); press again within 0.2 s of landing for a second jump 1.75× as high (a press up to 0.1 s early counts) | | Left stick pulled back at full run | skid; press A during the skid for a retreat jump (2× height, toward the stick; landing it also opens the second-jump window) | -| Jump into a violet wall (second jump, retreat jump) | wall hang: cling for 0.5 s sliding slowly down; A jumps off, mirrored away from the wall | +| Jump into a violet wall (second, retreat or wall jump) | wall hang: cling for 0.5 s sliding slowly down; A jumps off, mirrored away from the wall | | Back / Select | reset player to spawn | | Start | quit | diff --git a/platformer/game_feel.md b/platformer/game_feel.md index 616e649..7cd1217 100644 --- a/platformer/game_feel.md +++ b/platformer/game_feel.md @@ -48,8 +48,8 @@ and eased, not snappier. - **Camera-relative controls.** Stick up = away from the camera. - **The character is heavy.** Starts build up and stops skid: the player should feel like a real, tangible object, but never like they're on ice. From rest, full tilt reaches top speed in 43 ticks - (0.72 s, `PLAYER_GROUND_ACCEL` 8.4 m/s²). Releasing the stick at full speed skids to a stop in 32 ticks - (0.53 s, 1.54 m, `PLAYER_GROUND_FRICTION` 11.3 m/s²). Heaviness is felt as *time*, so if you change + (0.72 s, `PLAYER_GROUND_ACCEL` 8.4 m/s²). Releasing the stick at full speed skids to a stop in 31 ticks + (0.52 s, 1.45 m, `PLAYER_GROUND_FRICTION` 12.0 m/s²). Heaviness is felt as *time*, so if you change `PLAYER_MAX_SPEED`, rescale accel and friction to keep these times (at a lower top speed, the same accel reaches it sooner and feels snappier). - **Turning is quick but not instant while moving** (`PLAYER_TURN_RATE` 12 rad/s, about 0.26 s for 180°). @@ -68,6 +68,12 @@ and eased, not snappier. is the continuous-physics figure) and a tap gives about 0.72 m. Level geometry is sized against 2.33 m. - **A jump pressed on the landing tick is never lost.** The FALL state hands off to the ground logic on the same tick it detects landing. +- **Jump buffer: an early press still counts.** An A press is remembered for `PLAYER_JUMP_BUFFER` + (0.1 s), and the first moment within that time a jump is possible, it happens. On the ground + that's instant. Pressed while still falling, it fires on the landing tick: presses up to 6 ticks + (0.10 s) early give the second jump, and 7 or more give nothing. Pressed just before grabbing a + wall, it fires as an early wall jump the moment you grab. Holding A still decides hop vs. full + jump. **Why:** players pressed a hair early while falling and lost the second jump. - **A normal jump rewards a full run with a little extra speed.** In a normal jump the top speed is `PLAYER_JUMP_MAX_SPEED` (7 m/s). Up to run speed (6 m/s × stick) the air accelerates as usual; past it, only at `PLAYER_JUMP_BOOST_ACCEL` (1.5 m/s²), so a full jump from a full run builds evenly: @@ -95,7 +101,7 @@ and eased, not snappier. in `player.c` reads it. Walking off an edge and landing also turns it off. A press on the landing tick already counts. - **The skid (SM64's turnaround skid).** At full run and above (at least 95% of `PLAYER_MAX_SPEED`, - `PLAYER_SKID_SPEED_FRACTION`, so faster future moves count too), pulling the stick more than 120° + `PLAYER_SKID_SPEED_FRACTION`, so faster future moves count too), pulling the stick more than 130° (`PLAYER_SKID_ANGLE_DEG`) off the run direction enters the `SKID` state. The player **faces the stick at once** (and keeps tracking it) while still sliding the old way (`skid_yaw`), so they're turned around and sliding backward. There's no steering. The skid always lasts `PLAYER_SKID_DURATION` (0.5 s, 30 ticks) @@ -116,15 +122,21 @@ and eased, not snappier. 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` 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 +- **`heightened_movement` rules, all in one place.** It's on during the second jump, retreat jump, + every wall jump and every wall hang, and for a 0.2 s window after landing a normal or retreat jump + (the window only counts down while not in a jump). It is **not** on during a plain first jump, so a + single jump can't grab a wall. **We tried it the other way:** players expected to wall hang off one + jump, but it made wall hangs too strong, so it was reverted. 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 + they came in within 45° of head-on (`PLAYER_WALL_HANG_ANGLE_DEG`), **and** their jump wouldn't + carry their feet over the wall's top anyway (apex = y + vy²/2g below the top). A 50° hit slides + along the wall as usual. The **clear-the-top rule** means hopping onto a ledge from just below its + lip with a heightened jump lands on top instead of grabbing the face. It was added when every jump + could grab and kept after the revert, since it also stops second jumps snagging on lips. Measured + with a heightened jump: 1.2 m under the cliff's lip lands on top, while 10 m lower grabs the face. 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 @@ -240,6 +252,16 @@ New automatic camera behaviors should follow the same approach: slow, eased, and ## Level and collision +> **Platform size rule: platforms are ~5 m across at minimum.** Only the most extreme challenges +> (or secrets) go smaller. **Why:** the player is heavy. Starts build up, stops skid for half a +> second, and a normal jump lands with momentum. At this size or larger, the player feels they have +> **space**: room to land, skid and line up the next jump, without a small ledge turning every +> landing into a fall. Apply it to anything new, hand-placed or generated. A smaller platform is a +> deliberate choice that should read as a special challenge, never a default. +> (Right now the cliff course generator uses 4–6 m, `ROUTE_MIN_SIZE` / `ROUTE_MAX_SIZE` in +> `level.c`; its minimum should move up to ~5 m to follow this rule. The random test platforms +> around spawn, 2–6 m, predate the rule.) + - **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 @@ -260,25 +282,33 @@ New automatic camera behaviors should follow the same approach: slow, eased, and - **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. + so are 7 tall rock pillars 4–6 m out from the faces, which form random chimneys with it. The pillars + are placed after the route and never block one of its hops. The rule is that big terrain surfaces + are hangable and small platforms aren't. + - **Height tiers:** every still platform's top sits on a **1.5 m grid** measured down from the cliff + top (`TIER_HEIGHT`). One tier up is a single jump and two tiers up is a double (second) jump, so + which one a gap needs reads at a glance. - **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. + 1. One hidden **route** from the ground to one tier below the top, made of **big platforms (4–6 + m)**, because the player's weight makes small ledges skid-offs. The platforms sit **1.5–13 m out + from the face** (not hugging it; only the last few come in, for the hop onto the top). Steps + are **mostly singles (+1.5 m)**, with doubles (+3.0 m) mixed in as needed and **never two + doubles in a row**. Measured on the current seed: 19 singles, 8 doubles, 1 level step, 0 + back-to-back doubles. The path between each pair is checked clear. A step either goes along + the band or **switches rows** (out a row, or back in, at the same spot along the face). It + switches more when it's ahead of schedule, so it arrives (`ROUTE_ARRIVE_BY`) without running + off the face. Hops in toward the face are singles. When stuck, it tries easier hops, then a + scan of nearby spots. + 2. A **scatter** of 6 platforms, each a **single hop beside a route platform**, level with it or + one tier up or down. They're branches, shortcuts and dead ends, mostly reachable with one jump. + 3. **The crossing:** a tiered route (mostly up or level, never two doubles in a row) from the + top's north-west corner over the river to the **far cliff, 58 m** (two tiers above the top, + hangable, the finish), plus 2 extras beside it. + + In total that's **39 platforms** (the user asked for 30–40), 7 of them moving. Climb platforms + average 6.2 m from the cliff face. - **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 @@ -288,16 +318,15 @@ New automatic camera behaviors should follow the same approach: slow, eased, and 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 + plausible upward hop between still platforms and drops the ones that fail (30 played, 0 failed). + The top and the finish are reachable. With one route and ~39 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. + - **Topping out:** the route's last hop is a single jump (no wall grab). With a second jump, the + clear-the-top rule lands you on top instead of grabbing the face. The generator's hops in toward + the face are singles, so they can't grab the face on an overshoot. - **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 @@ -374,7 +403,7 @@ New automatic camera behaviors should follow the same approach: slow, eased, and | Right-stick snap | none → 15° → 10° → 5° → back to 15° | 15° | | Top run speed | 9 → 7 → 5 → 6 m/s (slower on purpose; later moves add speed) | 6 m/s | | Ground accel | 30 → 12 → 7 → 8.4 m/s² (0.30 → 0.60 → 0.72 s to top speed; the last step kept 0.72 s at 6 m/s) | 8.4 m/s² | -| Ground friction | 40 → 16 → 9.5 → 11.3 m/s² (0.23 → 0.45 → 0.53 s stop; the last step kept 0.53 s at 6 m/s) | 11.3 m/s² | +| Ground friction | 40 → 16 → 9.5 → 11.3 → 12.0 m/s² (0.23 → 0.45 → 0.53 → 0.52 s stop; 11.3 kept 0.53 s at 6 m/s, then a hair quicker) | 12.0 m/s² | | Air accel | 30% of ground accel → its own constant, value kept | 9 m/s² | | Second jump height | 2× (19.66 m/s) → 1.75× (18.41 m/s), sets `heightened_movement` | 18.41 m/s | | Second jump window | 0.5 s → 0.3 s → 0.2 s after landing | 0.2 s | @@ -387,6 +416,11 @@ New automatic camera behaviors should follow the same approach: slow, eased, and | 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 | +| Jump buffer | none → 0.1 s (early presses fire on landing / grab) | 0.1 s | +| First jump heightened | off → on (a single jump can wall hang), plus the clear-the-top rule | (reverted below) | +| Skid pull-back angle | 120° → 130° (must pull more squarely back) | 130° | +| First jump heightened (revert) | on → off again (wall hangs off one jump were too strong); clear-the-top rule kept | off | +| Cliff course platforms | 3–4.5 m → 4–6 m, 1.5–13 m out from the face, heights on a 1.5 m tier grid, no back-to-back doubles, far cliff 60 → 58 m | 39 | | 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 | diff --git a/platformer/movement_feedback_1.md b/platformer/movement_feedback_1.md new file mode 100644 index 0000000..672218b --- /dev/null +++ b/platformer/movement_feedback_1.md @@ -0,0 +1,142 @@ +# Movement feedback, round 1 + +The first round of playtest feedback on movement, and the changes we made in response. The numbers +here are as of this round. `src/config.h` is the source of truth, and `game_feel.md` holds the full +feel guide and tuning history. + +--- + +## What players reported + +1. **The second jump's timing was too hard.** Players pressed A a hair early, while still falling, + and the press was lost: no jump happened on landing, so the second-jump window slipped by. +2. **Players expected to wall hang on a single jump.** Only the second jump, retreat jump and wall + jumps could grab walls, so running at a wall and jumping once did nothing. + +Two smaller requests came with them: + +3. Stopping should be very slightly quicker when the stick is released. The skid stays as it is. +4. Starting a skid (`retreating_movement`) should need a slightly more deliberate pull-back. + +--- + +## What changed + +### 1. A 0.1 s jump buffer (the second-jump timing) + +An A press is now remembered for `PLAYER_JUMP_BUFFER` (0.1 s). The first moment a jump is possible +within that time, it happens. + +- **On the ground** it's instant, just as before. +- **Pressed while falling**, it fires on the landing tick. A press up to 6 ticks (0.10 s) before + landing still gets the second jump; 7 or more ticks early still does nothing. +- **Pressed just before grabbing a wall**, it fires an early wall jump the moment you grab. +- Holding A still decides hop vs. full jump. A buffered press that was already released gives a hop. + +Implementation: `Player.jump_buffer`, set in `player_update` on `jump_pressed` and counted down each +tick. Jumps start through `take_jump()`, which spends the buffer, in the ground, skid and wall-hang +states. + +### 2. Every jump can wall hang + +`heightened_movement` now turns on when **any** jump starts, including a plain first jump, and lasts +the whole jump. Landing still opens the usual 0.2 s second-jump window. A single jump into a violet +wall now grabs it. + +**A knock-on fix: the clear-the-top rule.** Once every jump could grab, hopping onto a ledge from just +below its lip would grab the wall face instead of landing on top. That's especially bad on the +hangable cliff. So now you don't grab a wall whose top your jump will carry you over anyway +(`would_clear_top()`: apex = y + vy² / 2g, compared with the wall's top). + +- A normal jump at the cliff from 1.2 m under its lip → lands on top. +- The same jump 10 m below the lip → grabs the face. + +This also fixed an older snag, where a second jump from just under the cliff lip grabbed the face. +To go back to strict "always grab", remove the one condition in `wants_wall_hang()`. + +### 3. A slightly quicker stop + +`PLAYER_GROUND_FRICTION`: 11.3 → **12.0** m/s² (about 6%). + +| From full speed (6 m/s) | Before | After | +|---|---|---| +| Stop time | 32 ticks (0.53 s) | 31 ticks (0.52 s) | +| Stop distance | 1.54 m | 1.45 m | + +The skid (`retreating_movement`) is unchanged. + +### 4. A more deliberate skid + +`PLAYER_SKID_ANGLE_DEG`: 120° → **130°**. You have to pull the stick more squarely back to skid. + +| Pull-back from the run direction | 120° | 125° | 130° | 135° | 140° | +|---|---|---|---|---|---| +| Result | run | run | run | **skid** | **skid** | + +--- + +## What didn't change + +Measured and identical to before: the jump heights (2.33 m / 4.08 m second / 4.67 m retreat), the +0.2 s second-jump window, the skid (0.5 s glide-then-plant), the retreat jump, wall hang timing +(0.5 s, early wall jump in the first 0.1 s), mirrored wall jumps, the one-wall lockout, chimney +chaining, and riding moving platforms. The cliff course is still completable. + +--- + +## Things to watch in the next playtest + +- **Wall grabs are now everywhere.** Any jump into a violet wall or hangable rock grabs it. Near the + cliff and pillars that could feel sticky, or it could feel great. Watch for players getting + caught on walls they meant to jump past. +- **The clear-the-top threshold** is exact (apex vs. wall top). If players still snag on lips they + *nearly* clear, a small margin (e.g. grab only if the apex is at least 0.2 m below the top) would + help. +- **The buffer length.** 0.1 s fixes early presses in tests. If second jumps still feel strict, + 0.12–0.15 s is the next step. Going much longer risks jumps firing when players didn't mean them. +- **The skid angle.** 130° is stricter. If skids stop happening when players want them, back off + toward 125°. + +--- + +## Follow-up after playing it + +### Reverted: the first jump no longer wall hangs + +Change 2 went too far: **wall hangs off a single jump made them too strong.** A plain first jump no +longer turns on `heightened_movement` (it's back to the second, retreat and wall jumps, and wall +hangs). A first jump into the main wall no longer grabs it. + +**Kept:** the jump buffer (1), the quicker stop (3), the 130° skid angle (4), and the +**clear-the-top rule**. The rule was added for change 2, but it still earns its place: a second jump +from just under a ledge's lip lands on top instead of snagging on the face. + +### Cliff course regenerated + +Feedback: the platforms were too small (skidding off them), too crowded against the cliff, too +many needed double jumps (sometimes two in a row), and it wasn't clear which gaps needed a double. + +| | Before | After | +|---|---|---| +| Platform size | 3–4.5 m | **4–6 m** (all 39 measured in range) | +| Distance from the face | hugging it (0–9 m) | **1.5–13 m** (climb average 6.2 m); only the last few come in, for the hop onto the top | +| Heights | any value | **on a 1.5 m tier grid** from the cliff top: one tier up = a single jump, two = a double | +| Route steps (current seed) | mixed rises, doubles common | **19 singles, 8 doubles, 1 level; 0 back-to-back doubles** | +| Extra platforms | random spots and heights | each **one single hop beside a route platform**, level or one tier up or down | +| Rock pillars | placed first (and blocked the route) | placed after the route, never blocking one of its hops, 4–6 m out | +| Far cliff (the finish) | 60 m | **58 m**, two tiers above the top, so it's on the grid | +| Platforms in total | 37 | 39 (7 moving) | + +To fit a mostly-single-jump climb onto the cliff, the route **switches rows** (out a row, or back +in, at the same spot along the face) more often when it's getting too far along for its height. +The course test confirms that the top and the finish are reachable, that the bot lands every +still-platform hop it tried (30 of 30), and that all 7 moving platforms can be ridden. + +--- + +## Files touched + +`src/config.h` (new `PLAYER_JUMP_BUFFER`, friction, skid angle), `src/player.c` / `src/player.h` +(buffer, first-jump heightened and its revert, clear-the-top rule), `src/level.c` (the regenerated +cliff course: tiers, bigger platforms, row switches, pillars after the route, far cliff at 58 m), +`README.md` (controls table), and `game_feel.md` (rules, cliff course, tuning history). diff --git a/platformer/src/config.h b/platformer/src/config.h index 35feb4c..86677ac 100644 --- a/platformer/src/config.h +++ b/platformer/src/config.h @@ -38,7 +38,7 @@ * PLAYER_MAX_SPEED 6.0f m/s at full stick tilt (kept modest on purpose: * later moves will be the way to go faster) * PLAYER_GROUND_ACCEL 8.4f m/s^2 speeding up toward target speed - * PLAYER_GROUND_FRICTION 11.3f m/s^2 slowing down with no input (a short skid) + * PLAYER_GROUND_FRICTION 12.0f m/s^2 slowing down with no input (a short skid) * PLAYER_TURN_RATE 12.0f rad/s max facing rotation on ground * PLAYER_SNAP_TURN_DEG 90.0f degrees; from a standstill, stick pushes * more than this away from facing turn @@ -49,6 +49,9 @@ * PLAYER_AIR_ACCEL 9.0f m/s^2 speeding up toward target speed in air * PLAYER_JUMP_VELOCITY 14.0f m/s upward at jump start (~2.4 m apex) * PLAYER_JUMP_CUT 0.50f vel.y multiplier when A released while rising + * PLAYER_JUMP_BUFFER 0.1f s an A press is remembered: if a jump becomes + * possible within it (landing, grabbing a + * wall), it happens then * PLAYER_JUMP_MAX_SPEED 7.0f m/s top horizontal speed during a normal * jump (a little past the run speed) * PLAYER_JUMP_BOOST_ACCEL 1.5f m/s^2 how slowly speed builds past the run @@ -65,7 +68,7 @@ * bleeds off in the air (gradual on purpose) * * Player: skid and retreat jump - * PLAYER_SKID_ANGLE_DEG 120.0f degrees; pulling the stick more than this + * PLAYER_SKID_ANGLE_DEG 130.0f degrees; pulling the stick more than this * away from the run direction skids * PLAYER_SKID_SPEED_FRACTION 0.95f of PLAYER_MAX_SPEED; a skid needs a full * run (or faster, once later moves exist) @@ -178,7 +181,7 @@ /* ---- Player: ground movement ------------------------------------------- */ #define PLAYER_MAX_SPEED 6.0f /* m/s at full stick tilt; higher = faster top run speed (kept modest: later moves go faster) */ #define PLAYER_GROUND_ACCEL 8.4f /* m/s^2 toward target speed; lower = heavier, slower starts */ -#define PLAYER_GROUND_FRICTION 11.3f /* m/s^2 slowdown with stick released; lower = longer skid to a stop */ +#define PLAYER_GROUND_FRICTION 12.0f /* m/s^2 slowdown with stick released; lower = longer skid to a stop */ #define PLAYER_TURN_RATE 12.0f /* rad/s max facing rotation on ground; higher = tighter turns */ #define PLAYER_SNAP_TURN_DEG 90.0f /* degrees; standing still, bigger turns than this are instant; lower = more snapping */ @@ -187,6 +190,7 @@ #define PLAYER_AIR_ACCEL 9.0f /* m/s^2 toward target speed in air; higher = more steerable jumps */ #define PLAYER_JUMP_VELOCITY 14.0f /* m/s upward at jump start; higher = taller jumps (~2.4 m apex at 14) */ #define PLAYER_JUMP_CUT 0.50f /* vel.y multiplier on early A release; lower = shorter taps */ +#define PLAYER_JUMP_BUFFER 0.1f /* s an early A press is remembered (e.g. just before landing); higher = more forgiving */ #define PLAYER_JUMP_MAX_SPEED 7.0f /* m/s top horizontal speed in a normal jump; higher = bigger reward for jumping at full run */ #define PLAYER_JUMP_BOOST_ACCEL 1.5f /* m/s^2 build past run speed in a normal jump; higher = reaches PLAYER_JUMP_MAX_SPEED sooner */ #define PLAYER_OVERSPEED_DECEL 2.0f /* m/s^2 ease back down to run speed after landing (stick held); lower = keeps the extra speed longer */ @@ -196,7 +200,7 @@ #define PLAYER_SECOND_JUMP_SLOWDOWN 3.5f /* m/s^2 bleed from run speed down to that top speed; lower = more gradual, higher = more abrupt */ /* ---- Player: skid and retreat jump ------------------------------------- */ -#define PLAYER_SKID_ANGLE_DEG 120.0f /* degrees off the run direction that counts as "pulling back"; lower = skids trigger more easily */ +#define PLAYER_SKID_ANGLE_DEG 130.0f /* degrees off the run direction that counts as "pulling back"; lower = skids trigger more easily */ #define PLAYER_SKID_SPEED_FRACTION 0.95f /* of PLAYER_MAX_SPEED needed to skid (full run or faster); lower = skid from slower runs */ #define PLAYER_SKID_DURATION 0.5f /* s from pulling back to stopped (and the retreat jump's window); higher = longer slide */ #define PLAYER_SKID_GLIDE_POWER 2.0f /* skid braking curve; 1 = even, higher = freer glide first, then a harder plant */ diff --git a/platformer/src/level.c b/platformer/src/level.c index 2e3b862..12a0862 100644 --- a/platformer/src/level.c +++ b/platformer/src/level.c @@ -36,38 +36,44 @@ * is CLIFF_STRIP_COUNT strips whose north ends step * down that diagonal. Rock, and HANGABLE: big terrain * surfaces allow the wall hang; small platforms don't. - * Rock pillars PILLAR_COUNT tall hangable pillars a few meters out - * from the faces, so they form chimneys with the cliff. + * Rock pillars PILLAR_COUNT tall hangable pillars 4-6 m out from + * the faces, so they form chimneys with the cliff. + * Placed AFTER the route and never in its way. + * Height tiers every generated platform's top sits on a grid of + * TIER_HEIGHT (1.5 m) steps down from the cliff top, so + * one tier up is a single jump and two tiers up is a + * double (second) jump, and it's visible which is which. * The climb a band that wraps the cliff: along the south face * west to east, around the corner, north along the * east face. Distance along it is `s`; distance out - * from the face is `out`. On it: - * - one ROUTE: big platforms (ROUTE_MIN_SIZE..MAX) placed - * one hop after another (a normal jump or a second - * jump, with the path between them clear) from the - * ground to one hop below the top. It guarantees the - * climb is possible but isn't marked: it wanders in - * and out and takes switchbacks (hopping out to the - * next row or back in instead of along). Hops in - * toward the hangable face are normal jumps, so an - * overshoot can't grab the face. Each row turns the - * corner at its own spot (corner_s) so `s` is - * continuous round the turn. The route paces itself - * to arrive by ROUTE_ARRIVE_BY, stays beside the faces, - * drifts in for its last hop, and when boxed in tries - * easier hops, a scan of nearby spots, then (once) a - * wider strip. - * - the SCATTER: a few more platforms (SCATTER_COUNT) at - * random spots and heights around the route: other ways up, - * shortcuts, dead ends, and jumps that look possible - * but aren't. That ambiguity is WANTED: the player - * should have to judge which paths are feasible. + * from the face is `out`. Each row turns the corner at + * its own spot (corner_s), so `s` is continuous round + * the turn. On it: + * - one ROUTE of big platforms (4-6 m) from the ground to + * one tier below the top, ROUTE_MIN_OUT..ROUTE_WIDEST_OUT + * out from the face (not hugging it). Each step is a + * single jump (+1 tier), or now and then a double (+2), + * NEVER two doubles in a row, with the path between the + * two platforms clear. It isn't marked. It goes along + * the band or switches rows (out a row, or back in, at + * the same spot along the face), switching more when + * it's ahead of schedule so it arrives by + * ROUTE_ARRIVE_BY without running off the face. Hops in + * toward the face are singles; the last platforms drift + * in so the final hop is onto the top. When stuck it + * tries easier hops, then a scan of nearby spots. + * - the SCATTER: SCATTER_COUNT more platforms, each one + * single hop beside a route platform, level or one tier + * up or down: other ways up, shortcuts and dead ends. + * Some ambiguity is WANTED: the player should have to + * judge which paths work. * The river overlapping water tiles along the diagonal, parallel * to the cliff's third side. - * The crossing the same idea (a route plus a couple of extras) on - * the straight line from the - * top's north-west corner over the river to the far - * cliff (60 m, hangable), the finish. + * The crossing the same idea (a tiered route, mostly up or level, + * plus a couple of extras beside it) on the straight + * line from the top's north-west corner over the river + * to the far cliff (58 m: two tiers above the top, + * hangable), the finish. * Some platforms move (ROUTE_MOVING_SHARE / SCATTER_MOVING_SHARE): they * slide back and forth along the band, bob up and down, or loop round a * flat or upright circle, each with its own period and phase. A moving @@ -95,7 +101,7 @@ * DONE WHEN: The same seeds always build the same level, spawn is clear, the * wall course is ahead of the starting view, and the cliff course * behind it can be climbed and crossed with the moves in player.c, - * using about 30-40 platforms in all. + * using about 30-40 platforms of 4-6 m, mostly single jumps apart. * ============================================================ */ @@ -274,8 +280,8 @@ static const Box WALL_COURSE[] = { #define RIVER_TILE_COUNT 13 #define RIVER_DEPTH 0.05f /* m, the water is a thin sheet on the ground */ -/* The far cliff: the finish, 60 m up, across the river. */ -static const Box FAR_CLIFF = { { -70.0f, 0.0f, 80.0f }, { -32.0f, 60.0f, 98.0f }, true, BOX_STYLE_CLIFF }; +/* The far cliff: the finish, 58 m up (on the tier grid: two tiers above the top), across the river. */ +static const Box FAR_CLIFF = { { -70.0f, 0.0f, 80.0f }, { -32.0f, 58.0f, 98.0f }, true, BOX_STYLE_CLIFF }; /* The triangle cliff: strips side by side along the south face, each * reaching one step further north than the last. Their row of north ends is @@ -367,8 +373,8 @@ static bool is_clear(Box reach, bool moving) * corner, and runs north along the east face. Each row (a distance `out` from * the faces) turns the corner at its own spot, so s, the distance along that * row, is continuous round the turn whether the row hugs the face or not. */ -#define BAND_START_X -34.0f /* m; the climb starts west of the south face */ -#define BAND_LENGTH 110.0f /* m along a row about 3 m out; rows further out run a bit longer */ +#define BAND_START_X -40.0f /* m; the climb starts west of the south face */ +#define BAND_LENGTH 116.0f /* m along a row about 3 m out; rows further out run a bit longer */ #define PLATFORM_THICKNESS 0.5f /* m, every generated platform is a slab this thick */ /* Where a row `out` from the faces (platforms `depth` deep) turns the corner. */ @@ -472,27 +478,40 @@ static bool try_add_platform(Box b, bool want_moving, Vec3 along, Vec3 out, bool return true; } +/* ---- 3. The cliff course: height tiers --------------------------------- */ + +/* Every generated platform's top sits on a grid of TIER_HEIGHT steps measured + * down from the cliff top. So a platform one tier up is a single jump, two + * tiers up is a double (second) jump, and the difference reads at a glance. */ +#define TIER_HEIGHT 1.5f /* m; a single jump's step (a full jump lifts the feet 2.33) */ +#define CLIMB_TOP (CLIFF_TOP - TIER_HEIGHT) /* the route's last platform: one tier below the top */ + +/* The nearest height on the tier grid. */ +static float snap_to_tier(float y) +{ + return CLIFF_TOP - roundf((CLIFF_TOP - y) / TIER_HEIGHT) * TIER_HEIGHT; +} + /* ---- 3. The cliff course: the route (one guaranteed way) --------------- */ /* How far apart two platforms may be for the route: a gap and a rise that a * normal jump (or a second jump) makes comfortably. Checked by the headless * course test with margin; these are deliberately cautious. */ -#define ROUTE_NORMAL_MAX_RISE 1.7f /* m; a full jump lifts the feet 2.33 */ -#define ROUTE_SECOND_MIN_RISE 2.0f /* m; second-jump steps rise at least this... */ -#define ROUTE_SECOND_MAX_RISE 2.9f /* m ...and at most this (it lifts the feet 4.08) */ #define ROUTE_SECOND_MAX_GAP 1.3f /* m; a second jump from standing covers less ground */ -#define ROUTE_MOVING_SHARE 0.4f /* chance a route platform moves (never two in a row) */ +#define ROUTE_DOUBLE_SHARE 0.3f /* usual chance a step is a double (two tiers); never two in a row */ +#define ROUTE_MOVING_SHARE 0.35f /* chance a route platform moves (never two in a row) */ #define ROUTE_TRIES 60 /* candidates per step before trying easier hops */ #define ROUTE_MAX 64 -#define ROUTE_WIDEST_OUT 9.0f /* m; how far out a boxed-in route may wander */ -#define ROUTE_MIN_SIZE 3.0f /* m; generated platforms are this big or bigger... */ -#define ROUTE_MAX_SIZE 4.5f /* m ...up to this: room to land and skid with the player's weight */ -#define ROUTE_SIDESTEP_SHARE 0.35f /* chance a route step switches rows (out/in) instead of going along */ +#define ROUTE_MIN_OUT 1.5f /* m; route platforms keep at least this far from the face... */ +#define ROUTE_WIDEST_OUT 13.0f /* m ...and at most this far (the last one comes in close) */ +#define ROUTE_MIN_SIZE 4.0f /* m; generated platforms are this big or bigger... */ +#define ROUTE_MAX_SIZE 6.0f /* m ...up to this: room to land and skid with the player's weight */ +#define ROUTE_SIDESTEP_SHARE 0.4f /* chance a route step switches rows (out/in) instead of going along */ #define HOP_HALF_WIDTH 0.45f /* m; the player's half width, plus a little, for the clear-path check */ #define HOP_CLEARANCE 2.2f /* m above the higher platform the hop's path must be open (body + arc) */ -#define ROUTE_ARRIVE_BY 80.0f /* m along the band the route aims to reach the top by (the face ends ~104) */ +#define ROUTE_ARRIVE_BY 86.0f /* m along the band the route aims to reach the top by (the face ends ~110) */ #define ROUTE_PULL_IN_HEIGHT 12.0f /* m below the top where the route starts drifting in to the face */ -#define CLIMB_TOP (CLIFF_TOP - 1.2f) /* the route's last platform: a hop below the top */ +#define ROUTE_SCHEDULE_SLACK 8.0f /* m ahead of schedule along the band that adds 40% to the row-switch chance */ /* How far a normal jump comfortably clears for a given rise. */ static float normal_max_gap(float rise) @@ -500,29 +519,19 @@ static float normal_max_gap(float rise) return 2.4f - 0.5f * fmaxf(rise, 0.0f); } -/* The route's height at each s, for placing the scatter around it. */ -static float s_route_s[ROUTE_MAX], s_route_top[ROUTE_MAX]; -static int s_route_count; - -static float route_height_at(float s) -{ - if (s_route_count == 0 || s <= s_route_s[0]) - return 0.0f; - for (int i = 1; i < s_route_count; i++) { - if (s <= s_route_s[i]) { - float t = (s - s_route_s[i - 1]) / (s_route_s[i] - s_route_s[i - 1]); - return s_route_top[i - 1] + t * (s_route_top[i] - s_route_top[i - 1]); - } - } - return s_route_top[s_route_count - 1]; -} +/* The route's platforms, so the scatter can sit beside them. */ +typedef struct { + float s, out, along, depth; /* where it is on the band, and its size */ + Box box; +} RouteStep; +static RouteStep s_route[ROUTE_MAX]; +static int s_route_count; -static void remember_route_point(float s, float top) +static void remember_route_step(float s, float out, float along, float depth, Box box) { if (s_route_count < ROUTE_MAX) { - s_route_s[s_route_count] = s; - s_route_top[s_route_count] = top; - s_route_count++; + RouteStep step = { s, out, along, depth, box }; + s_route[s_route_count++] = step; } } @@ -583,139 +592,144 @@ typedef struct { float depth; /* last platform's depth (out from the face) */ Box last; /* the last platform placed */ bool last_moving; + bool last_double; /* the last step was a double: the next one isn't */ float out_min, out_max; /* the strip of the band this route wanders in */ - bool remember; /* record its heights for placing the scatter */ } RouteWalk; -/* Tries one random next platform for the route. `easy` asks for a short, - * low hop close to the last platform: the fallback when normal picks keep - * failing (at the corner, or next to a pillar). */ -static bool try_route_step(RouteWalk *w, float second_share, bool easy, float skip) -{ - bool second = w->top > 0.0f && !easy && random_chance(second_share); - float rise = second ? random_range(ROUTE_SECOND_MIN_RISE, ROUTE_SECOND_MAX_RISE) - : easy ? random_range(0.2f, 1.0f) - : random_range(0.9f, ROUTE_NORMAL_MAX_RISE); - rise = fminf(rise, CLIMB_TOP - w->top); - bool last = w->top + rise >= CLIMB_TOP - 0.01f; - float gap = easy ? random_range(0.3f, 0.9f) - : second ? random_range(0.6f, ROUTE_SECOND_MAX_GAP) - : random_range(0.6f, normal_max_gap(rise)); +/* Places the route's next platform if it fits and is a comfortable hop. */ +static bool place_route_step(RouteWalk *w, float s, float out, float along, float depth, + float top, bool double_jump, bool may_move) +{ + Box b = band_box(s, out, along, depth, top - PLATFORM_THICKNESS, top); + if (past_the_faces(b) || (w->top > 0.0f && !route_hop_ok(w->last, b, double_jump))) + return false; + bool moving; + if (!try_add_platform(b, may_move, band_along(s, out, depth), band_out(s, out, depth), &moving)) + return false; + w->s = s; w->top = top; w->out = out; w->along = along; w->depth = depth; + w->last = b; w->last_moving = moving; w->last_double = double_jump; + remember_route_step(s, out, along, depth, b); + return true; +} + +/* Tries one random next platform for the route: one tier up (a single jump) + * or, now and then, two tiers up (a double jump, never twice in a row). + * `easy` asks for a short, level or one-tier hop close to the last platform: + * the fallback when normal picks keep failing. */ +static bool try_route_step(RouteWalk *w, float double_share, float sidestep_share, bool easy, float skip) +{ + bool double_jump = w->top > 0.0f && !easy && !w->last_double && random_chance(double_share); + int tiers = double_jump ? 2 : (easy && random_chance(0.5f)) ? 0 : 1; + float top = w->top > 0.0f ? fminf(w->top + (float)tiers * TIER_HEIGHT, CLIMB_TOP) + : snap_to_tier(TIER_HEIGHT); /* the first platform, up from the ground */ + float rise = top - w->top; + bool last = top >= CLIMB_TOP - 0.01f; + float gap = easy ? random_range(0.4f, 0.9f) + : double_jump ? random_range(0.6f, ROUTE_SECOND_MAX_GAP) + : random_range(0.8f, normal_max_gap(rise)); float along = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); float depth = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); float out, s; bool pulling_in = CLIMB_TOP - w->top < ROUTE_PULL_IN_HEIGHT; - if (!last && !easy && random_chance(pulling_in ? 0.6f : ROUTE_SIDESTEP_SHARE)) { + bool sidestep = !easy && random_chance(pulling_in ? 0.6f : sidestep_share); + if (!last && sidestep) { /* A switchback: hop out to the next row (or back in) instead of along, * which climbs without using up the band. Near the top, always in. */ - bool outward = !pulling_in && - (w->out < 1.0f || (w->out + w->depth + gap + depth < w->out_max && random_chance(0.5f))); - out = outward ? w->out + w->depth + gap : w->out - gap - depth; - s = w->s + random_range(-1.0f, 1.0f); - if (out < 0.0f || out > ROUTE_WIDEST_OUT) + /* Coming in toward the face, size the platform to fit the space left. */ + float in_depth = fminf(depth, w->out - gap - ROUTE_MIN_OUT); + float out_row = w->out + w->depth + gap; /* the row further out... */ + float in_row = w->out - gap - in_depth; /* ...or the row further in */ + bool can_out = !pulling_in && out_row <= w->out_max; + bool can_in = in_depth >= ROUTE_MIN_SIZE && in_row >= w->out_min; + if (!can_out && !can_in) return false; - /* Hopping in toward the (hangable) face is a normal jump: a second - * jump keeps heightened_movement on, so an overshoot would grab the - * face instead of landing. */ - if (!outward && second) + bool outward = can_out && (!can_in || random_chance(0.5f)); + out = outward ? out_row : in_row; + if (!outward) + depth = in_depth; + /* Same spot along the face (give or take a meter), in the new row. + * Each row turns the corner at its own s, so convert through the + * position along the face rather than reusing s. */ + bool east = w->s >= corner_s(w->out, w->depth); + float spot = (east ? 0.5f * (w->last.min.z + w->last.max.z) + : 0.5f * (w->last.min.x + w->last.max.x)) + random_range(-1.0f, 1.0f); + s = east ? corner_s(out, depth) + spot - (CLIFF_SOUTH_Z - out - 0.5f * depth) + : spot - BAND_START_X; + /* Hopping in toward the (hangable) face is a single jump: it's lower + * and shorter than a double, so it's less likely to overshoot the + * ledge into the face. */ + if (!outward && double_jump) return false; } else { - /* Along the band, wandering in and out; the last platform hugs the face - * so the top is a hop away. */ - out = last ? random_range(0.0f, 0.6f) - : clampf(w->out + random_range(easy ? -1.0f : -2.5f, easy ? 1.0f : 2.5f), w->out_min, w->out_max); + /* Along the band, wandering in and out; the last platform comes in + * close to the face so the top is one hop away. */ + out = last ? random_range(0.0f, 0.8f) + : clampf(w->out + random_range(easy ? -1.0f : -2.0f, easy ? 1.0f : 2.0f), w->out_min, w->out_max); s = w->s + 0.5f * w->along + gap + 0.5f * along + skip; } - float top = w->top + rise; - Box b = band_box(s, out, along, depth, top - PLATFORM_THICKNESS, top); - - if (past_the_faces(b) || (w->top > 0.0f && !route_hop_ok(w->last, b, second))) - return false; - bool moving; - bool want_moving = !w->last_moving && !last && !easy && random_chance(ROUTE_MOVING_SHARE); - if (!try_add_platform(b, want_moving, band_along(s, out, depth), band_out(s, out, depth), &moving)) - return false; - w->s = s; w->top = top; w->out = out; w->along = along; w->depth = depth; - w->last = b; w->last_moving = moving; - if (w->remember) - remember_route_point(s, top); - return true; + bool may_move = !w->last_moving && !last && !easy && random_chance(ROUTE_MOVING_SHARE); + return place_route_step(w, s, out, along, depth, top, double_jump, may_move); } /* The last resort when random picks keep failing: scan nearby spots in order - * (every row out from the face, a range of distances along the band, a few - * rises) and take the first that is a comfortable hop and fits. */ + * (every row out from the face, a range of distances along the band, one + * tier up or level) and take the first that is a comfortable hop and fits. */ static bool rescue_route_step(RouteWalk *w) { - static const float RISES[] = { 1.4f, 1.0f, 0.6f, 0.3f }; float size = 0.5f * (ROUTE_MIN_SIZE + ROUTE_MAX_SIZE); - for (int r = 0; r < 4; r++) { - float rise = fminf(RISES[r], CLIMB_TOP - w->top); - bool last = w->top + rise >= CLIMB_TOP - 0.01f; - for (float ds = -3.0f; ds <= 7.0f; ds += 1.0f) { - for (float out = 0.0f; out <= (last ? 0.6f : ROUTE_WIDEST_OUT); out += (last ? 0.3f : 1.0f)) { - float s = w->s + ds, top = w->top + rise; - Box b = band_box(s, out, size, size, top - PLATFORM_THICKNESS, top); - bool moving; - if (past_the_faces(b) || !route_hop_ok(w->last, b, false) || - !try_add_platform(b, false, band_along(s, out, size), band_out(s, out, size), &moving)) - continue; - w->s = s; w->top = top; w->out = out; w->along = size; w->depth = size; - w->last = b; w->last_moving = false; - if (w->remember) - remember_route_point(s, top); - return true; - } - } + for (int tiers = 1; tiers >= 0; tiers--) { + float top = w->top > 0.0f ? fminf(w->top + (float)tiers * TIER_HEIGHT, CLIMB_TOP) + : snap_to_tier(TIER_HEIGHT); + bool last = top >= CLIMB_TOP - 0.01f; + for (float ds = -4.0f; ds <= 8.0f; ds += 1.0f) + for (float out = last ? 0.0f : w->out_min; out <= (last ? 0.8f : ROUTE_WIDEST_OUT); + out += (last ? 0.4f : 1.0f)) + if (place_route_step(w, w->s + ds, out, size, size, top, false, false)) + return true; } return false; } -/* Walks the band from the ground to one hop below the top, placing one - * platform per hop, wandering between out_min and out_max from the face. - * Steps are mostly normal-jump rises, with second-jump rises mixed in as - * often as the remaining height needs. When a step can't be placed, easier - * hops are tried, then easy hops a little further along, then a scan of - * nearby spots; the route never leaves a gap it can't cross. */ -static void add_climb_route(float out_min, float out_max, bool remember) -{ - RouteWalk w = { 0.0f, 0.0f, out_min, 0.0f, 0.0f, band_box(0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f), false, - out_min, out_max, remember }; - bool widened = false; - if (remember) { - s_route_count = 0; - remember_route_point(0.0f, 0.0f); - } +/* Walks the band from the ground to one tier below the top, placing one + * platform per hop, ROUTE_MIN_OUT..ROUTE_WIDEST_OUT out from the face. Steps + * are mostly single jumps (one tier), with doubles (two tiers) mixed in as + * the remaining height needs, never two doubles in a row. When a step can't + * be placed, easier hops are tried, then easy hops a little further along, + * then a scan of nearby spots; the route never leaves a gap it can't cross. */ +static void add_climb_route(void) +{ + RouteWalk w = { 0.0f, 0.0f, ROUTE_MIN_OUT, 0.0f, 0.0f, + band_box(0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f), false, false, + ROUTE_MIN_OUT, ROUTE_WIDEST_OUT }; + s_route_count = 0; while (w.top < CLIMB_TOP - 0.01f) { - /* Mix in more second jumps when there's a lot of height left per meter, + /* More doubles when there's a lot of height left per meter of band, * aiming to arrive well before the east face ends. */ - float needed = (CLIMB_TOP - w.top) / fmaxf(ROUTE_ARRIVE_BY - w.s, 4.0f) * 3.8f; + float needed = (CLIMB_TOP - w.top) / fmaxf(ROUTE_ARRIVE_BY - w.s, 4.0f) * 4.0f; + float double_share = clampf((needed - TIER_HEIGHT) / TIER_HEIGHT, ROUTE_DOUBLE_SHARE, 0.45f); + /* Row switches climb without moving along the band. The route should + * be about this far along for its height: ahead of that, switch rows + * more; behind it, go along more. */ + float on_schedule = ROUTE_ARRIVE_BY * w.top / CLIMB_TOP; + float ahead = w.s - on_schedule; + float sidestep_share = clampf(ROUTE_SIDESTEP_SHARE + ahead / ROUTE_SCHEDULE_SLACK * 0.4f, 0.15f, 0.85f); /* Near the top, drift in toward the face: the last hop is onto the top. */ if (CLIMB_TOP - w.top < ROUTE_PULL_IN_HEIGHT) { w.out_min = 0.0f; - w.out_max = fmaxf(0.6f, w.out_max - 2.0f); + w.out_max = fmaxf(0.8f, w.out_max - 3.0f); w.out = fminf(w.out, w.out_max); } - float second_share = clampf((needed - 1.2f) / 1.3f, 0.15f, 0.9f); - bool placed = false; + bool placed = false; for (int tries = 0; tries < ROUTE_TRIES && !placed; tries++) - placed = try_route_step(&w, second_share, false, 0.0f); + placed = try_route_step(&w, double_share, sidestep_share, false, 0.0f); for (int tries = 0; tries < ROUTE_TRIES && !placed; tries++) - placed = try_route_step(&w, second_share, true, 0.0f); + placed = try_route_step(&w, double_share, sidestep_share, true, 0.0f); for (float skip = 0.5f; skip <= 3.0f && !placed; skip += 0.5f) for (int tries = 0; tries < ROUTE_TRIES && !placed; tries++) - placed = try_route_step(&w, second_share, true, skip); + placed = try_route_step(&w, double_share, sidestep_share, true, skip); if (!placed) placed = rescue_route_step(&w); - if (!placed && !widened) { - /* Boxed in (by pillars or the other route): wander wider from here - * on (once; near the top the pull-in narrows it again). */ - widened = true; - w.out_min = 0.0f; - w.out_max = ROUTE_WIDEST_OUT; - continue; - } if (!placed) return; /* truly stuck: the course test reports the top as unreachable */ } @@ -724,39 +738,64 @@ static void add_climb_route(float out_min, float out_max, bool remember) /* ---- 3. The cliff course: pillars and scatter -------------------------- */ #define PILLAR_COUNT 7 -#define SCATTER_COUNT 5 -#define SCATTER_MOVING_SHARE 0.8f -#define SCATTER_TRIES 6000 +#define SCATTER_COUNT 6 +#define SCATTER_MOVING_SHARE 0.6f +#define SCATTER_TRIES 400 + +/* Does every hop along the climb route still have a clear path? */ +static bool route_paths_clear(void) +{ + for (int i = 1; i < s_route_count; i++) + if (!hop_path_clear(s_route[i - 1].box, s_route[i].box)) + return false; + return true; +} /* Tall hangable rock pillars a few meters out from the face: each makes a - * chimney with the cliff for wall jumps, and its top is a place to stand. */ + * chimney with the cliff for wall jumps, and its top is a place to stand. + * They're fitted in AFTER the route, so they never block it: a pillar that + * would stand in the way of one of the route's hops is taken out again. */ static void add_rock_pillars(void) { - for (int i = 0, tries = 0; i < PILLAR_COUNT && tries < 200; tries++) { + for (int i = 0, tries = 0; i < PILLAR_COUNT && tries < 300; tries++) { float s = random_range(8.0f, BAND_LENGTH - 8.0f); float top = CLIFF_TOP * s / BAND_LENGTH + random_range(0.0f, 4.0f); - Box b = band_box(s, random_range(3.5f, 5.0f), random_range(2.0f, 3.5f), + Box b = band_box(s, random_range(4.0f, 6.0f), random_range(2.0f, 3.5f), random_range(2.0f, 3.0f), 0.0f, top); b.allows_wall_hang = true; b.style = BOX_STYLE_CLIFF; - if (is_clear(b, false)) { - add_box(b, no_motion()); + if (!is_clear(b, false)) + continue; + add_box(b, no_motion()); + if (route_paths_clear()) i++; - } + else + s_count--; /* it blocked a hop: take it back out */ } } -/* Extra platforms at random spots and heights around the route: other ways - * up, shortcuts, and dead ends. */ +/* Extra platforms beside the route: each sits a single hop from a route + * platform (along the band, or out a row), usually level with it or one tier + * up or down. They're other ways up, shortcuts and dead ends, and most are + * reachable with a single jump. */ static void add_scatter(void) { - for (int i = 0, tries = 0; i < SCATTER_COUNT && tries < SCATTER_TRIES; tries++) { - float s = random_range(0.0f, BAND_LENGTH); - float top = clampf(route_height_at(s) + random_range(-3.0f, 2.5f), 0.8f, CLIFF_TOP - 0.5f); - float out = random_range(0.0f, 10.0f); + for (int i = 0, tries = 0; i < SCATTER_COUNT && tries < SCATTER_TRIES && s_route_count > 1; tries++) { + RouteStep r = s_route[1 + (int)(next_random() % (uint32_t)(s_route_count - 1))]; + int tiers = (int)(next_random() % 3) - 1; /* -1, 0 or +1 */ + float top = r.box.max.y + (float)tiers * TIER_HEIGHT; + float gap = random_range(0.8f, 1.5f); + float along = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); float depth = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); - Box b = band_box(s, out, random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE), depth, - top - PLATFORM_THICKNESS, top); + float s = r.s, out = r.out; + switch (next_random() % 3) { + case 0: s = r.s + 0.5f * (r.along + along) + gap; break; /* further along */ + case 1: s = r.s - 0.5f * (r.along + along) - gap; break; /* back along */ + default: out = r.out + r.depth + gap; break; /* out a row */ + } + if (top < 1.0f || top > CLIMB_TOP || out < ROUTE_MIN_OUT || out > ROUTE_WIDEST_OUT) + continue; + Box b = band_box(s, out, along, depth, top - PLATFORM_THICKNESS, top); bool moving; if (try_add_platform(b, random_chance(SCATTER_MOVING_SHARE), band_along(s, out, depth), band_out(s, out, depth), &moving)) @@ -771,7 +810,8 @@ static void add_scatter(void) #define CROSS_END_X -32.0f /* m ...to the far cliff's nearest corner */ #define CROSS_END_Z 80.0f #define CROSS_SCATTER 2 -#define CROSS_MOVING_SHARE 0.6f +#define CROSS_MOVING_SHARE 0.5f +#define CROSS_ROUTE_MAX 16 /* A square platform centered at (x, z) with the given top. */ static Box square_platform(float x, float z, float size, float top) @@ -781,61 +821,74 @@ static Box square_platform(float x, float z, float size, float top) return b; } -/* One guaranteed way across: hop by hop along the crossing line, keeping - * between side_min and side_max of it, until the far cliff is one hop away. - * Like the climb, it falls back to shorter hops rather than leaving a gap. */ -static void add_crossing_route(Vec3 start, Vec3 along, Vec3 side, float side_min, float side_max) +/* The crossing's route: hop by hop along the line from the top's corner to + * the far cliff, on the tier grid (level, one tier up or down, or now and + * then a double), until the far cliff is one single hop away. Remembers its + * platforms in `route` for the extras. Returns how many it placed. */ +static int add_crossing_route(Vec3 start, Vec3 along, Vec3 side, Box *route) { Box prev = square_platform(CROSS_START_X + 2.5f, CROSS_START_Z - 2.5f, 5.0f, CLIFF_TOP); /* the corner of the top */ float t = 0.0f; - bool prev_moving = false; + bool prev_moving = false, prev_double = false; + int placed_count = 0; - for (int step = 0; step < 20; step++) { - if (footprint_gap(prev, FAR_CLIFF) <= normal_max_gap(FAR_CLIFF.max.y - prev.max.y)) - return; + for (int step = 0; step < CROSS_ROUTE_MAX; step++) { + float to_finish = FAR_CLIFF.max.y - prev.max.y; + if (to_finish <= TIER_HEIGHT + 0.01f && footprint_gap(prev, FAR_CLIFF) <= normal_max_gap(to_finish)) + return placed_count; bool placed = false; for (int tries = 0; tries < 2 * ROUTE_TRIES && !placed; tries++) { - bool easy = tries >= ROUTE_TRIES; /* second half: short, low hops */ - bool second = !easy && random_chance(0.3f); - float rise = second ? random_range(ROUTE_SECOND_MIN_RISE, 2.6f) - : easy ? random_range(-0.5f, 0.8f) : random_range(-1.0f, 1.2f); - float top = clampf(prev.max.y + rise, CLIFF_TOP, FAR_CLIFF.max.y - 0.5f); - float size = random_range(ROUTE_MIN_SIZE + 0.2f, ROUTE_MAX_SIZE); - float next_t = t + (easy ? random_range(2.5f, 4.0f) : random_range(4.0f, 5.5f)); + bool easy = tries >= ROUTE_TRIES; /* second half: short hops */ + bool double_jump = !easy && !prev_double && random_chance(0.25f); + /* Mostly up or level while there's height to gain, now and then down. */ + float roll = random_range(0.0f, 1.0f); + int tiers = double_jump ? 2 : to_finish <= 0.01f ? (roll < 0.5f ? 0 : -1) + : roll < 0.55f ? 1 : roll < 0.9f ? 0 : -1; + float top = clampf(prev.max.y + (float)tiers * TIER_HEIGHT, + CLIFF_TOP - TIER_HEIGHT, FAR_CLIFF.max.y); + float size = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); + float next_t = t + (easy ? random_range(4.0f, 5.5f) : random_range(5.5f, 7.0f)); Vec3 c = vec3_add(vec3_add(start, vec3_scale(along, next_t)), - vec3_scale(side, random_range(side_min, side_max))); + vec3_scale(side, random_range(-4.0f, 4.0f))); Box b = square_platform(c.x, c.z, size, top); - if (!route_hop_ok(prev, b, second && top - prev.max.y >= ROUTE_SECOND_MIN_RISE)) + if (!route_hop_ok(prev, b, double_jump)) continue; bool moving; bool want_moving = !prev_moving && !easy && random_chance(CROSS_MOVING_SHARE); if (!try_add_platform(b, want_moving, along, side, &moving)) continue; - t = next_t; prev = b; prev_moving = moving; + t = next_t; prev = b; prev_moving = moving; prev_double = double_jump; + route[placed_count++] = b; placed = true; } if (!placed) - return; /* stuck: the course test reports the finish as unreachable */ + return placed_count; /* stuck: the course test reports the finish as unreachable */ } + return placed_count; } /* The same idea as the climb on the straight line from the top's corner to - * the far cliff: a guaranteed way across, plus a couple of extras. */ + * the far cliff: a guaranteed way across, plus a couple of extras beside it. */ static void add_crossing(void) { Vec3 start = vec3_make(CROSS_START_X, 0.0f, CROSS_START_Z); Vec3 line = vec3_sub(vec3_make(CROSS_END_X, 0.0f, CROSS_END_Z), start); - float length = vec3_length(line); - Vec3 along = vec3_scale(line, 1.0f / length); + Vec3 along = vec3_scale(line, 1.0f / vec3_length(line)); Vec3 side = vec3_make(-along.z, 0.0f, along.x); - - add_crossing_route(start, along, side, -3.0f, 3.0f); - - /* The scatter: more platforms either side of the line. */ - for (int i = 0, tries = 0; i < CROSS_SCATTER && tries < 300; tries++) { - Vec3 c = vec3_add(vec3_add(start, vec3_scale(along, random_range(2.0f, length))), - vec3_scale(side, random_range(-7.0f, 7.0f))); - Box b = square_platform(c.x, c.z, random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE), random_range(54.5f, 61.0f)); + Box route[CROSS_ROUTE_MAX]; + int route_count = add_crossing_route(start, along, side, route); + + /* The extras: a single hop to one side of a crossing platform, level with + * it or one tier up or down. */ + for (int i = 0, tries = 0; i < CROSS_SCATTER && tries < 200 && route_count > 0; tries++) { + Box r = route[next_random() % (uint32_t)route_count]; + float size = random_range(ROUTE_MIN_SIZE, ROUTE_MAX_SIZE); + float dir = random_chance(0.5f) ? 1.0f : -1.0f; + float gap = random_range(0.8f, 1.5f); + Vec3 c = vec3_add(vec3_make(0.5f * (r.min.x + r.max.x), 0.0f, 0.5f * (r.min.z + r.max.z)), + vec3_scale(side, dir * (0.5f * (r.max.x - r.min.x) + gap + 0.5f * size))); + float top = r.max.y + (float)((int)(next_random() % 3) - 1) * TIER_HEIGHT; + Box b = square_platform(c.x, c.z, size, top); bool moving; if (try_add_platform(b, random_chance(CROSS_MOVING_SHARE), along, side, &moving)) i++; @@ -858,8 +911,8 @@ int level_build(LevelBox *out, int capacity) add_triangle_cliff(); add_box(FAR_CLIFF, no_motion()); add_river(); + add_climb_route(); add_rock_pillars(); - add_climb_route(0.0f, ROUTE_WIDEST_OUT, true); add_scatter(); add_crossing(); return s_count; diff --git a/platformer/src/player.c b/platformer/src/player.c index 737a4c9..9f0e822 100644 --- a/platformer/src/player.c +++ b/platformer/src/player.c @@ -15,7 +15,7 @@ * - player_init / player_reset: body.pos = spawn, vel = 0, on_ground = true, * body.half_width = PLAYER_HALF_WIDTH, body.height = PLAYER_HEIGHT, * facing_yaw = 0, forward_speed = 0, state = PLAYER_IDLE, - * heightened_movement = false, heightened_timer = 0, + * heightened_movement = false, heightened_timer = 0, jump_buffer = 0, * retreating_movement = false, jump_kind = JUMP_NONE, skid_time = 0, * skid_speed = 0, skid_yaw = 0, wall_time = 0, wall_jump_yaw = 0, * has_last_wall = false, body.gravity_scale = 1, body.hit_wall = false, @@ -74,7 +74,15 @@ * WHY: at full run a U-turn used to keep all its speed; the skid * makes reversing a committed, weighty slide. * - * C. Jump (from IDLE / RUN / SKID): if in->jump_pressed and body.on_ground: + * C. Jump. An A press sets jump_buffer = PLAYER_JUMP_BUFFER; it counts down + * every tick. While it's > 0, the first moment a jump is possible, it + * happens and the buffer is spent (take_jump). On the ground that's + * the press itself; pressed just before landing, it's the landing tick + * (so an early press still gets the second jump); pressed just before + * grabbing a wall, it's the grab (an early wall jump). WHY: players + * press a hair early while still falling and felt their press eaten. + * Holding A still decides hop vs. full jump. + * Jumps start from IDLE / RUN / SKID on the ground: * on_ground = false; state = JUMP, and then one of * - in SKID: the RETREAT jump, like SM64's side flip. The player * already faces the stick (or where it last pointed), forward_speed = @@ -87,7 +95,8 @@ * jump_kind = JUMP_SECOND. heightened_movement stays on for the * whole jump, however long it lasts. * - otherwise a normal jump: body.vel.y = PLAYER_JUMP_VELOCITY; - * jump_kind = JUMP_NORMAL. + * jump_kind = JUMP_NORMAL. heightened_movement stays OFF, so a + * first jump can't grab walls (tried; it made wall hangs too easy). * * C2. Landing: landing from a normal jump (JUMP_NORMAL, short hop or * full) or a retreat jump (JUMP_RETREAT) turns heightened_movement on @@ -135,13 +144,17 @@ * (walked off a platform edge) -> FALL. * * F. Wall hang (WALL_HANG). From JUMP or FALL, enter it when ALL hold: - * heightened_movement is on; the last physics step hit a wall + * heightened_movement is on (second, retreat or wall jump); the last physics step hit a wall * (body.hit_wall) whose box allows_wall_hang; that wall's SURFACE isn't * the one last jumped off (same facing and same face position, so a * cliff built from side-by-side boxes counts as one wall; cleared on * landing); and the * player was moving into it within PLAYER_WALL_HANG_ANGLE_DEG of head-on - * (facing_yaw vs. -wall_normal). On entry: wall_jump_yaw = the approach + * (facing_yaw vs. -wall_normal); and the player WOULDN'T CLEAR the + * wall's top anyway (their jump's apex, pos.y + vel.y^2 / 2g, is below + * it). WHY that last rule: hopping onto a ledge from just below its + * lip with a heightened jump would otherwise grab the face instead of + * landing on top. On entry: wall_jump_yaw = the approach * direction MIRRORED off the wall (the part along the wall is kept, the * part into it flips: 5 degrees in from the left leaves 5 degrees to the * right); facing_yaw = wall_jump_yaw, so the nose shows exactly where a @@ -154,7 +167,7 @@ * - The body presses into the wall at a tiny speed (WALL_PRESS_SPEED) * so physics keeps reporting it; no contact means the player slid * past the wall's bottom or end. - * - A: the wall jump, along wall_jump_yaw. Within + * - A (take_jump): the wall jump, along wall_jump_yaw. Within * PLAYER_WALL_JUMP_EARLY_TIME of grabbing it's a second jump * (PLAYER_SECOND_JUMP_VELOCITY, launched at PLAYER_SECOND_JUMP_MAX_SPEED, * JUMP_SECOND); later it's a normal jump (PLAYER_JUMP_VELOCITY, @@ -181,7 +194,7 @@ * No magic numbers; everything comes from config.h. * * NOT IN SCOPE: Triple jump, long jump, wall kick, ground pound, skids - * below full run speed, slopes, coyote time, jump buffering. + * below full run speed, slopes, coyote time. * Leave a short comment at the state enum pointing to the * README roadmap as the place to grow. * @@ -289,10 +302,21 @@ static void leave_ground(Player *p, float vel_y, JumpKind kind) p->state = PLAYER_JUMP; } +/* C. Is there an A press waiting (pressed within PLAYER_JUMP_BUFFER)? If so, + * it's used up now: call this only where a jump can actually start. */ +static bool take_jump(Player *p) +{ + if (p->jump_buffer <= 0.0f) + return false; + p->jump_buffer = 0.0f; + return true; +} + /* C. A jump from IDLE/RUN. While heightened_movement is on (just after * landing a normal jump), A gives the higher second jump instead, like * SM64's double jump. heightened_movement stays on through the whole - * second jump. */ + * second jump. A plain first jump does NOT turn it on, so it can't grab + * walls: wall hangs off a single jump made them too easy. */ static void start_jump(Player *p) { if (p->heightened_movement) @@ -389,7 +413,7 @@ static void update_ground(Player *p, const Input *in, Wish wish, float dt) } p->state = grounded_state(p); - if (in->jump_pressed) + if (take_jump(p)) start_jump(p); } @@ -414,7 +438,7 @@ static void update_skid(Player *p, const Input *in, Wish wish, float dt) if (wish.mag > 0.0f) p->facing_yaw = wish.yaw; - if (in->jump_pressed) { + if (take_jump(p)) { start_retreat_jump(p); return; } @@ -456,17 +480,28 @@ static bool same_wall_as_last(const Player *p) fabsf(wall_plane(b->wall, b->wall_normal) - p->last_wall_plane) < 0.01f; } -/* F. Can the player grab the wall they just hit? Only in a heightened move, - * only on walls the level marks as hangable, not the wall they just jumped - * off, and only when running into it close to head-on (a glancing hit - * slides along it as usual). */ +/* F. Will this jump carry the feet above the wall's top anyway? Then the + * player is hopping ONTO it (a ledge just above), not clinging to it. */ +static bool would_clear_top(const Player *p) +{ + const Body *b = &p->body; + float apex = b->pos.y; + if (b->vel.y > 0.0f) + apex += b->vel.y * b->vel.y / (2.0f * GRAVITY); + return apex > b->wall.max.y; +} + +/* F. Can the player grab the wall they just hit? Only in a heightened move + * (second, retreat or wall jump), only on walls the level marks as hangable, not the wall they + * just jumped off, not one they're about to clear, and only when running + * into it close to head-on (a glancing hit slides along it as usual). */ static bool wants_wall_hang(const Player *p) { const Body *b = &p->body; if (!p->heightened_movement || !b->hit_wall || !b->wall.allows_wall_hang || p->forward_speed <= 0.0f) return false; - if (same_wall_as_last(p)) + if (same_wall_as_last(p) || would_clear_top(p)) return false; float head_on_yaw = atan2f(-b->wall_normal.x, -b->wall_normal.z); /* straight into the wall */ @@ -535,7 +570,7 @@ static void update_wall_hang(Player *p, const Input *in, Wish wish, float dt) return; } - if (in->jump_pressed) { + if (take_jump(p)) { start_wall_jump(p); return; } @@ -646,6 +681,7 @@ void player_init(Player *p, Vec3 spawn) p->skid_time = 0.0f; p->skid_speed = 0.0f; p->skid_yaw = 0.0f; + p->jump_buffer = 0.0f; p->wall_time = 0.0f; p->wall_jump_yaw = 0.0f; p->has_last_wall = false; @@ -667,6 +703,8 @@ void player_update(Player *p, const Input *in, float camera_yaw, float dt) { Wish wish = compute_wish(in, camera_yaw); count_down_heightened(p, dt); + if (in->jump_pressed) + p->jump_buffer = PLAYER_JUMP_BUFFER; /* C: remembered until a jump can happen */ /* IDLE and RUN share one helper: they differ only in speed. */ switch (p->state) { @@ -677,6 +715,7 @@ void player_update(Player *p, const Input *in, float camera_yaw, float dt) case PLAYER_JUMP: update_jump(p, in, wish, dt); break; case PLAYER_FALL: update_fall(p, in, wish, dt); break; } + p->jump_buffer = fmaxf(p->jump_buffer - dt, 0.0f); /* E. Turn speed into a velocity, then let physics move us. The player * moves where they face, except in a skid (they've already turned to diff --git a/platformer/src/player.h b/platformer/src/player.h index e6fd033..035a344 100644 --- a/platformer/src/player.h +++ b/platformer/src/player.h @@ -37,8 +37,8 @@ * PlayerState state; * bool heightened_movement; on for PLAYER_SECOND_JUMP_WINDOW s after * landing a normal or retreat jump, and for the - * whole second jump, retreat jump, wall hang - * and every wall jump. On the ground, A gives the second + * whole second jump, retreat jump, wall hang and + * every wall jump (NOT a plain first jump). On the ground, A gives the second * jump; in the air, it lets the player wall hang. * float heightened_timer; s left before heightened_movement ends * (not counted down during the second jump) @@ -51,6 +51,8 @@ * float skid_speed; forward_speed when the skid began * float skid_yaw; direction the skid slides (the old run * direction; the player already faces the stick) + * float jump_buffer; s left on the last A press: while > 0, the first + * moment a jump is possible, it happens * float wall_time; s since the current wall hang began * float wall_jump_yaw; where a wall jump from this hang launches: the * approach direction mirrored off the wall @@ -113,13 +115,14 @@ typedef struct Player { float facing_yaw; /* radians; facing vector = (sin(yaw), 0, cos(yaw)) */ float forward_speed; /* ground speed along facing_yaw, m/s (>= 0) */ PlayerState state; - bool heightened_movement; /* second jump available (or in progress); later moves read it too */ + bool heightened_movement; /* second-jump window, and on through second/retreat/wall jumps and hangs */ float heightened_timer; /* s left before heightened_movement ends; paused during the second jump */ bool retreating_movement; /* skidding (or in the jump out of a skid); later moves read it too */ JumpKind jump_kind; /* which jump the player is in the air from */ float skid_time; /* s since the current skid began */ float skid_speed; /* forward_speed when the skid began */ float skid_yaw; /* direction the skid slides; facing_yaw already points at the stick */ + float jump_buffer; /* s left on the last A press; a jump fires as soon as one is possible */ float wall_time; /* s since the current wall hang began */ float wall_jump_yaw; /* a wall jump's launch direction: the approach mirrored off the wall */ bool has_last_wall; /* a wall was jumped off since the last landing... */ |
