Fix: prevent entry into the Lava Castle moongate (the vertical forcefield that blocks Seamoth entry and behind which the Player can breathe and walk).
Fix: storage counting issues: modular storage containers (especially Better Vehicle Storage upgrades) would be wrongly counted for the storage HUD element
Fix: modular storage save/load issues. Previously, modular storage (especially Better Vehicle Storage upgrades) would not save and load correctly.
Fix: VF upgrades unlock, by default, with the mobile vehicle bay instead of the modification station.
Fix: on reload, upgrades would be "added twice," sometimes leading to bad counting
Fix: can no longer enter scuttled submersible-type vehicles
Fix: magnet boots no longer have save/load issues (but will detach when you save the game).

Overhaul: Saving and Loading

I added completely new, and much improved, saving and loading methods for Vehicle Framework. The old saving methods have been wiped out, but the old loading methods are still here. That means you can still load old saves. But every save and load after that will use the new methods!

The old methods relied on the position, in world space, of each vehicle and each element inside it that would be saved. That includes storage containers and batteries and upgrade interfaces. This worked most of the time, but sometimes it would result in bad loads where a lot of storage would go missing (especially in the Odyssey).

The new methods leverage each vehicle's "unique identifier," which is something that Subnautica itself handles saving and loading. I can rely on that identifier being the same across boots of the game! This is so much more reliable than using a world-space position.

Not only that, but the new save methods are handled component-wise. So each battery looks after itself, and each storage container looks after itself, and each bay of upgrades looks after itself. On the one hand, this simplifies the saving and loading mechanisms in the source code and also means that any component can only cause itself to fail. That means if one loading operation goes bad, not the whole vehicle will be put in a bad state! On the other hand, this resulted in more files per save. Where there was previously one huge file with all the save data, now there are several per vehicle. This could result in longer saving and loading times for some users, but I haven't noticed a big difference.

This change also comes with a couple new ModVehicle instance methods:
protected virtual void OnGameSaved() { }
protected virtual void OnGameLoaded() { }

OnGameSaved is invoked after the vehicle does all of its normal saving, and OnGameLoaded is invoked when the vehicle begins loading. The VF source now contains several examples of using this new scheme as well as VF's new JSON interface to manage reading and writing files. So if you're developing a vehicle with VF and you want to have persistent save data, you can check it out or ping me at my Discord server!

Article information

Added on

Edited on

Written by

Mikjaw

0 comments