Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New crouching mechanics for hiding and stealth #29092

Merged
merged 59 commits into from Apr 18, 2019

Conversation

Projects
None yet
@Wokko1
Copy link
Contributor

commented Mar 28, 2019

Summary

SUMMARY: Features "Add ability to crouch and hide behind furniture, terrain, vehicles."

Purpose of change

The game needed some stealth mechanics, not only darkness, but also LoS and sound dependent.
This PR adds ability to crouch (now on the "toggle move mode" key), which decreases your speed, but makes you quieter and allows you to hide behind furniture, terrain, and vehicle tiles.

Describe the solution

Added json "coverage" value to most of the furniture and terrain.
Added ability to crouch by pressing "toggle move mode" key. It's a separate move mode (along with "Walk" and "Run").
Sound made by the player is reduced while crouching, and increased while running.

When the creature::sees() is checked, the last check is player's crouching. If there's a furniture or terrain tile with "coverage" value on the line between the player and the creature, then the coverage value is used to calculate the distance at which you will be seen. The cover has to be adjacent to player. The distance at which you can be spotted modifies creature's sight only if it's the smallest range available (e.g. no monster will see you behind a bad cover if it's dark).

Coverage >=60% will fully protect you from being seen (counters, sofas, etc) when you crouch. Coverage >80% is usually unpassable, and added for future PR with gun fight mechanics.
Coverage <60% will partially cover you, if a creature comes close to your cover - you will be spotted.
The distance at which you can be spotted is modified by coverage.

Monsters can still find you by smell if you hide in one place for too long. If you start crouching after being spotted, monsters will come to your last known location.

If you stand on furniture or non-flat slowing-down terrain, you won't be able to hide.

You can hide behind cars too.

Size modifiers for visibility calculation.

Describe alternatives you've considered

Making something more complex is out of my power, as I still lack skills. I consider this solution being fun enough and not too complex.

Additional context

I was heavily inspired by Evil Within 2's stealth mechanics, where you crouch behind crates and cars to hide from zombies. Wanted to make something simillar for Cataclysm.
Closes #20431

Wokko1 added some commits Mar 26, 2019

@Wokko1 Wokko1 changed the title New crouching mechanic for hiding and stealth New crouching mechanics for hiding and stealth Mar 28, 2019

@Wokko1

This comment has been minimized.

Copy link
Contributor Author

commented Mar 28, 2019

I have no idea why the builds failed. There weren't any errors in the code, I think?
edit: There are definitely no errors in the code.

Wokko1 added some commits Apr 4, 2019

upd
upd
upd

@ZhilkinSerg ZhilkinSerg removed their assignment Apr 4, 2019

@Amoebka

This comment has been minimized.

Copy link
Contributor

commented Apr 6, 2019

Crouching should most certainly take into account player's size (maybe not right now but eventually). A tiny mouse mutant can hide much better than a hulking car-sized cattle mutant.

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

Should close #20431?

@Wokko1

This comment has been minimized.

Copy link
Contributor Author

commented Apr 6, 2019

Should I include something like "closes #xxxxx" in the description?

I'm afraid that issue is not the only one about stealth, and finding all of them, analyzing, and deciding "is this PR relevant for them?" would be tedious.

About the player sizes: surely size should matter for stealth, but I won't be able to code for 1-2 weeks. I'll probably add sizes after those two weeks, or if this PR gets merged, I will make a new PR with size-dependant calculations later.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor

commented Apr 6, 2019

Crouching should most certainly take into account player's size (maybe not right now but eventually). A tiny mouse mutant can hide much better than a hulking car-sized cattle mutant.

Mouse mutations have stealth_modifier which already included in player::visibility(), but additional check for body size will be nice.

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

Should I include something like "closes #xxxxx" in the description?

Yeah.

@Shibimon

This comment has been minimized.

Copy link

commented Apr 9, 2019

Probably not in the scope of this PR (maybe) but monsters should have this too.
Half zombies, prones, little creatures and whatnot could hide behind furniture (or inside if really small) webs (player too if has related mutations) and bushes (a normal sized player could hide inside a bush) making them invisible till you stand in a correct angle, or they surprise attack you.
It will bring interest into poking bushes with pointy sticks or spears too, or throwing things at them, mature farm fields dangers, and monsters hidden below vehicles.

@Wokko1

This comment has been minimized.

Copy link
Contributor Author

commented Apr 15, 2019

Update: player sizes are taken into consideration for stealth.

@dissociativity

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2019

does dexterity or perception influence this? It'd be nice for strength-heavy characters to finally be meaningfully garbage at something and make strength not the objectively best stat for once :P

@Wokko1

This comment has been minimized.

Copy link
Contributor Author

commented Apr 15, 2019

does dexterity or perception influence this? It'd be nice for strength-heavy characters to finally be meaningfully garbage at something and make strength not the objectively best stat for once :P

I don't know how stats should affect this, you are just crouching. Strength can't give penalties for stealth because "stronger" doesn't mean "bigger". Propose something if you have good ideas, please.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

Needs styling

Wokko1 added some commits Apr 16, 2019

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

This is good to go, but it's going to need some follow-up.
Namely, we need to expose info about hiding to the player.

  1. How good terrain/furniture is at hiding you.
  2. What areas the player has shelter from.
  3. Approximate distance at which monsters will detect the player,
  4. Expose the mechanic itself, probably stick it in the furniture/terrain description.

@kevingranade kevingranade merged commit 69dc10f into CleverRaven:master Apr 18, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
gorgon-ghprb Build finished.
Details
@Probe1

This comment has been minimized.

Copy link

commented Apr 18, 2019

It's too late to point this out but putting crouch on the same binding as run/walk was a poor choice.

@Wokko1 Wokko1 deleted the Wokko1:Crouching branch Apr 18, 2019

@adamkad1

This comment has been minimized.

Copy link

commented Apr 18, 2019

well maybe you can find a better binding

@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 19, 2019

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/crouching-looks-new/19722/3

@suddenly-cuddlebiscuit

This comment has been minimized.

Copy link

commented Apr 20, 2019

Bug/unwanted behavior:
Depleting stamina while running currently forces the player to crouch instead of slowing to a walk. This increases keypresses for the player to match previous behavior without adding value, and is very easy to miss in the action log in busy environments.

Please return out of stamina while running behavior to default.

Interesting addition otherwise, though it should be a movement modifier, rather than a movement speed, as noted by others.

@codemime

This comment has been minimized.

Copy link
Member

commented Apr 20, 2019

Bug/unwanted behavior:
Depleting stamina while running currently forces the player to crouch instead of slowing to a walk. This increases keypresses for the player to match previous behavior without adding value, and is very easy to miss in the action log in busy environments.

Please return out of stamina while running behavior to default.

Interesting addition otherwise, though it should be a movement modifier, rather than a movement speed, as noted by others.

This is definitely a bug deserving a separate issue.

@evankimori

This comment has been minimized.

Copy link

commented Apr 23, 2019

Does this crouch mechanic affect noise made as well by footsteps, character footwear, noisy traits etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.