Kakoen/valheim-save-tools

New Terrain System

justus-saul opened this issue · 5 comments

With Valheim 0.150.3 a new terrain system was introduced.
It seems "valheim-save-tools" is not fully compatible with it anymore.

I get a lot of these messages after I tried to edit a world already migrated to the new system.

WARN At net.kakoen.valheim.save.parser.ZPackage.readLengthPrefixedObject(ZPackage.java:178)
WARN Object at 167761386 with size 94 was not fully read, 1 bytes remain

The game crashes if I then try to play that wolrd.

Thanks for the report! I'll have a look at it tonight.

I just released v1.1.0, which adds some rudimentary read/write support. The terrain data is encoded in a byte array, which is currently left alone (read / write as-is). In a future release I will look more into decoding and processing this data.

See https://github.com/Kakoen/valheim-save-tools/releases/tag/1.1.0

Nice! Just tried it out and it seems to work quite well for me so far. Thank you very much for the fast response to the issue. Was able to shrink down my worldfile from over 200MB to 20MB (JSON with about 100MB).

OT: Time to search for the entry of the dead lvl 10 Troll that keeps my game crashing. I know that it is a "prefabName" : null, entry by trying it out again in a fresh world. Sadly there are over 607 of those entries in this one ... well maybe I just throw them all out with a script :D

Great to hear it works!

I know that it is a "prefabName" : null, entry by trying it out again in a fresh world.

@justus-saul That troll sounds like a nasty one. When prefabName is null, it doesn't mean that there's something wrong. The tooling tries to deduct the prefabName from the prefab hash value, but it's like cracking a password. They are only there for readability.

Prefabnames are not part of the save file, and simply not all prefabNames are known to valheim-save-tools because they can be dynamically built up, and in those cases, they end up being null in the JSON. By removing them, you might destroy important game objects which might block your progress in the future.

This explains the existance of --skipResolveNames then. Thanks for the warning.
The weird thing about this Troll is, that in the empty world it had its loot table attached looking like this:

"intsByName" : {
      "drops" : 3,
      "drop_hash0" : 1554778960,
      "drop_amount0" : 12800,
      "drop_hash1" : 1334057821,
      "drop_amount1" : 1,
      "drop_hash2" : -1798613647,
      "drop_amount2" : 2560
    },

But in the big JSON created with the new version I cannot find anything like this. Mysterious ways of Valheim handling its data :D

Well even if I don't find it... just shrinking the world file alone reduced the RAM usage of my dedicated server from sometimes extending 7GB and crashing back to just 2GB. :)