Astral Sorcery

Astral Sorcery

63M Downloads

Retrogen doesn't work on old chunks

talandar opened this issue ยท 5 comments

commented

I have an existing world that I added AstralSorcery to. However, because the old chunks don't have a chunkVersion, retrogen doesn't work on them. This means, effectively, that retrogen doesn't work on chunks created before adding the mod. It also spams the log like crazy with "Skipping RetroGen" messages.

commented

That's definitely a tricky one. I understand wanting to allow the player/server admin to reduce resource usage - it's an admirable goal. Have you run any metrics or anything on how much time and memory reading/writing/storing the version number takes? I really can't imagine an extra int per chunk being that problematic, but with large servers, that map could get pretty big.

As far as the enabled/disabled/enabled use case and causing overwrites, I feel like that's a fairly small edge case, where something like what I'm hitting - adding the mod after server start is probably more common. (but that's a bit of selfish thinking, I admit.) Considering chunk versioning needs to be enabled to get any generation (or will it always generate the first time?), disabling chunk versioning seems like a way to make it much harder or impossible to progress through the mod as the mod updates, if the update adds new materials or generation.

I wonder if it's worth worrying about the possibility of duplication in this case - if the user is willing to restart the game a few times and change config between each to effectively dupe some material, they'd probably just cheat it in via creative or /give. That's only possible on a single-player game where they have full control, and at that point, they're just cheating, so there's not a lot of value in making it impossible, right?

Worst case I can take a jaunt through the nether to find some un-created chunks, so this isn't exactly game-breaking, but it would be nice to have the stuff near the existing base. Thanks for looking into the log message, and for the explanation.

commented

Yea, i have conflicting problems with this: Let's say you already have AS on your server, but chunk versioning disabled due to memory concerns or whatever, then chunks do get decorated/populated with AS' worldgen, however no version gets assigned to those chunks. If you then enable both versioning and retrogen i would theoretically re-build structures that are/were already there again on top of the old chunks, leading to potentially duplicating resources or just overwriting what was there before - This is particularly dangerous with desert shrines since they see the spawnpoint valid even if there is already one at the same position fully generated (since it, well, still fullfilles the conditions for one to spawn). One way to solve this would be to disable the option to disable chunk versioning... hm.

Oh and yea i'm gonna remove the messages for retrogen.. I suppose you don't want to have it run all the time since it'd add a little bit to chunk-load time since it needs to pull up the version number of the currently loading chunk to see if retrogen is needed. Regardless, retrogen messages will be removed yea~

commented

Ouh, nevermind, i found a better way to handle chunkversioning; potentially faster & safer. I'll switch to that and.. well.. remove the option to disable chunk versioning.. That should do it. It'll be faster, lower on memory and provides a better way for me to do retrogen.

commented

Changes made, applied locally and will be included in the next version. Guess this should adress this properly.

commented

Storing is apparently not too terrible. for a 10k radius world it's about 300MB
(to bring this to a more reasonable scale: 20k x 20k generated world, divided by 16 = roughly 1,45m chunks; So it's not too much, considering the NBT data format...)
Yet, that's a considerable memory footprint it does have on bigger pre-genned server worlds. The good part is, once pre-gen is done and no additional chunks are generated, retro-gen being deactivated, this file is never accessed and thus never loaded into memory.. which is. good i guess? However, for a file/storage of this size i don't have metrics/times on how long this takes for read & update operations.

The big problem for me here is that idk what to do if a chunk has no version associated to it.. I'll see how i can work around this in the end..