Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[WIP] [CR] Add sneaking/crouchwalking as a new movement mode #22844
Conversation
ecroffleps
added some commits
Jan 31, 2018
This comment has been minimized.
This comment has been minimized.
Sounds only good if switching between crouching and walking takes time, to avoid free aim time saving in exchange for added keypresses. |
This comment has been minimized.
This comment has been minimized.
|
First of all, cool, I'll want to play with this for a bit, but it looks reasonable.
You are "in broad daylight", but there's a certain value to just moving slowly so that you don't get noticed.
I think this is fine for now, neither of them should be making you "winded", so it doesn't matter much what the exact stamina cost is.
Rather than patching in a stat or a skill, I'd like to have an outline of what the various inputs to stealth are, i.e. silhouette, movement, contrast and lighting; and decide how those are affected by gear and physical ability and environment.
Agree with this, but there's a way around it.
This actually needs to be addressed now, because as long as moving doesn't end your turn, you can toggle between crouching and running and get most of the speed of running, but ALL of the benefit of crouching.
Similar to the skill/dex thing, some gear would make things better, some would make it worse. Power armor is special, and might prevent sneaking entirely. |
This comment has been minimized.
This comment has been minimized.
|
Should gear (especially metal armor) affect player-generated sound? Scrap suit, for example, is explicitly states that |
This comment has been minimized.
This comment has been minimized.
|
Don't forget big noisy drum magazines with their loose moving parts. |
This comment has been minimized.
This comment has been minimized.
That was one of my worries when I started, but while playing it seemed fine:
I didn't notice any odd behavior yet, but may needs some more testing.
Yes I'm with you on that, I was just wondering if reducing the stamina gain while sneaking would add something or if it would be just a gimmick. The range for reducing is only 3 points/turn: stamina gain 10/turn, walking burns 7/turn, running burns 20/turn (without any modifiers). So I'll scrap that idea.
Hm, sounds reasonable. Currently only the lighting affects at what range a creature detects another one.
Would be great to give players a reason to wear lighter/less armor if that would mean they're not getting spotted so easily. At the moment more armor is better every time if you can life with the encumbrance.
Didn't even notice that, you're right. And this would also solve another thing I don't think should be there: - sneak into the vision range of a monster
How many move points would be appropriate for this? 20? |
This comment has been minimized.
This comment has been minimized.
That's the only stuff that affects you're footstep/movement sound (in my version).
|
BevapDin
reviewed
Feb 2, 2018
| @@ -188,6 +188,9 @@ bool Creature::sees( const tripoint &t, bool is_player ) const | |||
| } | |||
| if( is_player ) { | |||
| // Special case monster -> player visibility, forcing it to be symmetric with player vision. | |||
| if( g->u.move_mode == "sneak" ) { // not symmetric if the player is sneaking | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ecroffleps
Feb 3, 2018
Author
Contributor
The is_player flag is set if the target is the player, so i need to refer to the player like that to check if he is sneaking.
Maybe it would be better to check if the target creature is sneaking in the bool Creature::sees( const Creature &critter ) function and then adding a parameter to this function like: bool Creature::sees( const tripoint &t, bool is_player, bool is_sneaking )
That would also prepare for sneaking enemies (pretty terrifying thought)
This comment has been minimized.
This comment has been minimized.
BevapDin
Feb 7, 2018
Contributor
A comment explaining the use of the global g->u and a @todo mark should be fine. You could also make a virtual bool Creature::is_sneaking() const function, implemented for the player to check the move_mode.
BevapDin
reviewed
Feb 2, 2018
| //~ Movement type: "running". Max string length: one letter. | ||
| const auto str_run = pgettext( "movement-type", "R" ); | ||
| wprintz( w, c_white, " %s", move_mode == "walk" ? str_walk : str_run ); | ||
| wprintz( w, c_white, " %s", move_mode == "walk" ? str_walk : |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ecroffleps
Feb 3, 2018
Author
Contributor
Yeah, thought so myself, but changing it would break old savegames?
ecroffleps
added some commits
Feb 7, 2018
This comment has been minimized.
This comment has been minimized.
|
New commits implement the suggestion by Kevin where toggling the move-mode is free but if you take an action affected by move-mode changing from running/walking to sneaking and vice versa now costs 20 moves. The selected_move_mode is displayed next to the active move_mode in yellow (for some reason I can't add pictures, I'll try again later) Sneaking now also affects the output of But probably the biggest change is the new way
To make it easier to understand (for you and for me) i made this google-doc which shows you the wanted_range (distance between creature and player) and how it is affected by the modifier: This probably still needs some work but I kind of like that running makes you more visible, it just makes sense that way. |
BevapDin
reviewed
Feb 16, 2018
| if ( !data.read( "selected_move_mode", selected_move_mode ) ) { | ||
| selected_move_mode = move_mode; | ||
| } | ||
| data.read( "move_mode", moved ); |
This comment has been minimized.
This comment has been minimized.
BevapDin
Feb 16, 2018
Contributor
You're reading the same JSON value as above (line 732), is this intentional?
This comment has been minimized.
This comment has been minimized.
ecroffleps
Feb 16, 2018
Author
Contributor
No not intentional, thank you. Should read the "moved" value.
BevapDin
reviewed
Feb 16, 2018
| modifier -= get_skill_level( skill_survival ) * 0.025; | ||
|
|
||
| // encumbrance on bodyparts has negative effect (every 20 points = 1%) | ||
| modifier += (float) ( encumb( bp_torso ) + encumb( bp_head ) + |
This comment has been minimized.
This comment has been minimized.
BevapDin
Feb 16, 2018
Contributor
That cast is unnecessary, the right side of the division is already a floating point value (2000.0), the left side will be converted to a floating point value automatically.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I don't understand the issue with the failed build, having astyle regression in files I didn't touch?
Only thing i can think of is: Do I need to merge in changes from upstream/master? |
This comment has been minimized.
This comment has been minimized.
|
@ecroffleps no, then a merge conflicts message would be at bottom of page. |
Coolthulhu
reviewed
Mar 3, 2018
| @@ -11168,7 +11199,11 @@ bool player::has_weapon() const | |||
|
|
|||
| m_size player::get_size() const | |||
| { | |||
| return MS_MEDIUM; | |||
| if ( move_mode == "sneak" ) { | |||
| return MS_SMALL; | |||
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Mar 3, 2018
Contributor
This doesn't look good: small size makes one harder to hit, including in melee.
Would be better if you just special cased this in sight-related functions.
This comment has been minimized.
This comment has been minimized.
ecroffleps
Mar 13, 2018
Author
Contributor
Hm, if it is harder for us to hit smaller targets why not making it harder for them to hit us in this case?
I looked into this and think that penalizing your dodge roll (easy to implement) and the players melee damage/force/strength (can't find a proper place?) while sneaking is a better and more realistic (you're not as mobile and can't put your full body weight into the attack) option for this?
This comment has been minimized.
This comment has been minimized.
pipehat
May 10, 2018
Contributor
I love the small size effect because it could create options for small door (House with dog door... and zdog inside; cramped maintenance tunnels in sewers; small cave passages; etc)
Coolthulhu
reviewed
Mar 3, 2018
|
|
||
| // having moved during last action adds 12.5% to 50% depending on movecost (slower is better) | ||
| if ( moved ) { | ||
| modifier += ( 0.25 / ( movecounter / 100.0 ) ); |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Mar 3, 2018
Contributor
You only seem to use the moved and movecounter for this modifier. You could merge them into one counter that tracks the penalty to stealth.
Coolthulhu
reviewed
Mar 3, 2018
| } | ||
|
|
||
| // survival skill helps with staying hidden in all circumstances (2.5% per level) | ||
| modifier -= get_skill_level( skill_survival ) * 0.025; |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Mar 3, 2018
Contributor
Survival skill is already way too generalized and does everything at once. From foraging mushrooms, through being an edgy nihilist who feels no guilt for maiming undead humans, to extracting sci-fi gadgets from corpses.
Perception would be good here - if you can't see or hear yourself, you're either amazing at hiding or terrible at perception.
Coolthulhu
reviewed
Mar 3, 2018
|
|
||
| void player::change_move_mode() | ||
| { | ||
| if ( selected_move_mode != move_mode ) { |
This comment has been minimized.
This comment has been minimized.
Coolthulhu
reviewed
Mar 3, 2018
| @@ -176,7 +176,8 @@ bool Creature::sees( const tripoint &t, bool is_player ) const | |||
| const int range_night = sight_range( 0 ); | |||
| const int range_max = std::max( range_day, range_night ); | |||
| const int range_min = std::min( range_cur, range_max ); | |||
| const int wanted_range = rl_dist( pos(), t ); | |||
| // If monster sees player is checked wanted range is affected by a modifier | |||
| const int wanted_range = rl_dist( pos(), t ) / ( is_player ? g->u.get_sees_modifier() : 1.0f ); | |||
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Mar 3, 2018
Contributor
You can pass the sees_modifer as an argument from above - this will make the whole thing much cleaner and allow generalizing stealth to other critters.
ZhilkinSerg
added
<Enhancement / Feature>
Game: Balance
[C++]
<Bugfix>
labels
Apr 2, 2018
This comment has been minimized.
This comment has been minimized.
|
@ecroffleps are you still coding this? |
This comment has been minimized.
This comment has been minimized.
|
Since it wasn't mentioned in the ticket itself, I think it bears remembering to adjust NPC followers to automatically change their movement type to that of player's. While it may be reasonable to sometimes allow companions to hold position while the player sneaks elsewhere, at times it should be possible for the whole group to move somewhere stealthily. I also do agree that gear should have some sneaking modifier. I don't think everything needs to have such, but items affecting it the most (like aforementioned rattling, metal armors) should. |
This comment has been minimized.
This comment has been minimized.
|
@BorkBorkGoesTheCode Kind of, I'm pretty busy studying right now. Only made a few minor changes since last commit. I mainly was testing it out with a few characters and playing with the modifiers quite some time. Hitting the sweet spot between being completely useless and totally overpowered is proving to be pretty hard. @FulcrumA That's a good point. |
Night-Pryanik
added
Controls / Input
and removed
<Bugfix>
labels
May 8, 2018
This comment has been minimized.
This comment has been minimized.
|
How about having a separate sneak skill and not being able to target hidden creatures, though still visible (to the player) and subject to AOE attacks? I realize this is a major change and may be outside the scope of the current version. |
This comment has been minimized.
This comment has been minimized.
|
@ecroffleps How's progress? |
ZhilkinSerg
added
the
(S5 - OnHold / Stalled)
label
Jun 16, 2018
This comment has been minimized.
This comment has been minimized.
|
Feel free to reopen. |
ZhilkinSerg
closed this
Jun 16, 2018
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: |
ecroffleps commentedFeb 1, 2018
•
edited
The Idea
Adding a new crouched/sneaking movement mode which leads to more possibilities in traversing the wasteland and probably avoiding fights.
Closes #20431
Current state
At the current stage (pretty minor changes) I added a new movement mode "sneak" that simply halves your movement speed, the sound your footsteps make and
the distance at witch monsters and NPCs detect youchanges the way monsters/NPCs detect you by taking into account your sillhouette, movement speed (if moving), encumbrance and survival skill for all movement modes (see later comment).I played a few rounds with these changes and it already adds a lot to the gameplay imho, especially during the early game and while looting citys. Balancewise I think it's not even overpowered since a regular zombie will still spot you at around 20 tiles away and being so slow you're not going to walk around in sneak mode the whole game. NPCs being more "alive" and "intelligent" will still notice you at around 40 tiles so no walking up to someone and "stealth killing" them, in the end you're just crouchwalking around on the street in bright daylight.
Further ideas (for new PR or this one)
Currently sneaking burns the same amount of stamina as walking (imho it should be more cumbersome?)not requiredEdit by @Leland: reopened related issue and added auto-close keyword