Re-generative World Feature!

So I had a discussion in another forum (because I don’t have a link to the iirc channel) about how Mapgen and oversized worlds caused crashing, so here is my solution:

Delete the unwatched sectors.
Now why gtaguy? Because it wouldn’t be saving that data then, and when a player goes back it would be different. I could simulate changing earth via wormholes or portals.

But gtaguy, when would this happen? And how?
It would be simple, unwatched area around the player (in a to be decided area) wouldn’t be saved. Which brings me to the next part. It would only happen at world save, so it could be controlled and allow players to save anything they want too. Also, map tiles with notes on them wouldn’t be offloaded.

This now means that larger worlds couldn’t crash on save/load, because the data load isn’t high.

Now what this would mean for the player:
Regenerated resources: Forest, towns, beehives, Ect. This makes it easier.
New baddies: New fungal spires/swamps/other bad map tiles would regenerate. This makes it harder

And now characters can last forever without the need of hunting! So this adds more playstyles.

Feedback? Comments? Pictures of doughnuts? Post blow!
[size=6pt]Or die.[/size]

But then if you start a new character you can never leave things behind.

So, uh, throw persistent worlds and coolness out the window for better FPS?

There’s got to be a better way to optimize than remove a treasured feature.

Did you even read?

‘Area left around the player’ refers to the location originating from the player that is left be, so on new character creation both the starting shelter and the last death point would be safe. But only if you didn’t quit and save without getting your stuff or adding a note.

( if this is impossible, make a note on the map at death with code wrangling)

Even if this was possible, I’d like to keep previously discovered sectors. Honestly, your explanation confuses the fuck out of me, and I’m not sure how it would work whatsoever.

I guess that what gtaguy meant is:

There’s an area around your character. Anything beyond it is unobserved, and in world save, the player can choose what of the unobserved area will be deleted or not.

Also, map tiles with notes(that notes you leave in the map) wouldn’t be deleted.

Very good idea! Question: if a character is being hunted by enemies and go to a different z-level(sewers, basement, your choice) and decides to save and quit, that space above him with all the enemies is erased?

I like my suggestion on how to fix the huge save time issues better. Of course, any altering of the save system takes a huge amount of code, most likely. My suggestion was a flag system per tile. Aka, if something in that tile changed, then it would flag the tile as needing saving. Any tile not flagged would not get saved during the next save. During the save all flags would be removed. It’s a bit like some of the file backup systems.

Adding a note would be like placing a player on that map tile, so the area around the note would be saved.

Also, it would/should be an option. I just thought it would improve gameplay and help newbs out. Along with helping crashes.

at what point does your game begin to lag? In 0.4 i had problems when my save went over 80-100M, but truth to tell, i was already bored out of my mind of my uber-god char by then.

There are two seperate issues at play here.
Instability when mapsize becomes too large.
I’m not sure what the cause of this is. How big a map are we talking about? If it happens when you have 100s of overmaps explored, I’m not particularly concerned about it, if you’re pushing the game engine past its limits, good on you, but expect some instability. If it’s more like 10 overmaps or so, it’s something we should look into, especially as we want to add some large-scale variation between overmaps.
Long save/load times.
This has a simple* solution, currently the game stores all map tile data in a single huge file, and only saves or loads the whole thing at once. Breaking this monolithic file into manageable pieces would allow a paging system (potentially enhanced by a dirty flag as Moloch proposes) that would only keep the immediate area (larger than the visible area, but smaller than say an entire overmap) in memory, and page in and out surrounding map tiles on-demand. In fact this would allow for optimizations like having a mapgen and save/load queue instead of having it be pure on-demand like it is now.

*Simple, but time-consuming to implement :stuck_out_tongue:

Interesting.

So are the world maps your survivor has not yet explored don’t exist until you do? If one tile of an adjacent world map is observed through binoculars, does it cause that entire world map to spawn/ populate?

So for maximum FPS and all you’d keep your adventures limited to one world map at a time, rather then endlessly traveling in one direction?

There are two different zoom levels, map tiles and overmap tiles.

If you use the debug menu to “reveal map” and then look at the revealed map area with ‘m’, that’s one overmap, it’a 180x180 “building sized” squares, e.g. a house or a shop, farms are 3x3 of those etc.

A single overmap square corresponds to a 2x2 block of map tiles, each of which is 12x12 squares in size. For example again, a single house is a 2x2 block of map tiles.

Both overmaps and map tiles are generated on-demand, so if the game needs to draw one or access it for any reason it gets generated on-demand, then saved in memory. The next time you exit the game it gets written to disk. The most common way map tiles get generated is when you move around, when you step acros a map tile boundary such that a square of an unloaded map tile could be visible, the game either loads or generates the map tile right then. You might notice if you’re running there’s a slight pause every dozen steps or so, that’s mapgen happening. That pause is due to up to 44 new map tiles getting generated, and a bunch of things getting shuffled around in the background.

And yes, as you explore, the game accumulates an ever-expanding list of both map tiles and overmap tiles, which can impact performance at the upper end of the scale, though it really shouldn’t.

I see, thanks. It’s more or less how I suspected, the every ‘dozen steps’ thing never occurred to me though.

[quote=“Kevin Granade, post:11, topic:1530”]There are two different zoom levels, map tiles and overmap tiles.

If you use the debug menu to “reveal map” and then look at the revealed map area with ‘m’, that’s one overmap, it’a 180x180 “building sized” squares, e.g. a house or a shop, farms are 3x3 of those etc.

A single overmap square corresponds to a 2x2 block of map tiles, each of which is 12x12 squares in size. For example again, a single house is a 2x2 block of map tiles.

Both overmaps and map tiles are generated on-demand, so if the game needs to draw one or access it for any reason it gets generated on-demand, then saved in memory. The next time you exit the game it gets written to disk. The most common way map tiles get generated is when you move around, when you step acros a map tile boundary such that a square of an unloaded map tile could be visible, the game either loads or generates the map tile right then. You might notice if you’re running there’s a slight pause every dozen steps or so, that’s mapgen happening. That pause is due to up to 44 new map tiles getting generated, and a bunch of things getting shuffled around in the background.

And yes, as you explore, the game accumulates an ever-expanding list of both map tiles and overmap tiles, which can impact performance at the upper end of the scale, though it really shouldn’t.[/quote]

This is helpful. I’d like to confirm a few things:

  1. debug/map-reveal is equivalent to artifact/map-reveal, in terms of how & how much map gets revealed? My 02Feb Sword of Cyclopean Shade had a fairly safe mapper and I made thorough use of it.

  2. Overmap generation. From reading mapgen.cpp I thought that everything got more/less laid out at world start. Your statement reads as though I could save on one side of an overmap sector boundary, cross it repeatedly, and observe different overmaps. I suspect I’m not understanding something correctly here. Help?

  3. Map scale. You’re saying that a House, which is one block on the map screens, works out to four (presumably quadrants) blocks on the map scale. I presume mini-events like corpses, helo crash, radiated! craters, and Nothings are one block?

Thanks much.

  1. Nope, you are right there as I understand it. Since an overmap isn’t generated until it’s comes into play, it should be fully possible to save on one side of an overmap cross it, reload the old save and cross it again to see a different world. Unlike games like Minecraft where there is one single “seed” per world and the generation program only runs part of the way through the generation (thus only creating what you can see) but is still able to resume whereever it stopped to generate more, Cataclysm uses individual RNG’s as needed to generate. Thus generating an overmap in two different loads of the same save will result in two different overmaps. (This also prevents the transfer of “seeds” in Cataclysm, and is the reason why you can’t regenerate the same world twice).

  2. Correct.

[quote=“i2amroy, post:14, topic:1530”]2) Nope, you are right there as I understand it. Since an overmap isn’t generated until it’s comes into play, it should be fully possible to save on one side of an overmap cross it, reload the old save and cross it again to see a different world. Unlike games like Minecraft where there is one single “seed” per world and the generation program only runs part of the way through the generation (thus only creating what you can see) but is still able to resume whereever it stopped to generate more, Cataclysm uses individual RNG’s as needed to generate. Thus generating an overmap in two different loads of the same save will result in two different overmaps. (This also prevents the transfer of “seeds” in Cataclysm, and is the reason why you can’t regenerate the same world twice).

  1. Correct.[/quote]
    Huh. So stuff like the sewer/lab map computers calls for mapgen when you use it? I’ve seen those go much farther, in terms of map-screen range, than the Sword did.

(I suspect that may also be a problem with making Interstate-type highways. No guarantee that the mapgen will keep it going.)

  1. er… I’m actually not familliar with the artifact feature.
  2. the overmaps are generated and stashed in a pool* as soon as needed, which is either when you scroll over to it on the map screen, or get within 5 map tiles of an overmap border, at which point it needs to read fom the adjacent overmap to find out what kind of map tiles to generate. Once in this pool, the same overmap will be returned every time it’s asked for, and the next time ou exit the game it’ll write it to disk. You could maybe trigger a regen by exploring a bit and then killing the program to avoid the overmap save, in which case you’d end up with a new overmap… that doesn’t match whatever map tiles have been generated. 0_0
  3. the map specials I think are restricted to a single map tile yea, and yes, a nothing square is a single map tile. The nothing that makes your game crash if you look at it is most likely a NULL pointer in the underlying map grid, whereas the null that doesn’t crash your game is likely a mis-generated tile. I’ve been occasionally seeing grass tiles, no idea WTF that is. :stuck_out_tongue:

Roads/highways/rivers/sewer tunnels have additional heuristics that try and hook them up across overmap borders. The roads work kinda ok, I’m not sure about the rivers or sewer tunnels, but they might hook up occasionally.

If you get used to intentionally interacting with overmap borders (testing ;_:wink: you quickly notice that there’s an exclusion zone around the borders that’s all fields and forest. (making cities span overmaps would be quite difficult to pull off)

*The pool part of this is new, they used to be saved/loaded on demand every time they were accessed.

I just wanted to have less saved and to be able to re-loot towns after they de-spawn.