Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: To what degree of detail does DF generate the world in worldgen?  (Read 1048 times)

Foxite

  • Bay Watcher
    • View Profile
To what degree of detail does DF generate the world in worldgen?
« on: November 03, 2020, 08:06:05 am »

An extremely large DF world such as this one, when extracted from its zip file, weighs "only" 121 MB. I find it unlikely that the entire world, with all its glorious detail, fits in that space. Every single tile in every single layer, the position of every creature, every item, etc. I would think that the game only saves an abstract representation of what should be within given areas (such as the ores, the structures etc), and only generates the specific details when you go there in dwarf/adventure mode.

Of course, history would need to be saved, otherwise you'd be regenerating all of that every time you opened up legends mode. But I doubt that accounts for the majority of the 121 MB.

Does anyone know what the game does in this regard? I'm curious.
Logged
The best way to demonstrate it to him is take a save of 40 year old fortress with 150 dwarves in it on a good sized embark with a volcano that just breached the circus and install it on his gaming rig and watch it bring his rig to its knees.

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: To what degree of detail does DF generate the world in worldgen?
« Reply #1 on: November 03, 2020, 10:31:08 am »

The game typically just procedurally generates everything on demand - worldgen determines the elevation+precipitation+draininage+volcanism+salinity+etc. for the entire top-level map and uses that to assign biomes, plant/animal populations, and geology.

When you embark in a location (or explore it in Adventurer mode), it generates all of the terrain (and plants and animals) using that information and then saves it in full detail (eventually in a "site-X.dat" file once you retire/abandon or otherwise lose).

For Adventurer mode, it regenerates the terrain every time you visit it, but if you make any changes it'll keep track of them individually and then "re-apply" them when you visit it again in the future. This is why sleeping in Human towns causes you to forget where everything is - the terrain gets unloaded when you go to sleep and regenerated when you wake up. This is also why there are some bugs involving things changing when sleeping or revisiting areas - there are some things that are generated "randomly" (using "seed" values that are also saved within the world, so that it always generates the same random sequence each time), and sometimes there are things which don't re-seed the random number generator correctly (causing things to be different every time) or do so in the wrong order (causing things to differ based on the direction from which you approach them).
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Thisfox

  • Bay Watcher
  • Vixen.
    • View Profile
Re: To what degree of detail does DF generate the world in worldgen?
« Reply #2 on: November 13, 2020, 04:20:25 pm »

A good demonstration is with artifacts. If you get several artifacts in a row and don't go to check out what they are, then check them all later. Artifact A, made six months ago, might have an image on it of artifact B, made three months ago. It's like it was predicting the second artifact, but what actually has happened is that the details of the artifact were set at the time you looked, instead of the time the artifact was actually made.
Logged
Mules gotta spleen. Dwarfs gotta eat.
Thisfox likes aquifers, olivine, Forgotten Beasts for their imagination, & dorfs for their stupidity. She prefers to consume gin & tonic. She absolutely detests Facebook.
"Urist McMason died out of pure spite to make you wonder why he was suddenly dead"
Oh god... Plump Helmet Man Mimes!

Shonai_Dweller

  • Bay Watcher
    • View Profile
Re: To what degree of detail does DF generate the world in worldgen?
« Reply #3 on: November 13, 2020, 04:55:00 pm »

A good demonstration is with artifacts. If you get several artifacts in a row and don't go to check out what they are, then check them all later. Artifact A, made six months ago, might have an image on it of artifact B, made three months ago. It's like it was predicting the second artifact, but what actually has happened is that the details of the artifact were set at the time you looked, instead of the time the artifact was actually made.
Although artifacts aren't such a good example as worldgen artifacts are actually generated in worldgen (since the artifacts release). Fortress ones do still seem to act as described though, yes.
Logged