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

Hordes improve #6659

Closed
wants to merge 3 commits into from

Conversation

Projects
None yet
7 participants
@Reaper42
Copy link
Contributor

commented Mar 15, 2014

Add horde reaction by light. Check light indoor/outdoor.
Show hordes on overmap (in visible range of player)

@Lain-

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2014

Pretty cool, looking forward to this.

HSIG_NOICE,
HSIG_LIGHT,
HSIG_SMOKE,
HSIG_SMELL

This comment has been minimized.

Copy link
@kevingranade

kevingranade Mar 16, 2014

Member

Before you get started on working with smell, I don't think signalling hordes is going to be a good match for smell. For that I think a map would be the most appropriate.
Here's how it would work:
Every turn, every player (player or NPC) writes the current turn and maybe a scent strength to the overmap tile they're in, possibly with some exceptions (in a car prevents it, no writing scents to water type tiles, fields might store scent more strongly than roads, etc), it might also use the player's current scent attribute, which can be manipulated by a few things.
Every horde turn, each horde checks the scent of the 9 tiles around them and compares it to whatever else they're doing. At this point the code can compare the timestamp of the scent in that map tile to the current time to decide how fresh the scent is. Possibly we'd have a separate scent strength value that would make it easier to pick up, but wouldn't prevent them from following the trail in the direction of newer scents.
If they're hot on the trail of a noise or recently saw something, they'd ignore the scent, but if they're just wandering around they'd be eager to follow it. If they decide they want to follow the trail they'll move in the direction of the freshest scent.


}

/*int overmap::signal_hordes_smoke(int x, int y, int sig_power, mongroup zg)

This comment has been minimized.

Copy link
@kevingranade

kevingranade Mar 16, 2014

Member

I'm having trouble imagining zombies seeing a smoke cloud and deciding to move toward it, it's a bit too abstract a signal, you know?

This comment has been minimized.

Copy link
@KA101

KA101 Mar 16, 2014

Contributor

Especially given smoker zeds. ;-)

@@ -4429,6 +4429,37 @@ float map::light_transparency(const int x, const int y) const
return transparency_cache[x][y];
}

This comment has been minimized.

Copy link
@kevingranade

kevingranade Mar 16, 2014

Member

Rather than limiting light signalling to a semi-random light source once every 10 turns, how about getting the strongest light source in the active map and using that? As we process the lightmap, store the intensity and location of each light source as we go, sorting them in order of strength.
Once we're done, go through the light sources from strongest to weakest until we find one that's outside, then use that one to signal the hordes.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2014

"how about getting the strongest light source in the active map and using that?"
If we have 20 weak light singnals it be work as 1 weak light signal in this case. (If i right understand you)
Also i want to write check visible direction of light signal and this solution blocked possibility of their check.
"Smoke"
I don't know now what do with smoke sgnals and how to call it :) I think light sighals enough now...and smoke reaction - it so hard:)

@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 16, 2014

I don't think there's a sensible way to combine intensity of light sources together, not if we want to reward players for enclosing lit areas so they don't let light leak out.
That's why I said compile the light sources into a list ordered by intensity, I was thinking about directional lighting. For each direction you can check each light source in turn until one is clear, starting with the strongest and going down the list. I'd think a decent approximation would be to either do cardinal directions (north, south, east west) or also the sub-cardinals (northwest, southwest, southeast, northeast) and drawing a line from that edge of the map to the chosen light source.
Finally something I forgot to mention earlier. I'd like to reduce the effect of light based on ambient light intensity, probably just subtract ambient light level from the source level. during the day extra light isn't going to be noticeable.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2014

Max light signal distance determined from ambient light now.
(overmap.cpp
2172 int max_dist = (100-(g->light_level()*2));
)
Also now light power not determined to signal because in night light from flashlight and oil lamp seen approximately equally well. The idea being that light from a large area more noticeable than light from a single point irrespective of intensity.
(int overmap::signal_hordes_light(int x, int y, int sig_power, mongroup zg)
int sig_power - not used in this method)

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2014

And i can't use full list of light sources. Light from lava or light from zombie shoker may be cause of wrong singals.

@OvenBaker

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2014

The simplest solution to your "wrong signals" problem would be to just use light as one of the weaker signals that the zombies process. AFAIK, accordingly to the lore zombies don't see well at all, preferring to hunt by smell and sound. If a horde mistakenly follows and falls into lava because absolutely nothing else is going on around them... well, that seems just fine to me.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Mar 16, 2014

If a horde mistakenly follows and falls into lava because absolutely nothing else is going on around them... well, that seems just fine to me.

Plus it means they'd move around due to stimuli other than the player, which would mean more dynamic wandering overall.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

In practice this means that the player can accidentally attract zombies will be walking around if their asylum and stumble on the source of lava. Zombies will not jump into the lava, they just appear around this place on 10-20 overmap tiles. It is frustrating for the player, which is why he did not commit such errors to attract zombies.
Also, it is not realistic, as the lava was always on the map, and zombies come only when the player found it.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

"one of the weaker signals" may be signal from console (I can't send it to zombie. Cause such as situation with lava), sombie shoker, portal..may be something else.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

Finally i don't see logic of solution with "one of the weaker signals". TO burn house and turn on oil lamp. Signal go to horde from oil lamp?

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

Direction of light signal - it's not problem now. Code already checks edges of map. Problem - more accurate calculation of him visibility for horde.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Mar 17, 2014

Finally i don't see logic of solution with "one of the weaker signals". TO burn house and turn on oil lamp. Signal go to horde from oil lamp?

This makes me think of range, distractions, etc.

Example: I set a bonfire 3 map tiles away and sneak around to get past the horde. While sneaking, I light a glowstick to scope out a room I thought was windowless, but OOPS there's a window.
And I'm a moving light source with that glowstick, nowhere near the intensity of the bonfire but much closer. What happens?
a) do the zeds focus on the biggest signal (the fire)
b) do they lock onto the nearby small signal (me D: )
c) might the horde split to check on both (long-term goal, most likely)

If b), I'm being chased, I throw the glowstick one way and run the other. How effective might that be?

@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 17, 2014

By "weaker signal" he means that light shouldn't be as important as sight or smell.
There's no "wrong" stimuli, if a player wandering around with a light attracts zombies, why wouldn't a shocker wandering around do the same? It doesn't matter if it's the environment that attracted the zombies, the player has to react to it and either control it or avoid it.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Mar 17, 2014

Reasoning on the zed-based stimuli: since the Blob upgrades zeds (and is likely responsible for the Smoker at least), I was thinking that it's somewhat logical to conclude that it wouldn't make zeds that undermine its troops' ability to function. So a horde would be able to (learn to) ignore its own Smokers, Shockers, etc as target-stimuli.

Other such zeds not part of a given horde might not be recognizable to that horde and cause distractions, yeah.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

"What happens?"
In this code for one signal:
a) ignore both
b) go to capmfire
c) go to glowstick
d) go to target between capmfire and glowstick
for multiple signals - opinion "d"
For this horde size and swapn system - it does not matter. They just come.
"There's no "wrong" stimuli"
There it "wrong" stimuli. Because map is unactive while player not go in. And player can't control wander shocker or terminal in start shelter or lava or abandoned car with turn on headlight or something else. It just appears and just make players frustrated. In this case i may just spawn randomly zombies around player and not write this all.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 17, 2014

Hey guys! It's not fully functionally horde. It just moving spawn point. For good horde need active map on all game world.
I talk with you longer that i write code..

@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 18, 2014

We can't make the whole game world active, but for purposes of this kind of
thing we can make it "big enough", as in 100x larger than it is now
(overmap scale).
I'm planning on adding "static type hordes" which will also use this
signalling code to guide their movement.
Having light or sound the player doesn't cause attract hordes is not "as
bad as random", the player can take action to control their environment by
building walls, avoiding lava, and killing nearby light-generating monsters.
The light code here only considers the first light source rendered, this is
an arbitrary bias that breaks it, leading to things like players lighting
fully surrounded fires to the northwest of their base so it will
short-circuit the system (or perhaps just placing glowsticks surrounded by
walls around their base). That is why I suggested building a list of light
sorces and evaluating all of them, it's a fast way to ensure that the
strongest light visible from a certain direction is used.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 18, 2014

Are you sure you can increase the active map 100 times? I am sure that my computer will make a one turn in a minute. May be you have supercomputer, or you have plan for cool code optimization, but i not have all it.
Also had the idea that zombies only reactnot to new or moving light sources, so I do not want to use the light from the lava and consoles. Things i do not want to use too, because the present it is hard to control. The essence of all that my system is that it is simple (NOT full) implementation of emulation zombie hordes.
So for a player has practical meaning such disguise, as closing the windows at night, a ban on the use of light outdoors at night in areas populated by zombies. Carelessness is punished that night, the player may need to quickly gather their belongings and flee.
Let's do the following. You add this code to me finish what I started. And when will the infrastructure (100x active map) for all that you want me (or anyone else) will finish it all. Switch to use list of light sources it's not much work, but while we're debating the work is worth.

@CIB

This comment has been minimized.

Copy link
Contributor

commented Mar 18, 2014

Don't need an active map, really, if we make hordes single-overmap-tile and make it store which zombie types are in it, we can just process everything on an overmap scale. Only issue might be pathfinding, but at this point that seems optional.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Mar 18, 2014

To be clear and focus on one issue, the current implementation picks
whichever light source the renderer finds first and uses that in exclusion
to all other light sources. This isn't simple, this is broken. If there
is a glowstick in the upper left corner of the area being drawn, it will
ignore all other light sources.
Yes I might just merge and fix it myself, but I much prefer to work with
people. Also please clean up all the debug clutter.

@Reaper42

This comment has been minimized.

Copy link
Contributor Author

commented Mar 19, 2014

"Also please clean up all the debug clutter."
Ok.

@Reaper42 Reaper42 closed this Mar 19, 2014

@Reaper42 Reaper42 deleted the Reaper42:hordes_improve branch Mar 19, 2014

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.