feat(gameplay): stamina — running drains it, exhaustion forces a walk (#178) #185
No reviewers
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo!185
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/stamina"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Makes running cost something, which is what turns the run gait (#177/#180) and the marsh move-cost (#138) into an actual decision instead of "marsh is just slower". Implements #178 to the design agreed and persisted on that issue.
Stacked on #180 — based on
feat/run-walk, notmain, so this diff is only the stamina delta. Merge #180 first.What changed
Mobile.Stamina => Dexstub becomesMaxStam => Dex, with a real pool held in tenths (StamTenths,MaxStamTenths => Dex * 10) and a whole-pointStamview. Intrinsic clamped mutators live on the entity next toSetHits/SetMana:SetStam,SpendStaminaTenths,RecoverStaminaTenths. A DEX change re-clamps it like the other vitals.TileMap.MoveCostTickson the drain), so sprinting a marsh burns ~1.6x what open ground does. Tenths are what keep that 1.6x from rounding into 2x.Exhausted; while spent,CanRunis false andMovementSystemapplies the walk cooldown and skips the drain whatever gait the client asked for. The latch clears only once the pool climbs back pastStamResumePercent(15%), so the gait can't flip on every regen tick.MovementSystem.RegenerateStamina, on a tick cadence mirroring the mana regen, for everyone who did not run that tick. Deliberately runs afterApplyPending, otherwise a sprinting player would still regenerate.SystemMessageId.TooWindedToRun+ catalog template, sent (throttled, 2s) when a player asks to run while spent.ProtocolVersion13 → 14. Read together with the overweight check in a single sim invoke.StamRegenTicks,StamRegenTenths,RunDrainTenths,StamResumePercentonGameOptions. Defaults give roughly a 12s sprint and a ~20s recovery at DEX 50.How it was tested
StaminaTestsagainstWorld: running drains while walking is free; sustained running empties the pool and dropsCanRun; an exhausted player still sendingRunningmoves at the walk cadence (the trust-boundary case); stamina recovers while not running; the resume threshold prevents gait flapping; a marsh run costs more than a grass run.Notes
Retargeted base to
main(its old basefeat/run-walkwas merged & deleted) and merged currentmainin. Conflicts resolved:TooWindedToRunstacks on run/walk 18 now on main).(map, walk, run, maxStepZ, StaminaOptions); keeps stamina'ssprinting = running && CanRungating and the terrain-scaled run drain (SpendStaminaTenths(MoveCostTicks(RunDrainTenths,...))).staminaalongside main'smaxStepZ/itemCatalog/runCooldownTicks.Stam(=StamTenths/10) +MaxStam(the #181 stub's predicted one-liner).(Overweight, Winded)move result ->TooWindedToRunnotice.Gates green in a worktree off current main: 0 warnings, 774 tests, CSharpier clean.