Jump to content

Vault rooms don't exist during world generation, resulting in caves seeds being inconsistent


mr. brj
  • Pending

After the new update, generating multiple caves worlds using the same seed results in the creation of different worlds.

I don't exactly know what causes this yet (I do now, see post below) but I'm hoping this can be fixed, as this makes it impossible to save a cool seed and use it later (and potentially introduces more problems into the way the caves are generated).

Here is an example, one world generated regularly and the other using API Gemcore, both having the same seed:

Spoiler

1.png.f5ff413ee1f367e16d8601c1ace2dd2f.png0.png.d893e4b18ea16297553f635bc2dd1021.png

 


Steps to Reproduce

1) Generate a caves world, announce the seed

2) Generate another caves world using the same seed

3) The worlds are different

  • Thanks 1
  • Sad Dupe 1



User Feedback


So I discovered the cause for this, it looks like the vault rooms don't exist during the rest of the world generation. I added some prints into the GenerateNew function in worldgen_main.lua to see if a sample of prefabs exist in savedata (simply put, the map information) and apparently they don't.

This causes the game to wrongly assume that the data it is going to generate is complete, so it passes the map information in that form. When the contents of the vault rooms are supposed to get added, the game uses the incomplete map information to physically generate a map where the vault rooms actually exist, so it ends up being a different world then what was intended during the rest of the world generation.

I couldn't figure out the exact stage the vault rooms are actually generated in, but either way, my suggestion is to put the vault room generation alongside everything else. If that's not a possibility, maybe a placeholder can be used during the world generation, or maybe the vault rooms can generate similar to the way the atrium does. Either way, this bug is very likely to bring additional problems into the way the caves are generated and as I said in my main post, it already has broken the consistency of caves seeds. So I'm hoping that this can be fixed very soon.

 

For the curious, here is the exact modification...

Spoiler

function GenerateNew(debug, world_gen_data)

...

 

    local PRETTY_PRINT = BRANCH == "dev"
    local savedata_entities = savedata.ents


    if world_gen_data.level_data.id == "DST_CAVE" then
        print("[brj] ancient gateway: " .. tostring(#savedata.ents["atrium_gate"]))
        print("[brj] vaultmarker_lobby_center: " .. (savedata.ents["vaultmarker_lobby_center"] and tostring(#savedata.ents["vaultmarker_lobby_center"]) or "oopsies"))
        print("[brj] waterfall: " .. (savedata.ents["oceanwhirlbigportalexit"] and tostring(#savedata.ents["oceanwhirlbigportalexit"]) or "oopsies"))
        print("[brj] chasm: " .. (savedata.ents["vault_lobby_exit"] and tostring(#savedata.ents["vault_lobby_exit"]) or "oopsies"))
    end

 

...

...here is what the log file returned...

Spoiler

...

[00:00:05]: [ReplaceSingleNonLandTiles] Validating...
[00:00:05]: [ReplaceSingleNonLandTiles] Replaced 0 tiles.
[00:00:05]: Done cave map gen!    
[00:00:05]: Checking map...    
[00:00:05]: Generation complete, injecting world entities.    
[00:00:05]: Injected world entities.    
[00:00:05]: [brj] ancient gateway: 1    
[00:00:05]: [brj] vaultmarker_lobby_center: oopsies    
[00:00:05]: [brj] waterfall: oopsies    
[00:00:05]: [brj] chasm: oopsies    
[00:00:06]: WorldSim::SimThread::Main() complete

...

...and here is what the seed 593130578 looks like in savedata during world generation (I used a tile extractor for this but didn't bother with a proper colormap so excuse the funny colors, notice the lack of vault rooms however).

Spoiler

image.png.d60f1de425ef092070465b9ec2f1c70f.png

 

Edited by mr. brj
Added example image

Share this comment


Link to comment
Share on other sites

Also to shortly address why I think the vault rooms are the cause: I can't be entirely sure about that part without figuring out where the vault room generation takes place of course (which I failed to do with my limited skills). However, here are some additional clues that very strongly hint towards the vault rooms being the cause for at least some type of inconsistency:

 

- The change in the map for a given seed is very similar to the change in the map caused by updates that don't alter world generation apart from adding a new set piece. In this case however, the changes are always present whenever you regenerate the caves shard (*).

These changes can range from minimal (only the shape of branches + placement of layouts inside biomes get affected) to very obvious (you can't recognise patterns in the map without looking at it for minutes). This hasn't been the case for many years but it resurfaced with the addition of the fumarole biome and the vault rooms, and I strongly doubt that the fumarole biome has anything to do with this.

(*) Worth noting is that you can in fact roll the same map for the same seed if you are lucky (or unlucky) enough. I'm not entirely sure if this is the case for every map, but I provided some example images below regardless.

 

- Not only the prefabs (including markers), but also the tile data is not present during world generation in savedata. While asking around, this proved to be a relevant point since from what I have been told, the non-lunar islands on the ocean also lack their prefabs upon initial generation (which I didn't check personally).

However even for the ocean, the tile data is present and the islands are placed (if I remember correctly) some time during storygen, which doesn't seem to be the case for vault rooms. I also couldn't find anything that references anything related to the vault rooms in storygen either, but this might as well be from not looking deep enough, so take this point with a grain of salt. See images below to compare the tile data of caves vs. the tile data of the overworld+ocean.

 

Results from 4 consecutive regenerations of the caves seed 529408321 (notice map 1 and 3 being identical)

Spoiler

529408321_map_1.png.364c57d8dc55ce5ddc5c2608da7187eb.png529408321_map_2.png.03e743fdf3805012dd84498045ef48b1.png529408321_map_3.png.4ca1852665d04ff223be3d3656712d4c.png529408321_map_4.png.817f10378dc072afd82faa7fe311610a.png

Tile data during world generation: surface seed 986360288 vs. caves seed 529408321, notice Pearl Island and Moon Quay being present

Spoiler

986360288_tiles.png.9abc05a83decedb472040f4cd58f3d31.png529408321_tiles.png.55d6c8866ab47629109a651dcd689182.png

 

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...