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

Attacks from under ceiling with 3D FOV on. #29175

Closed
curstwist opened this issue Mar 31, 2019 · 3 comments · Fixed by #30940 or #32827
Closed

Attacks from under ceiling with 3D FOV on. #29175

curstwist opened this issue Mar 31, 2019 · 3 comments · Fixed by #30940 or #32827
Labels
<Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. Z-levels Levels below and above ground.

Comments

@curstwist
Copy link
Contributor

Describe the bug
When on a roof, zombies from inside the building can use special attacks on you, most notably shockers.

To Reproduce

  1. Turn on 3D FOV
  2. Get a nice hoard and lure it into a json roofed building.
  3. Get on roof, enjoy endless perfectly targeted shocks.

Expected behavior
No attacks through the roof from inside.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions and configuration(please complete the following information):

  • OS: Win10
  • Game Version: 0.D:1214
  • Graphics version: TILES
  • Mods loaded: none

Additional context
On roof getting shocked
shocker below
shocker below & inside
shocker
gifs are fun
shocker

@Night-Pryanik Night-Pryanik added <Bug> This needs to be fixed Z-levels Levels below and above ground. Monsters Monsters both friendly and unfriendly. labels Apr 1, 2019
@kevingranade
Copy link
Member

Here's the execution stack for shockstorm
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/monattack.cpp#L624
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/monster.cpp#L842

bool Creature::sees( const Creature &critter ) const

There are a couple of suspicious things happening here, all of them revolving around creature::sees( creature ).
If the shocker is directly beneath the player, it executes g->m.valid_move( pos(), critter.pos(), false, true ), which is not used and tested a ton in a vertical context, so I wouldn't be surprised if it has a bug or two.
Later the final check is the symmetric g->m.get_cache_ref( pos().z ).seen_cache[pos().x][pos().y] > LIGHT_TRANSPARENCY_SOLID; check, which I'm not 100% convinced is doing the right thing.

Next is either stepping through the code to find out where this is happening, or maybe creating a test to tease it out.

@kevingranade
Copy link
Member

The problem is in 3D shadowcasting, there is some scenario where it allows the player to see the shocker and vice versa. You can see this because the shocker will intermittently appear on the threat compass as you wander around.

@kevingranade
Copy link
Member

It turns out it is not the shadowcasting algorithm itself, but rather something related to map shifts. If you identify a submap edge (roughly the center of a roof, but not always) and then step over the border, the shocker will see you almost every time, but if you walk around without crossing a border, I've yet to trigger it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. Z-levels Levels below and above ground.
Projects
None yet
3 participants