Skip to content

feat: steep slopes slide like in Gothic - no more jumping up cliffs, NPCs and monsters slide too - #585

Open
BoroBongo wants to merge 33 commits into
feature/hero-jump-fallfrom
feature/slope-slide
Open

BoroBongo wants to merge 33 commits into
feature/hero-jump-fallfrom
feature/slope-slide

Conversation

@BoroBongo

@BoroBongo BoroBongo commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

Steep slopes slide like in Gothic - for the VR hero and for NPCs and monsters.

  • Gothic's rule. Ground steeper than the guild's SLIDE_ANGLE (45 deg for humans, Species.d) and not a wall (SLIDE_ANGLE2) slides: gravity along the slope, up to 6 m/s (ours). It must be steep for 0.2 s to start, so single steep triangles and stairs don't trigger it.

  • The hero. He slides down, the stick can't walk him up (sideways and downhill stay free), and he can't jump off steep ground - no more climbing a cliff by jumping again and again. The body plays S_SLIDE facing downhill, S_SLIDEB backwards; the scripts see him standing. Sliding off an edge becomes a normal fall; a slide itself is no fall and costs no HP.

  • NPCs and monsters slide with their own guild's angle (bloodfly 75, minecrawler 60, flyers never) when they move down or across a slope, only within 40 m of the hero; S_SLIDE / S_SLIDEB, off an edge into a fall.

  • Code layout: NpcJumpFall (was ~800 lines) keeps the state switch, the fall and the landing; the slide (NpcSlopeSlide), ledges and ladders (NpcLedgeClimb), the shared body access (NpcMoveBody) and animation chains (NpcAnimationSequence) are workers. The hero's fall and slide are ticked by one Core entry, HeroBodyService (the fall before the slide, decided in Core); the sample is HeroBodySample. New map of the area: Docs/hero-movement.md (linked from Docs/architecture.md and Docs/ledge-climbing.md).

Technical: Core SlopeSlideDomain (static rule set, EditMode tests: IsSlideGround, RemoveUphill, GetAnimation, debounce), HeroSlideService, HeroSlideHold; VR: IVrRig.TryGetGround / SlideVelocity / IsTakeOffBlocked, XriSlopeSlide (one ray down per frame, world mesh layer only); NpcJumpFall sliding state; DaedalusConst.AniSlide / AniSlideBack.

Stacked on #584 (feature/hero-jump-fall).

ADR: Docs/adr/2026-11-29-slope-slide.md

Why

Playtest (G1 Mroczne Tajemnice, a Gothic 1 mod): the hero could climb any steep slope by jumping repeatedly, and neither he nor NPCs slid down slopes like in Gothic.

How to test manually

  • Stand on a slope steeper than 45 deg: after about 0.2 s [HeroSlide] Slides down a NN deg slope, S_SLIDE (looking downhill) / S_SLIDEB (looking uphill); ends with Slide ended (walkable ground), no damage.
  • Jump on steep ground: nothing, [XRI] No jump - the ground is too steep. Jumping on barrels, NPCs and items still works.
  • Slide off a precipice: Slide ended (no ground below - falls), then a normal fall.
  • Slide into a rock or crevice: stops, no re-slide until he moved 0.5 m.
  • Stairs and paths under 45 deg: unchanged.
  • Lure a wolf or a human down a steep hill: [NpcJumpFall] ... slides, S_SLIDE; afterwards it walks on with its routine. Kill an NPC mid-slide: its body can be grabbed and looted.
  • A bloodfly doesn't slide on a 50 deg slope.

Save/load

Nothing is saved; teleports, loading a game and loading a world end any slide.

Known gaps / follow-ups

  • NPCs walking up steep ground keep walking (Gothic would stop them like at a wall); a standing NPC on a slope doesn't slide until it moves.
  • The hero drops straight down when he slides off an edge (no slide momentum, VR comfort).
  • Reviews: .claude/review/feature-slope-slide/ - two rounds (architecture: fits with concerns -> fits; gothic: 2 medium -> fixed), all findings fixed in this PR: NpcJumpFall split into internal workers, HeroBodyService as the single Core tick, BS_STAND while sliding decided in Core, no slide check in the air, one wall test for NPC fall and slide, Docs/hero-movement.md. Note for reviewers: CLAUDE.md gets one clause (a stateless Domain rule set may be a static class), matching Docs/architecture.md.

🤖 Generated with Claude Code

BoroBongo and others added 30 commits November 29, 2026 16:14
… - the rule for the hero and NPCs (SlopeSlideDomain), with EditMode tests

OpenGothic MoveAlgo::testSlide: slides while sin(SLIDE_ANGLE2) < normal.y < cos(SLIDE_ANGLE)
(SLIDE_ANGLE2 now in LedgeRules, 0 in Species.d), gravity along the slope (g * sin), capped at
6 m/s (ours). Steep for 0.2 s before a slide, walkable for 0.1 s before it ends (single steep
triangles); a slide that gets nowhere ends as Blocked until moved 0.5 m away; no ground ends it
for a fall. S_SLIDE facing downhill, S_SLIDEB backwards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… anymore, and slides down it like in Gothic - HeroSlideService decides, the XRI rig moves him and refuses the take-off

The rig port gets the ground straight under the feet (one ray down per frame - no stair risers),
SlideVelocity and IsTakeOffBlocked. VrHeroJumpFall feeds HeroFallService and HeroSlideService
with the same sample. XriSlopeSlide queues the slide after XRI's moves (CharacterController.Move,
walls still stop it) and takes back the stick's steps up the slope; gravity's fall speed is held
and the rig counts as grounded meanwhile, so a slide is no fall. Steeper than SLIDE_ANGLE, a jump
press does nothing until released (OpenGothic: no jump while sliding). Not while climbing,
swimming, jumping, lying after a fall, transformed or busy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…IDEB backwards, and the scripts see him standing - no footsteps, no running while he slides

BS_STAND like OpenGothic (BS_NONE for the slide animations). Without S_SLIDEB the body plays
S_SLIDE, without both its normal animations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s SLIDE_ANGLE, S_SLIDE / S_SLIDEB, off an edge into a fall

NpcJumpFall gets a Sliding state (busy: the walk and fight moves wait, like for falls): ground
straight under a moving NPC near the hero steeper than its SLIDE_ANGLE for 0.2 s, going down or
across it, slides it down - kinematic, held on the ground below, stopped by walls. It walks on at
walkable ground, stands when blocked, and falls with the slide's speed off an edge (the drop
counts from there). Walking up a steep slope stays walking, so routes don't loop. Flyers never
slide (NpcFallDomain.CanMove).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p from steep ground, a slide is no fall, NPCs only downhill

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… below 0.01) count as a wall even without SLIDE_ANGLE2

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…le he fights or sits - why he isn't checked is a HeroSlideHold enum, its text only built when it changes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… dead or unconscious - fall, climb and slide all finish the same way when it can't move, without our landing or idle animations over the death

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…slide - its steep time starts again whenever it stands still, is far from the hero or can't move (a block at a wall stays)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rising beside it - only near-vertical hits of its wall ray are walls, the 0.3 m look-ahead is named

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k his jump or start a slide - the slide's ground ray sees only the world mesh layer (Default, with the solid VOBs), like the NPCs' ground ray

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e S_SLIDE, else none) lives once in SlopeSlideDomain.GetAnimation for the hero and NPCs, the names in DaedalusConst

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…k is Core's rule (SlopeSlideDomain.RemoveUphill, with EditMode tests) - the XRI backend only moves the body

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd its normal (HeroFallSample) - forgotten, he'd silently never slide or be kept from jumping off steep ground

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n default - 0 is Gothic's own value

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…jump, an NPC's steep time starts again when it stops, what happens when an NPC can't move mid-slide

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…de animation comes from HeroSlideService

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pcJumpFall - start, tick, wall look-ahead and the hand-off into a fall; what fall, climb and slide all ask of the body (rest height, guild values, ground below, physics) is NpcMoveBody

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…edgeClimb), the landing's and climbs' animations one after another NpcAnimationSequence - NpcJumpFall keeps the state switch, the fall and the landing

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…of the hero's body feeds his falls and his slides alike

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dyService.Tick) - the fall, then the slide, decided in Core; the platform applies what it returns (HeroBodyResult: slide velocity, take-off blocked) and the two services' Tick and OnTeleported are internal

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o calls whom for speeds, jumps and falls, fall damage, the lying landing, slides and climbs, where the rules live, the ADRs; pointers from architecture.md and ledge-climbing.md, and stateless Domain rule sets may be static

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… before the slide, decided in Core), NpcSlopeSlide and the movement map

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nerated by Unity on import)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eeds from VRHeroSpeedService, the running jump's leap from Core's take-off velocity through HeroBodyService (HeroBodyResult.AirEvent carries the fall's event of the frame), FallPose.FallDown / FallDownToStand in the split NPC workers

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…with its state passed in, like Docs/architecture.md - one rule, stated the same in both places

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eroSlideService's (TryGetLocomotionBodyState, VRHeroMovement asks), no slide starts in the air (HeroSlideHold.Airborne while the fall's phase isn't Grounded: a drop onto a steep slope lands first), and a missing hero ends a running slide (NoHero) so the rig keeps no slide velocity

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… would move the body, but XriRig counted him grounded and held his gravity

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ad, near-vertical hits only) - a falling NPC no longer stops its run at a slope rising ahead but lands on it; NpcSlopeSlide logs as [NpcSlide]

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BoroBongo and others added 3 commits November 29, 2026 16:37
…Climb, NpcAnimationSequence) are internal to Core - AI code reaches NPC movement only through INpcJumpFallFactory, nothing bypasses NpcJumpFall's state switch

Co-Authored-By: Claude Opus 5.5 <[email protected]>
….SlideOffAnEdgeFallsFromTheEdge) - the slide counts as ground, the drop starts at the last grounded frame, the rig's grace only lowers it by a few cm; the movement map names it among the pitfalls

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BoroBongo

Copy link
Copy Markdown
Contributor Author

AI review (architecture-reviewer + gothic-reviewer), two rounds

Round Commit Architecture Gothic
1 c0669361d fits with concerns (1 major, 5 minor) 2 medium, 4 low
2 a959d3f fits: all resolved, 3 new minor all resolved, 1 low + 4 nits
fixes 2d92847 all round-2 findings fixed

Fixed in this PR (nothing deferred):

  • The NPC fall/climb/slide state machine is split. NpcJumpFall (401 lines, was ~800) keeps the switch, the fall and the landing. Its workers are internal: NpcSlopeSlide, NpcLedgeClimb, NpcMoveBody and NpcAnimationSequence.
  • One Core entry for the hero's body each frame: HeroBodyService (fall, then slide, with the fall's event passed on). The services' ticks are internal, and the sample is HeroBodySample.
  • Gothic rules decided in Core:
    • the slide's BS_STAND;
    • no slide check in the air;
    • the uphill take-back (SlopeSlideDomain.RemoveUphill);
    • the slide animation choice (GetAnimation).
  • NPCs get their physics back when a slide ends on death or water. Their steep timer restarts when they stop. Fall and slide share one wall test, so only near-vertical hits count as walls.
  • The jump block only sees the world layer: barrels, NPCs and items no longer block a jump.
  • No per-frame strings (HeroSlideHold).
  • Docs/hero-movement.md maps the movement area. Docs/architecture.md and CLAUDE.md (one clause) say that a stateless Domain rule set may be a static class.
  • New EditMode test: sliding off an edge, the fall height counts from the edge.

Verified locally:

  • Compiles, 167/167 EditMode tests.
  • Editor playtest (G1 Mroczne Tajemnice, a Gothic 1 mod): a 61° slope slides 1.5 m and stops on walkable ground, no exceptions.

Still to check in play: NPC ladder/ledge climbs after the NpcLedgeClimb refactor, and an NPC sliding down a steep hill.

Reports and answers: .claude/review/feature-slope-slide/ (c0669361d-, a959d3f-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant