Cannot Save Game

Player resolved Player setup
johnson0621 [github] · 1 year ago

Issue description

Trying to save game, and it tells me "failed to save."

Reproduction steps

Failed to save the game!:
Failed to save the game 'C:\Users\johns\AppData\Roaming\Captain of Industry\Saves\20250520\Save 2025-06-08, 15-37-01.save': Object reference not set to an instance of an object

If you are using mods, please ensure they are compatible with the current game version. Otherwise, file a bug report including this error message and your logs, so we can investigate.

System.NullReferenceException: Object reference not set to an instance of an object
at Mafi.Core.SaveGame.ModsListHelper.SerializeCustom (Mafi.Collections.ImmutableCollections.ImmutableArray`1[T] mods, Mafi.Serialization.BlobWriter writer) [0x0001f] in <63ad94ddace640e0a6ec923f62068a38>:0
at Mafi.Core.SaveGame.GameSaver.StartSave (Mafi.DependencyResolver resolver, Mafi.Core.SaveGame.SaveCompressionType saveCompressionType) [0x00049] in <63ad94ddace640e0a6ec923f62068a38>:0
at Mafi.Core.SaveGame.SaveManager.startGameSave () [0x00030] in <63ad94ddace640e0a6ec923f62068a38>:0

Game version and build number

v0.7.4 b441

Operating system

Windows

johnson0621 [github] · 1 year ago

No need to flood, disable mods.

I have never used mods for this game. What else you got? Autosave has stopped functioning, which is a different error.

poltime poltime · 1 year ago

Update the OS and drivers, check the RAM and drive for errors, disable antivirus/firewall.

johnson0621 [github] · 1 year ago

Update the OS and drivers, check the RAM and drive for errors.

Thanks. I have done this. Still having the issue.

johnson0621 [github] · 1 year ago

BTW, lost 2 hours of game time with this error. It did not tell me there was a problem until I tried to manually save. I have it set to Auto-Save every 3 minutes.

DAMPINGDONUT96 · 1 year ago

Please try to verify your game files in Steam. This may resolve unexpected issues like this.

johnson0621 [github] · 1 year ago

Please try to verify your game files in Steam. This may resolve unexpected issues like this.

I have done this many times after crash. It has never found an issue.

johnson0621 [github] · 1 year ago

I tried on Monday to disable Anti-virus. It seemed to work. But then I tried with Antivirus for 2 hours and still had no issues. More testing needed.

DAMPINGDONUT96 · 1 year ago

Antivirus could very well be the cause of this. If the Save file is locked by the antivirus processes, then that's a good reason why the game can't save.

It can help to exclude your save game location and/or the installation folder of COI to really exclude the antivirus from interfering with your game.

johnson0621 [github] · 1 year ago

Antivirus could very well be the cause of this. If the Save file is locked by the antivirus processes, then that's a good reason why the game can't save.

It can help to exclude your save game location and/or the installation folder of COI to really exclude the antivirus from interfering with your game.

After some further testing it seems Anti-Virus may be the issue. McAfee is what I use. The game seems to crash when Auto-Save activates. It does not happen every time, which makes this difficult to accurately verify.
Unfortunately, the way Auto-Save works makes it impossible for me to exclude the files from Real Time scanning. I can only exclude individual files, and every time CoI auto-saves it creates a new file name. I do not see an option to exclude the Save Game folder. Open to other ideas or suggestions?

johnson0621 [github] · 1 year ago

Having more frequent issues today. I have found that when a save file fails to load, adding it to the exclusion in McAfee fixes it, but as mentioned earlier every time auto-save happens I have to add another file. Below is the error I get when trying to load the save.

The game failed to initialize. Please file a bug report if this issue persists.

Mafi.Serialization.CorruptedSaveException: Failed to finalize deserialization of 'Mafi.Core.Terrain.TerrainManager' (type 'TerrainManager')
parent object '--' (type '--')
Previous deserialized object: 'Mafi.Core.Terrain.Surfaces.TileSurfaceDecalsSlimIdManager' (type 'TileSurfaceDecalsSlimIdManager') ---> System.NullReferenceException: Object reference not set to an instance of an object
at Mafi.Core.Terrain.TerrainMaterialThicknessSlim.Deserialize (Mafi.Serialization.BlobReader reader) [0x00000]
at Mafi.Core.Terrain.TerrainManager+TerrainData.<DeserializeCustom>g__readTile|57_0 (Mafi.Core.Terrain.TerrainManager+TerrainData+<>c__DisplayClass57_0& ) [0x00143]
at Mafi.Core.Terrain.TerrainManager+TerrainData.<DeserializeCustom>g__readChangedTiles|57_2 (System.Int32 index, Mafi.Core.Terrain.TerrainManager+TerrainData+<>c__DisplayClass57_0& ) [0x00039]
at Mafi.Core.Terrain.TerrainManager+TerrainData.DeserializeCustom (Mafi.Serialization.BlobReader reader, System.Boolean inPlace, System.Int32& loadedTiles) [0x0013e]
at Mafi.Core.Terrain.TerrainManager+TerrainData.Deserialize (Mafi.Serialization.BlobReader reader) [0x00000]
at Mafi.Core.Terrain.TerrainManager.DeserializeData (Mafi.Serialization.BlobReader reader) [0x00062]
at Mafi.Core.Terrain.TerrainManager+<>c.<.cctor>b__398_1 (System.Object obj, Mafi.Serialization.BlobReader reader) [0x00000]
at Mafi.Serialization.BlobReader+<FinalizeLoadingTimeSliced>d__33.MoveNext () [0x00054]
--- End of inner exception stack trace ---
at Mafi.Serialization.BlobReader+<FinalizeLoadingTimeSliced>d__33.MoveNext () [0x0014e]
at Mafi.Core.SaveGame.GameLoader+<FinishGameLoadAndDisposeTimeSliced>d__7.MoveNext () [0x004a9]
at Mafi.Core.Game.GameBuilder+<BuildLoadedGameTimeSliced>d__3.MoveNext () [0x002fe]
at Mafi.Unity.GamePlayScene+<loadGame>d__23.MoveNext () [0x00297]
at Mafi.Unity.GamePlayScene+<Initialize>d__20.MoveNext () [0x000a5]
at Mafi.Unity.Main+<unloadAndStartNewScene>d__88.MoveNext () [0x000fc]
at Mafi.Unity.Main.stepSceneInitialization () [0x000dd]

Captain Filip Captain Filip · 1 year ago

You are hitting exceptions all over the place, and you mentioned you are not using mods. Something is corrupted, either your drive, RAM, or as you have mentioned, anti-virus. We don't have issues like this reported by anyone else in these parts of the code. If antivirus is causing you this much trouble, consider getting a proper one or ditching it entirely. I don't follow why you don't file a bug on McAfee to allow you to exclude a directory. We certainly can't work around super privileged bloatware that randomly shuts down access to the filesystem.

Closed as ☑️ Player resolved

10 Showing 1–14 of 14