OverFlowException when caching a file(ES3.LoadRawBytes)

Discussion and help for Easy Save 3
Post Reply
ColdFire
Posts: 4
Joined: Wed Apr 10, 2024 2:46 pm

OverFlowException when caching a file(ES3.LoadRawBytes)

Post by ColdFire »

Hi Joel,
Today I found that when caching a file, the line "var bytes = new byte[stream.Length]" in ES3.LoadRawBytes() limits the maximum cached data to about 2GB (due to the array length being restricted to within the maximum value of an int), while my save files may exceed 2GB when there are 20 or more world blocks. I was planning to implement a multi-file saving tomorrow (one file per world block). However, considering the limitations of my experience as a solo developer, I'd like to hear your opinion before getting started: Is it common and acceptable to have large-capacity save files for games with procedurally generated content? Is saving a single archive in multiple files a common solution? Since the game world is randomly generated, I choose to save everything (by world block unit, saving all its child objects) to avoid creating specialized data structures and methods for saving and loading thousands of custom classes. Is this idea feasible? A 2.5GB save file can be compressed to around 400MB, so I plan to reduce memory usage with a multi-file saving and rely on file compression to reduce the size of the save files in hard drive, and keep the way of saving everything unchanged. What do you think? :)
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: OverFlowException when caching a file(ES3.LoadRawBytes)

Post by Joel »

Hi there,

Generally you would break your files down into smaller save files rather than having one extremely large monolithic save file, otherwise simply the operation of loading that file into memory and resaving it will be a significant bottleneck when actually you only need a small portion of the data within the file.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ColdFire
Posts: 4
Joined: Wed Apr 10, 2024 2:46 pm

Re: OverFlowException when caching a file(ES3.LoadRawBytes)

Post by ColdFire »

Great, I will do that. :D
Post Reply