Author Topic: Evolution for buildings  (Read 1115 times)

Offline Sunshine

  • Zombie Food
  • *
  • Posts: 43
    • View Profile
Evolution for buildings
« on: March 01, 2017, 07:28:53 AM »
Right now, at the start of a new game the overmap is generated, but the actual maptiles aren't created outside the player's reality bubble. Those only get created when you move close to them. Using the .json method, each maptile has an id, but there can be multiple variants with the same id. If there are more than one, the game picks one based on their relative "weights". So if there are 3 variant tiles with a weight of 100, there is an equal chance that any one of them will spawn.

But instead of weight being a static number, it could be based on a timer. That would allow variants to become more or less common as time passes. Like, if you had three variant houses, normal/looted/wrecked, with different timers, you would only find normal houses early on, then looted and wrecked would start to show up. After a few years, normal houses would become a rarity, and towns would be mostly burned out wastelands. The world would seem to be evolving as time passes.

For one, this would allow NPC encounters that make some sense.  The first season you could encounter normal citizens boarded up in their houses, a year later you would find grizzled survivors, and a few years on you might find heavily fortified gas stations defended by colonists. It would also be a way to add more end game content that shows up in the end game. You could make maptiles with high difficulty/high reward without worrying about destroying some poor day 1 survivor (or giving him a suit of power armor).

I thought the timer could have 4 values, a start weight and end weight, and two dates. So a looted house with 10/200, 14/122 would have a start weight of 10 until day 14, then it would steadily climb until day 112 when it would reach it's final weight of 200. That's just an example though. There are probably better ways to do it.

Of course, this would only apply to newly generated maptiles, so your starting area wouldn't evolve. You'd have to travel to find later stuff. And there would be weirdness with multi-tile overmap specials. If you drove past a mansion on the first day, causing only half of the maptiles to load, and then came back a year later, half the mansion would be pristine and the other half would be looted. That might not be a serious problem.

There are cool tricks I could do with overmap specials too. Like I could make an apartment tower called bandit_tower. If you encounter it early on, it would be just be a normal apartment like any other.  But on a certain date, the weights would switch from the normal tiles to the evolved version. If your first visit is after day 56, or whatever, then it will be occupied by Hells Raiders. And after day 112, it would switch again to a fortified base with even more enemies and traps.

The drawback is that this would require lots of .json variants. So even if a timer is implemented, it will be a long time before people go through and make evolved versions of existing structures. It would also mess up a lot of people's current strategies. Early reading and crafting would be penalized because the timer would be slowly reducing the frequency of safe loot in the world.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #1 on: March 01, 2017, 07:36:55 AM »
The problem is, the buildings wouldn't decay "naturally", but rather evolve into different types.

Say, you explore a section of map except one small city, then come back and notice all buildings being the same except for that one city which is now a raider fortress.

I'd rather see it as a system of templates:
Building is generates as usual, but if chance roll is something, the building gets a template such as "boarded up", "small loot cache", "fungified" or even just "old".
This template would be a mapgen entry that doesn't define base terrain and defines replacements. Say, all windows get replaced with boarded up windows, each wall has a 33% chance of becoming fungal wall, each tile has all items removed, each zombie spawn is replaced by a rotten skeleton.

Offline Sunshine

  • Zombie Food
  • *
  • Posts: 43
    • View Profile
Re: Evolution for buildings
« Reply #2 on: March 01, 2017, 08:32:39 AM »
The problem is, the buildings wouldn't decay "naturally", but rather evolve into different types.

Say, you explore a section of map except one small city, then come back and notice all buildings being the same except for that one city which is now a raider fortress.
Yeah that's the fatal flaw. It only changes unexplored parts of the map. It might encourage exploration, but it's weirdly unrealistic.

I'd rather see it as a system of templates:
Building is generates as usual, but if chance roll is something, the building gets a template such as "boarded up", "small loot cache", "fungified" or even just "old".
This template would be a mapgen entry that doesn't define base terrain and defines replacements. Say, all windows get replaced with boarded up windows, each wall has a 33% chance of becoming fungal wall, each tile has all items removed, each zombie spawn is replaced by a rotten skeleton.

The biggest problem with that is that it might get applied to a player's home. It would be pretty sad if you go out to and come back to find all your stuff is gone and all your NPCs are fungal zombies. I don't care because I usually build vehicles, but base-builders would strongly object to anything like that. Maybe there could be something with player-defined zones to keep a place safe. They're in the game now, but aren't used for much. I could imagine something like assigning an NPC to a zone with a size limit of n tiles, and it making a safe zone or at least reducing the chance of an evolution. 

Templates would be cool, but less so if they're hardcoded. Then there isn't much modders can do with it.  But if you make a system of templates that can be defined in jsons, that would be great. I could probably do all the same stuff that way. Would there be a way for it to apply a template to a whole overmap special all at once? If it just lands on one tile it can't make larger NPC compounds.   

Also it would also need to be able apply templates immediately or you would have the same problem in reverse: You would always find pristine places, but they would decay after you visited them. And over time it could possibly apply multiple templates to the same structure, which might have wacky results. That might be cool though. If a house goes from normal to looted to banditized to fungalized, it might look really insane.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #3 on: March 01, 2017, 09:06:52 AM »
1. The biggest problem with that is that it might get applied to a player's home.
2. Templates would be cool, but less so if they're hardcoded. Then there isn't much modders can do with it.  But if you make a system of templates that can be defined in jsons, that would be great. I could probably do all the same stuff that way. Would there be a way for it to apply a template to a whole overmap special all at once? If it just lands on one tile it can't make larger NPC compounds.   
3. Also it would also need to be able apply templates immediately or you would have the same problem in reverse: You would always find pristine places, but they would decay after you visited them. And over time it could possibly apply multiple templates to the same structure, which might have wacky results. That might be cool though. If a house goes from normal to looted to banditized to fungalized, it might look really insane.

1. This one isn't easy, but I think I have some ideas:
For fungalization and similar effects, the zone would need to keep a counter of fungification, which would be increased if the zone was unloaded with fungals nearby, then loaded after some time. The fungification would depend on time between unload/load and number of fungals. That would prevent random fungifications while also fixing surroundings of fungal spires being un-fungalized.
For NPC base claiming, building a billboard would prevent it in some area, "npc-ization" would only proceed if there were NPCs nearby, and player just being around would mark areas as "playerified", which would prevent hostile factions from claiming them.
For building rot, it would generally not happen to buildings just existing. Zombies would cause nearby wooden buildings to slowly lose parts. Brick, concrete and stone would stand forever.

2. For simple templates, no hardcode would be required:
"If you encounter tile x, replace it with tile y" where x is a set of conditions (ie. "this tile is t_floor or t_dirt") and y is some definition, identical to those we use at mapgen, but with added effects such as "remove items".
Advanced templates would require hardcode. For example, "move all items onto one spot", "steal items with value above x", "if you find a mine, place a critter on it, simulate explosion, keep the results, but remove the critter if it survived". Templates could include hardcoded templates as sub-templates.

3. Most would apply based on time between last unload and load. For tiles never loaded, this would mean the whole game time so far.

Offline Sunshine

  • Zombie Food
  • *
  • Posts: 43
    • View Profile
Re: Evolution for buildings
« Reply #4 on: March 02, 2017, 05:33:52 AM »
Templates sound better for fungalization or wasps building nests and so on, the sort of creeping contagion.  And applied to a typical neighborhood where each tile is a separate structure and they're all just jumbled together randomly. But I'd still like some other option for NPC/bandit camps. For example, the NPC ranch  from the quest line has some logic to it; it has outer walls and a workshop and a bar. If you just pass a template over a Home Improvement Superstore, you won't get things that make sense like that. And if you pass a template over an unoccupied ranch you won't get anything because there are just empty fields there to begin with. So, at least for that, I think there should be way to make some sort of time locked overmap special.

Also, I sort of assumed that the overmap wouldn't change, but if you could alter the map as time passed there would be other options. Like you might visit a mall, and then an NPC template would be applied, and then if it lasted long enough it would actually change on the overmap. The next time you visited it would erase and completely regenerate those tiles. There would be a dramatic switch as it changed from a mall with boarded up windows to a mini-city with a bar, and a green house, and orphanage and whatever else.

---

But speaking of templates. There should be a way for the player to trigger them in game.  For fungals you could plant certain seeds to force a change quickly.  But, more usefully, a way to make NPCs (or robots or whatever) do construction while you're away. Base building is fun, but construction is slow and tedious. Just having them board up windows would be great, not to mention if you could have them clean up all the filthy clothing and corpses off the lawn.

---

Really, I could brainstorm all day, but I'm not the one who's going to code any of it.  I made that original suggestion because I thought it would be fairly easy to implement since it's just one change, and that might increase the speed/likelihood of it getting added. Once it exists, then I can do stuff in the jsons. Straight forward things you've added like pallets and map rotating are actually a big help that let me do some cooler stuff.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #5 on: March 02, 2017, 08:16:03 AM »
Proper NPC construction is a totally different thing. Planned, but rather long-term.

Having NPC action replace certain buildings with their NPC-ized versions could be done with templates, though.
For example, consider a template that replaces floor tiles in certain places with new walls (probably log ones, since NPCs have easy access to those), walls in "room" tiles with floor, and unconditionally adds some walls in certain places.
Or maybe it would be better to call it an "overlay" here.

Really, I could brainstorm all day, but I'm not the one who's going to code any of it.  I made that original suggestion because I thought it would be fairly easy to implement since it's just one change, and that might increase the speed/likelihood of it getting added. Once it exists, then I can do stuff in the jsons. Straight forward things you've added like pallets and map rotating are actually a big help that let me do some cooler stuff.

My idea is simple enough that I'm pretty sure I could implement the interface within 2 days or so. I'll probably keep it for 0.D because we "almost" have that damn stable and I keep finding problems to fix.

Offline deoxy

  • Survivor
  • ***
  • Posts: 1411
    • View Profile
Re: Evolution for buildings
« Reply #6 on: March 02, 2017, 04:44:16 PM »
Conceptually, some kind of "aging" would certainly be good, but it needs to be more than just the building - vehicles, fires, etc.  I've had it rolling around in my head for a long time, but I can't come up with any concrete ideas that I like.

Basically, we need some kind of simulated results from known activities without having to do all the activities.  Vehicles in "city" areas should be turned into piles of scrap by zombies (with the aisles and other "passable" squares lasting a lot longer than the others) over time, but with the occasional lucky one that isn't.  A building that's on fire when it's unloaded should be reduced to burned out rubble when you come back, unless some kind of weather event saves it, and it has a chance of spreading to nearby buildings, too (again, chance for weather).  Roadblocks should be worn down by the passing of zombie hordes, bullets being used up by almost any zombie event (as the zombies will get up over and over until the bullets are gone), and cars having a decent chance to be destroyed.  Tankbots and walkers might well still be present, though.

These kinds of things could be handled with a simple "chance to happen per day X number of days since last load", along with some kind of "how many zombies are around" factor (areas you have cleared should stop having problems, at least for a period of time, until a new horde moves in).

A mechanic for NPC activity, fungal activity, and trfiffid activity should all be similar.  A year in, everything within a certain range of a triffid grove should be forest (no buildings or concrete left), everything within a certain range of a fungal tower should be fungalized, etc, and areas of overlap between the two should be... "fun".

The "template" idea could handle NPC activity decently well, and even change areas that have already been visited - just because you already saw it (or even left a stash of useful stuff there) doesn't mean that an NPC (or group of them) couldn't move in and take it over.  Some kind of "minimum time since last loaded" mechanic would help avoid some of the silliest results, and also inherently "claim" the areas that the player visits the most.

The important thing to remember in all these "simulated" things is that the results be possible, not necessarily what would have happened if the player stayed and watched.  Some kind of basic "bash this car X%" action, for instance, doesn't have to exactly match any particular group of zombies bashing it, just be passably similar.  Fires don't have to act perfectly, just have believable results (this one shouldn't be TOO hard - measure burn time on buildings, and torch the building if it's been that long... what happens to the zombies inside is also not really that important, as they would get back up, anyway).  Fungalizing doesn't having to match exactly what would happen with that exact configuration of fungaloids, as activity by animals and NPCs could well have affected their placement along the way.

Even without the NPC activity template portion (which is a GREAT idea!), this kind of thing would both give a greater feeling of "realism" and give some reason to actually go out and find stuff before the late game inherent activity makes stuff harder to get/destroys the stuff before you get there.  Larger cities should become zombie-covered piles of rubble, but most smaller groupings should survive with minimal damage for quite a long time.  Isolated buildings should be nigh-immortal, and have a very good chance of becoming an NPC location.

OOoo, some kind of changes over time around "shimmering portals" would so be nifty, too.
This is the text that goes under the post, and there ^ is the post, so this is where it goes.

Offline Sunshine

  • Zombie Food
  • *
  • Posts: 43
    • View Profile
Re: Evolution for buildings
« Reply #7 on: March 04, 2017, 06:36:32 AM »
Having NPC action replace certain buildings with their NPC-ized versions could be done with templates, though.
For example, consider a template that replaces floor tiles in certain places with new walls (probably log ones, since NPCs have easy access to those), walls in "room" tiles with floor, and unconditionally adds some walls in certain places.
Or maybe it would be better to call it an "overlay" here.

If you're include things like overlays, could there be a tile for it? Like it would be a maptile but flagged "overlay" so it wouldn't be used for anything else.  Most of the tiles would be blank except for a the desired spots to change, or it might be come in smaller sizes, like 4x4 and 8x8.  Then a template could reference an  overlay/maptile id and plop down the mini structures. For example, you could have a map showing a cluster of tents surrounding a campfire.  Then a template for making a bandit campsite could just grab those tents off the overlay.

A good system for templates could also be a replacement for map extras, since those are not jsonified yet and there are so few of them. (They should really be time dependent too; finding dead drug dealers and scientists makes sense the first season, but after that it's strange to find these mi-gos always hanging out over fresh corpses.) A few overmap specials, like campsites and especially spider nests, would be better handled by templates as well.

The important thing to remember in all these "simulated" things is that the results be possible, not necessarily what would have happened if the player stayed and watched.  Some kind of basic "bash this car X%" action, for instance, doesn't have to exactly match any particular group of zombies bashing it, just be passably similar.  Fires don't have to act perfectly, just have believable results (this one shouldn't be TOO hard - measure burn time on buildings, and torch the building if it's been that long... what happens to the zombies inside is also not really that important, as they would get back up, anyway).  Fungalizing doesn't having to match exactly what would happen with that exact configuration of fungaloids, as activity by animals and NPCs could well have affected their placement along the way.

II wouldn't include car-bashing though. It's just a result of zombies smashing adjacent furniture and being attracted to the noise of smashing that makes them gang up on cars. There isn't really any lore or logic for why they have this mad hatred for anything on wheels. I could see a more mild car rust or decay happening. Applying templates to vehicles might be another can of worms, although it certainly makes sense.   

For fire you could have a template that would replace any tile with a fire field with rubble/ash, and then apply an overlay of rubble that would be a sort of a gradient.  It wouldn't simulate a fire you stayed to watch, but it would look cooler because it would leave some recognizable bits to the original building.

Even without the NPC activity template portion (which is a GREAT idea!), this kind of thing would both give a greater feeling of "realism" and give some reason to actually go out and find stuff before the late game inherent activity makes stuff harder to get/destroys the stuff before you get there.

I think it's cool to have a timer putting pressure on you, but I'm more worried that players will hate it and complain bitterly. All those comfy long-term activities--like reading and crafting and construction and vehicle-building--would make you lose out on easy loot.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #8 on: March 04, 2017, 10:27:39 AM »
If you're include things like overlays, could there be a tile for it? Like it would be a maptile but flagged "overlay" so it wouldn't be used for anything else.  Most of the tiles would be blank except for a the desired spots to change, or it might be come in smaller sizes, like 4x4 and 8x8.  Then a template could reference an  overlay/maptile id and plop down the mini structures. For example, you could have a map showing a cluster of tents surrounding a campfire.  Then a template for making a bandit campsite could just grab those tents off the overlay.

A good system for templates could also be a replacement for map extras, since those are not jsonified yet and there are so few of them. (They should really be time dependent too; finding dead drug dealers and scientists makes sense the first season, but after that it's strange to find these mi-gos always hanging out over fresh corpses.) A few overmap specials, like campsites and especially spider nests, would be better handled by templates as well.

1 tile ones would be doable as pure palette thing.
Bigger ones would require special handling and thus be a totally separate feature, essentially tiny, nested mapgen. That's far from easy.

Yeah, I though about rewriting specials as templates. I even attempted it, but I think the loading system for mapgen jsons stopped me. It's unusual.
Doesn't mean it's not doable.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: Evolution for buildings
« Reply #9 on: March 04, 2017, 06:31:11 PM »
if buildings, vehicles and resources decayed after a certain amount of time, why would one explore such a location, knowing that there is nothing to gain there?
If locations were to change and the player wouldn't have visited it yet, how would he/she know that it was different in the first place?
Destroying resources over time is a Bad Idea in a game where exploration is one of the key gameplay loop elements, for it directly discourages exploration after a certain amount of time, turning it into some sort of a time trial.
Having buildings that were thoroughly on fire burn down is probably the only appropriate use of this.

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #10 on: March 04, 2017, 07:43:27 PM »
Quite the opposite: making buildings get some cool new drops from NPCs who nest there or evolved fungals who turn the place into food/mutagen tank would make the places worth re-visiting after clearing them out of resources in the first place.

Offline viggolo

  • Zombie Food
  • *
  • Posts: 17
    • View Profile
    • vigg's gfx archive
Re: Evolution for buildings
« Reply #11 on: March 04, 2017, 08:23:51 PM »
Quite the opposite: making buildings get some cool new drops from NPCs who nest there or evolved fungals who turn the place into food/mutagen tank would make the places worth re-visiting after clearing them out of resources in the first place.

Now that would be great. It's satisfying to have the player's actions influence the world in some meaningful way. Also opens up more possibilities for end-game shenanigans, if these location state changes would be time gated from the get-go (along with the prerequisites of having had visited it beforehand, done something that triggers the change and also passed time elsewhere) .

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3687
    • View Profile
Re: Evolution for buildings
« Reply #12 on: March 04, 2017, 09:14:39 PM »
I'd rather avoid too much "farming" here, but something like "gather NPCs and build a portal to hell" would make a fine endgame mission.

Offline deoxy

  • Survivor
  • ***
  • Posts: 1411
    • View Profile
Re: Evolution for buildings
« Reply #13 on: March 05, 2017, 09:34:35 PM »
if buildings, vehicles and resources decayed after a certain amount of time, why would one explore such a location, knowing that there is nothing to gain there?
If locations were to change and the player wouldn't have visited it yet, how would he/she know that it was different in the first place?
Destroying resources over time is a Bad Idea in a game where exploration is one of the key gameplay loop elements, for it directly discourages exploration after a certain amount of time, turning it into some sort of a time trial.
Having buildings that were thoroughly on fire burn down is probably the only appropriate use of this.

Other than vehicles and buildings getting smashed to bits (and they really should be, as staying in the reality bubble in a city results in most vehicles smashed in less than two days), I haven't seen any suggestions for there to be less loot - sure, there would be SOME loss (some things get broken when the building collapses, but many things don't), but nothing huge.

The main time thing would be that some things would get harder to collect due to increased threats, not be destroyed and no longer available to be collected - and zombie evolution already does that to some extent, so it's not a new concept.
This is the text that goes under the post, and there ^ is the post, so this is where it goes.

Offline Chezzo

  • Survivor
  • ***
  • Posts: 311
    • View Profile
Re: Evolution for buildings
« Reply #14 on: March 06, 2017, 04:20:50 AM »
I think being able to add content to unexplored areas, based on how long the game has been running, would be incredible. I have actually been trying to use Lua to do it for a while now.

I am envisioning the new gas stations you find come Summer would have guys from the Old Guard standing by in power armor, ready to shoot you for "looting".

And in the Fall, you might find a walled town, with pushed together cars and turrets and people in them. Or crazy bitten half dead NPCs running around being violent because they will soon be zombies. Or NPCs that want to spread the love of the mycus across the land, and the apocalypse churches that would grow up around them.

And come Winter, maybe some of those settlements are so welcoming, only because they want to eat you.