Skip to content

Rewrote most logic behind /vp_recache (reconstruct server cache by scanning world files) - #92

Merged
Algent merged 22 commits into
masterfrom
algent/redocache-reloaded
Jun 7, 2026
Merged

Rewrote most logic behind /vp_recache (reconstruct server cache by scanning world files)#92
Algent merged 22 commits into
masterfrom
algent/redocache-reloaded

Conversation

@Algent

@Algent Algent commented Jun 6, 2026

Copy link
Copy Markdown

This ended up being a lot more changes than the few little tweaks I originally wanted to go for.

Looking at my commits in order:

  • Improved EndlessIDs support: Support all keys, check for corruptions same way as it did for NEIds
  • Bunch of various optimisations
  • Fixed a bug in vein matching that made it not always retry when it should be
  • Add trust hierarchy on ore vein storage with an overwrite logic depending on VeinSource. Now that we can flag what came from a GT VeinGenerateEvent we consider it more trustable than rescan.
  • Fixed how VP get dimension names because it often got empty strings which made matching try all OreMixes instead of filtering
  • This also allow us to skip scanning dimensions that don't have any mix registered.
  • After talking about it in discord, move VeinSource away from using ordinals to avoid future troubles
  • Changed scan logic: No more fast or slow dimension depending on file size. It scan region files by rows and discard data from memory once it's not needed any more.
  • In case rescan doesn't find anything it default to not overwriting an unknown sourced vein. Avoid making holes where there is a depleted vein or where it still failed to match.

From what I've seen it's never slower than before, It's even usually a bit faster.

Comparison

Original Cache Current VP recache output New recache output (Bonus) New output with deleted cache
2026-06-06_09 52 38 OG 2026-06-06_10 08 40 Old recache 2026-06-06_11 31 14 new recache v2 2026-06-06_18 28 21 new recache v2 from empty
2026-06-06_09 53 04 OG 2026-06-06_10 09 23 Old recache 2026-06-06_11 31 31 New recache v2 2026-06-06_18 28 49 new recache v2 from empty

4th column is to accurately compare what scan find without preserving any entries.
You'll see it's overall a bit better or identical but never worse.

@tiffit tiffit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small things. What are the steps to test this code?

@Algent

Algent commented Jun 7, 2026

Copy link
Copy Markdown
Author

small things. What are the steps to test this code?

I got my head so much in VP lately that I forgot to explain this, sorry.

The way I get a full display is you can actually copy paste the server cache into the client cache, it will work.
I do want to eventually have a few debugs commands to force unlock whole cache, And also to debug a single ore chunk scan output maybe.

Process I went for in testing:

  • Open my world from 2.8.x (if you make a new world on latest Daily it will skip rescan of everything sourced from WorldGen event). Can be done into daily but don't use new build yet. keep a copy of the cache folders before any rescan.
  • Set myself into a hole & centered map, take picture (repeat in other dims if you want)
  • Do a rescan, exit world, copy server cache into client cache, take more pictures.
  • swap jar, put cache backup back repeat rescan & screenshot process
  • If you want to test from a blank state, delete cache folder and open world it will forcefully rescan it. You can also compare.

In all this you can also write time it took, it log that at the end.
If screenshots are from exact same spot like in my PR it does make eyeballing differences quite easy.

In term of final result, from blank cache it should at least be as good as original output, usually a bit better (you can see in my comparisons pics it's still perfect in TF, my map do have a lot of holes but not that many).
And from a non blank cache it doesn't overwrite if it find nothing so it shouldn't add "holes".

@Algent
Algent requested a review from tiffit June 7, 2026 10:53
@Algent
Algent enabled auto-merge (squash) June 7, 2026 15:32
@Algent
Algent merged commit 6d5332c into master Jun 7, 2026
1 check passed
@Algent
Algent deleted the algent/redocache-reloaded branch June 7, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants