Skip to content

Adds Sprinting to Doppler - #1178

Open
BasilTamaya wants to merge 1 commit into
DopplerShift13:masterfrom
BasilTamaya:sprinting
Open

Adds Sprinting to Doppler#1178
BasilTamaya wants to merge 1 commit into
DopplerShift13:masterfrom
BasilTamaya:sprinting

Conversation

@BasilTamaya

@BasilTamaya BasilTamaya commented Aug 8, 2026

Copy link
Copy Markdown

About The Pull Request

Ported directly from Maplestation.

Why It's Good For The Game

There's a bit of a nuanced interaction that doesn't get talked about or addressed, but the two-gear system of toggling walk and run doesn't feel good, and often times this defaults to everyone running through the halls and shoving past people as a natural occurrence with TGstation. I will, however, say it's weird that this happens. Normally running into people causes some sort of interaction; either an apology, or "no running in the hall!".

Miners will not need to fear, for stimulants included in their medipens will aid in this. Walkspeed will need to be ticked just a tad enough to dodge some fauna.

Key Features:

  • Resting will regen your sprint bar quicker than standing. This is, lying down or sitting.
  • Combat stimulants, or luxury medipens will aid in sprinting. Miners should have no concerns with this.
  • Sprint threshold. You can run a hundred tiles maximum for free, before it starts to drain from your stamina. Subject to change on request.
  • You can increase your crawlspeed on the floor but otherwise are unable to do so if you fell from being staggered/shoved
  • Walking means that you don't run through people, but with the increased or added modification to the current walkspeed, this means running will (hopefully) be used during tense situations, or if someone really wants to go somewhere.
  • A visual indicator is given below your walk and run toggle. There is an audible indicator as well.

To be address or added:

  • Check if sprint scales with fitness
  • Fix the sprint bar recovering/filling up when player is in stam crit (it isn't an issue since they can't run in stam crit anyways but we don't want that visual disconnection)
  • Add some sort of to-chat when one has used up their sprint threshold and is now using their stamina threshold, as well as another more aggressive to-chat about attempting to run when exhausted.
  • Make walking sounds not quiet, sneaking is no longer that much of a key feature and sort of takes away from the goal of the PR?

This PR will be marked as a draft per discussion with maintainers and to allow them to make or request necessary changes, or discuss if this should be added at all; as well as communication for changing the default move speed in the config files to adjust.

It isn't exactly complete, but I want to know what else I should be adding that's a concern for maintainers before I proceed.

Testing Evidence

NOTE: I did not edit the walk speed in the config files. What is seen in the video is not what I aim the walkspeed to be.

2026-08-08.15-07-01.mp4

Will provide screenshots but the code currently presented functions as intended. There's a few things I need to work on, but I'm waiting to get some maintainer input/discussion on concerns that I can address.

Changelog

🆑FoundInJune
add: Adds Sprinting Mechanic, ported directly from Maplestation.
/:cl:

@github-actions github-actions Bot added Sprites Funny little pixels on our screen Sound Soundwaves that hit the player at roughly 342 m/s Feature Something new, something fresh. labels Aug 8, 2026
@ChillyLobster

Copy link
Copy Markdown

Just one more step to roguecode.... Add parry and dodge next...

@github-actions

Copy link
Copy Markdown

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions Bot added the Stale label Aug 18, 2026
@BasilTamaya

Copy link
Copy Markdown
Author

this may be bad practice but im gonna set this one ready to view only because i don't know how to do the last 2, waiting for contributer input now

@kannthus

Copy link
Copy Markdown
Member

Big fan of this personally, great work @BasilTamaya ❤️

@github-actions

Copy link
Copy Markdown

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

@github-actions github-actions Bot added the Stale label Aug 27, 2026

@TheOneAndOnlyCreeperJoe TheOneAndOnlyCreeperJoe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adressed some stand-out things as well as how to implement the two points you mentioned.

if(iscarbon(source) && source.move_intent == MOVE_INTENT_WALK)
return // stealth
//if(iscarbon(source) && source.move_intent == MOVE_INTENT_WALK) // DOPPLER EDIT REMOVAL
// return // stealth DOPPLER EDIT REMOVAL

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// return // stealth DOPPLER EDIT REMOVAL
// return // stealth // DOPPLER EDIT REMOVAL

Forgot slashes preceding the DOPPLER EDIT REMOVAL

Comment on lines +22 to +25
// DOPPLER EDIT CHANGE START
if(move_intent == MOVE_INTENT_RUN && !(movement_type & FLYING) && (mobility_flags & (MOBILITY_MOVE|MOBILITY_STAND)) && !pulledby)
drain_sprint()
// DOPPLER EDIT CHANGE END

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// DOPPLER EDIT CHANGE START
if(move_intent == MOVE_INTENT_RUN && !(movement_type & FLYING) && (mobility_flags & (MOBILITY_MOVE|MOBILITY_STAND)) && !pulledby)
drain_sprint()
// DOPPLER EDIT CHANGE END
// DOPPLER EDIT ADDITION START
if(move_intent == MOVE_INTENT_RUN && !(movement_type & FLYING) && (mobility_flags & (MOBILITY_MOVE|MOBILITY_STAND)) && !pulledby)
drain_sprint()
// DOPPLER EDIT ADDITION END

No existing lines/behavior were changed so addition is more apt than change.

Comment on lines +26 to +31
/// If TRUE, we are being affected by run momentum
var/has_momentum = FALSE
/// Our last move direction, used for tracking momentum
var/momentum_dir = NONE
/// How many tiles we've moved in the momentum direction
var/momentum_distance = 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused vars?
Also not sure why you're defining them on carbons when this mechanic (seemingly) is human catered?

/mob/living/carbon/proc/drain_sprint()
return

/mob/living/carbon/human/drain_sprint()

@TheOneAndOnlyCreeperJoe TheOneAndOnlyCreeperJoe Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like drain_sprint() would benefit from having a value passed in the arguments rather than the assumption that every call is "1", as largely a measure of future-proofing and allowing to arbitrarily pass sprint drains on future-things.

if(move_intent == MOVE_INTENT_RUN || sprint_length >= sprint_length_max)
return

adjust_sprint_left(sprint_regen_per_second * seconds_per_tick * (body_position == LYING_DOWN ? 2 : 1))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like you should delegate this to a proc that handles recovery factors rather than including it in the adjustment call, given that any future additional forms of recovery (e.g sleeping, performance enhancing drugs, etc.) would need an insertion point that isn't just piggybacking off of stamina.
E.g

/mob/living/carbon/human/proc/run_sprint_recovery()
	var/recovery = 0
	recovery = sprint_regen_per_second * seconds_per_tick
	
	if(body_position == LYING_DOWN) // laying down bonus
		recovery *= 2
	if(HAS_TRAIT_FROM(src, TRAIT_INCAPACITATED, STAMINA)) // no recovery during stamcrit (adresses point 2 of the bar recovering during stamcrit)
		recovery *= 0
		
	adjust_sprint_left(recovery)

Later on you can add a signal sender that basically sends to any listeners "hey, would you like to modify the recovery?" which would be nice (especially integrating it with existing systems), but this works for now.

// Minor stamina regeneration effects, such as stimulants, will replenish sprint capacity
/mob/living/carbon/human/adjustStaminaLoss(amount, updating_stamina, forced, required_biotype)
. = ..()
if(amount < 0 && amount >= -20)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curiously, why do we cut-off at 20 specifically? Where's the magic number coming from, given that something that gives 20 per tick is "fine" but 50 in one go isn't.

Comment on lines +73 to +82
// Sprinting when out of sprint will cost stamina
if(sprint_length > 0)
return

// Okay you're gonna stamcrit yourself, slow your roll
if(getStaminaLoss() >= maxHealth * 0.9)
toggle_move_intent()
return

adjustStaminaLoss(1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally you'd insert Add some sort of to-chat when one has used up their sprint threshold and is now using their stamina threshold, as well as another more aggressive to-chat about attempting to run when exhausted here.

Generally speaking to_chat(src, span_warning("Your sprint has started exhausting you!")) should suffice, then use a COOLDOWN_DECLARE(stam_sprint_warning) to add a cooldown to the message as to not spam the user. Alternatively you can set a var that sets the message has been sent, and unset it once sprint_length is at a certain value again that would warrant the message. You could also use a balloon_alert() which is much more noticeable.

For the more dangerous warning, you're going to need to be more specific on intended behaviour. I would suggest at line 79 to add a to_chat() or a balloon_alert() informing them that they've stopped sprinting.

Comment on lines +20 to +23
/datum/movespeed_modifier/momentum
movetypes = GROUND
flags = IGNORE_NOSLOW
multiplicative_slowdown = -0.1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unimplemented?

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

This PR has been inactive for long enough to be automatically marked as stale. This means it is at risk of being auto closed in ~ 7 days, please address any outstanding review items and ensure your PR is finished, if these are all true and you are auto-staled anyway, you need to actively ask maintainers if your PR will be merged. Once you have done any of the previous actions then you should request a maintainer remove the stale label on your PR, to reset the stale timer. If you feel no maintainer will respond in that time, you may wish to close this PR youself, while you seek maintainer comment, as you will then be able to reopen the PR yourself

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

Labels

Feature Something new, something fresh. Sound Soundwaves that hit the player at roughly 342 m/s Sprites Funny little pixels on our screen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants