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

Add los check to npc positions on overmap... #16430

Closed

Conversation

Projects
None yet
5 participants
@lucianposton
Copy link
Contributor

commented Apr 28, 2016

...so that you can't see NPC positions from across the world, when dark, etc.

@AdonaiJr

This comment has been minimized.

Copy link

commented Apr 29, 2016

I guess maybe some people will complain, but I particularly think it add's to immersion and (some level of) better realism.

As a vision (sugestion) of mine, maybe in the future (you awesome dev's guys) could implement some kind of mechanic's like finding other people (or new missions) scanning radio frequencies (I'm not sure if there's already something of this kind). Maybe just people you've met before and asked for their frequency, by dialog options.

@Coolthulhu Coolthulhu self-assigned this Apr 29, 2016

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2016

Doesn't work properly with z-levels - you can see NPCs above your basement. Other than that it seems to be working.

I'll wait for others to tune in about the balancing, though. Losing (as in, being unable to find) a NPC can be annoying, especially without an ability to shout to all nearby NPCs to respond and say where they are.

@Coolthulhu Coolthulhu removed their assignment Apr 29, 2016

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2016

Doesn't work properly with z-levels - you can see NPCs above your basement.

I couldn't reproduce this problem. While in an evac shelter basement, I couldn't see an NPC on the overmap when the (follower & non-follower) NPC was directly above me, nor when the npc was 1 tile away to the north in the upper layer. Any suggestion for reproducing this problem?

I'll wait for others to tune in about the balancing, though. Losing (as in, being unable to find) a NPC can be annoying, especially without an ability to shout to all nearby NPCs to respond and say where they are.

In day lighting, the overmap view distance is pretty far. Something like 10 overmap tiles. That's about as far as you could reasonably yell. Though, at night, yea, you'd expect you could yell to locate someone.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2016

Any suggestion for reproducing this problem?

Try getting a good light source so that your '@' is in daylight level of brightness.

In day lighting, the overmap view distance is pretty far.

NPCs seen with regular sight aren't a problem. The problems start when the NPC is behind a corner or something like that.

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2016

Try getting a good light source so that your '@' is in daylight level of brightness.

Tried with a flashlight, but no luck reproducing the issue. Did you experience this at a shelter basement? or somewhere else?

The problems start when the NPC is behind a corner or something like that.

Overmap los doesn't factor in corners. iirc, it's just a distance calculation using the characters overmap sight points (increased with some traits and binoculars) plus lighting. Zombie horde markers on the overmaps uses the same fyi.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2016

Tried with a flashlight, but no luck reproducing the issue.

You need something that would let you see at near full range. The overmap sight function has a breakpoint at 48. A floodlight should work.

Add bird eye and scout mutations and binoculars item to see it further. Each tile of solid stone is worth 5 field tiles, so at perfect conditions, you should have a range of 5-6 tiles.

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2016

@Coolthulhu Oh, I see what's happening. While underground, sight_points are always going to be 0 (Only exception to this is using debug night vision. Fey Nightvision, Bird Eye, Binoculars aren't even sufficient). The natural_light_level value() is LIGHT_AMBIENT_MINIMAL while underground (zlevel < 0). See

Cataclysm-DDA/src/game.cpp

Lines 5801 to 5802 in 9ed289c

if( zlev > OVERMAP_HEIGHT || zlev < 0 ) {
return LIGHT_AMBIENT_MINIMAL;
. Consequently, minimal ambient light works out to 1 range due to truncation in
#define LIGHT_RANGE(b) static_cast<int>( -log(LIGHT_AMBIENT_LOW / (float)b) * (1.0 / LIGHT_TRANSPARENCY_OPEN_AIR) )
. 1 range is less than the width of an overmap square (12), so the overmap_sight_range is always 0 when underground. See

Cataclysm-DDA/src/player.cpp

Lines 4004 to 4006 in 9ed289c

int sight = sight_range(light_level);
if( sight < SEEX ) {
return 0;

If you're above ground, then, yes, it's possible to see an NPC above/below you on the overmap. This bug in the overmap los check affects other calculations too (Hordes and mongroups, whatever those are, are the only others using this calculation as far as I see, though not sure if either of those can appear underground.).

Doesn't work properly with z-levels - you can see NPCs above your basement.

I surmise you either had debug night vision or were actually looking down into the basement (or up at a multi-z-level building). Is that accurate?

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2016

Added commit to prevent overmap los from crossing underground z levels.

@lucianposton lucianposton force-pushed the lucianposton:fix-superman-vision branch to 41c7b33 Apr 30, 2016

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2016

@AdonaiJr Created #16454 for your idea

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2016

@Coolthulhu

I'll wait for others to tune in about the balancing

Who are we waiting for, specifically? So that this PR doesn't fall by the wayside, please @ mention them so they are notified and aware that this PR is blocked on them.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented May 1, 2016

I'm not convinced this would be a good change.

NPCs are rather easy to lose. Quest givers can run off, AI can decide to charge into zeds, NPCs can decide to hide in tiny, dark rooms etc.

@lucianposton

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2016

NPCs are rather easy to lose. Quest givers can run off

You can still see them run off and make chase, unless there is total darkness. The overmap view distance is about 8 overmap tiles during day lighting, and that increases with vision enhancing traits/mutations/bionics/items. That's plenty of leeway in my experience so far playing with this patch. Overmap view distance and los is considerably better than local terrain view distance / los.

The real issue I see here is that there is no way to communicate with NPCs that you can't see e.g. when you are in total darkness. @AdonaiJr suggested radio communication. Above, you or he suggested yelling to locate NPCs in the total darkness. I think those are better solutions to the problem than the current superman vision (I particularly like the latter, as it has the consequence of making sound to draw zombies / hostile NPCs / hordes).

AI can decide to charge into zeds

Same as above, you can see this happen (perhaps even hear the fighting). You can also communicate with amenable NPCs to instruct them not to do this, so there are already options for the player to address this. Realistically, if someone runs off into the distant so far that you can no longer see him, you shouldn't know his position.

NPCs can decide to hide in tiny, dark rooms etc.

How does this factor into overmap line of sight? Overmap los is different than local terrain line of sight. Local terrain, like walls, isn't a factor here.

Also, keep in mind that there are positive aspects to this change. With it, the overmap info better mirror's the player's vision capability, including light attenuation, vision enhancing traits, and bionics/binoculars optics. For example, consider that irl distant vision at night has low resolution. Consequently, you can see building outlines in this distance, but not details like a distant human figure in the darkness (unless you have night vision enhancements, of course, which is factored in w/ this change). So factoring in overmap vision distances into NPCs drawn on the overmap makes more sense than treating NPCs like stationary overmap markers (like building locations), which are always drawn, regardless of distance/vision factors. Another nice thing about this change is that the overmap info better reflects the player's knowledge. You shouldn't know the exact location of a wandering survior across the world e.g. in a different city.

@lucianposton lucianposton referenced this pull request May 4, 2016

Closed

[CR] Shout to npcs #16518

@BevapDin

This comment has been minimized.

Copy link
Contributor

commented May 5, 2016

Regarding loosing NPCs, how about a minimum sight radius of 3 or 4 (under all circumstances, but only for detection of NPCs)? This would still hide NPCs that are far away, but would show those that are inside the reality bubble. (And NPCs outside the reality bubble don't move.)

@mugling

This comment has been minimized.

Copy link
Contributor

commented Jul 9, 2016

Stalled with lack of consensus. Could be resubmitted with changes although discussion of design via issue may be most appropriate before continuing with further work.

@mugling mugling closed this Jul 9, 2016

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.