-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Prevent overmap mongroups from spawning on top of faction bases #49377
Conversation
c6c4819
to
ff48f3e
Compare
Anthills and sewers use a hardcoded monster placement in |
Already done. See changes to overmap.cpp L1600-1760. |
5cd81c6
to
58c5338
Compare
Rebased after 0.F release. Could someone take a look at this change? |
sorry for delay, health has been terrible on my end, but since i'm the one who asked for this i definitely meant to respond sooner. at a glance the code looks the right shape. i'm not sure if i wish i could provide a more concrete approval, but all i can do right now is say "i see nothing that concretely should prevent this from being merged" edit: if someone else doesn't get to it first, i'm going to try to review it properly in the coming days, but i have prior commitments (like hopefully helping korggent fix the mouse support for the new graphical overmap tech) |
Maybe it could be renamed to 'safe_at_worldgen', or 'cleared_at_worldgen' since that's basically what the process does, i.e. it sees that a group of spawned enemies is somewhere they shouldn't be and it erases them out of existence. |
'safe_at_worldgen' sounds good to me (if a bit verbose). 'cleared_at_worldgen' could be interpreted as removing all creatures or items or something else. [Done] |
(Coming from #49980 where I made a similar mistake) It looks like you forgot to add serialization for the new (This is an easy mistake to make, so I'm prioritizing my plan to add a |
That was intentional. |
Cool. Sorry for the noise. |
does this mean if something with that tag generates at the edge of an overmap, then it won't be protected against things that generate in that next overmap over if there's a save/load cycle in between? |
Hmm, yes that is a thing that could happen with very low probability. Alright then, take a look at #50046 for a fix. |
Summary
Balance "Prevent overmap mongroups from spawning on top of faction bases"
Purpose of change
As discussed in #49322 one of the blockers for making faction bases (e.g. Refugee Center) appear only once per gameworld is the concern that a faction base may spawn in a "broken" state (in particular, overwhelmed by ants, fungaloids, triffids or blobs spawned by a nearby anthill/spire/grove/pit). While I personally believe this is extremely unlikely, I agree that we should try to prevent it from happening. This PR makes faction bases "safe" from overmap mongroups placed at worldgen time. It does not prevent mongroups from moving into these bases if "wandering hordes" is turned on and the player makes enough noise to attract nearby hordes. It also does not prevent monsters generated by mapgen (such as the Refugee Center zombies) from spawning.
Describe the solution
SAFE_ZONE
SAFE_AT_WORLDGEN
JSON flag for overmap specialsDescribe alternatives you've considered
Preventing monster-spawning map specials from being placed close to a faction base. That seems much more complicated to do.
I considered either persisting/reloading the overmap's
safe_at_worldgen
set or rebuilding it on game load using the already-persistedovermap_special_placements
JSON attribute. But sincesafe_at_worldgen
is only needed during worldgen (i.e. whenever a new overmap is generated) this is not necessary.Instead of redirecting most of the existing
add_mon_group
calls to a newspawn_mon_group
function, I considered adding a bool argument, i.e. changing the signature to something likeadd_mon_group( const mongroup &group, bool initial_spawn = false )
. But I think a separate function is cleaner (easier to trace references, more intuitive invocation).Testing
I boosted the spawn chance and area of effect of fungal towers to extreme levels, like so:
I then created a new world with default settings, used the evac shelter console to get the location of the Refugee Center and teleported there. As expected there was a fungal tower nearby.

I teleported to the south/north/west/east boundaries (where the fences are) and verified that there are plenty of fungal monsters outside the fence but none inside the fence:




In the refugee center building the only living creatures are the refugees and the back bay zombies.

Additional context
The following locations have been tagged with
SAFE_AT_WORLDGEN
:Did I miss anything?