03-17-2024, 12:23 AM
Celarious' Game File
Celarious allowed me to download a large saved game file, in excess of 4gB. He was curious about why the file was so large. That file flushed out some bugs.
The original file is used more or less like this:
A big surprise was watching memory usage. As soon as QFile::open is called on the file, 8gB of memory gets consumed. That is without reading any data from the file. The memory does not appear to be released after I close the file. I am continuing to research this feature. Total memory usage only gained 1gB after that, for a final total of 11gB virtual and 8gB resident.
Another surprise was the 2,626 sectors, 52,526 solar systems, and 2,383 ringworld arc sections. This led to some improvements to the solar system decay logic, which reduced these numbers to 606 sectors, 13,615 solar systems, and 28 ringworld arc sections.
A small number of obsolete blueprints were deleted automatically.
Some of the decay logic happens in stages. After running the game a few times, the save game file lost about 110mB of size.
Decay Solar Systems
A ringworld prevents the solar system contents from decaying.
This was improved to allow ringworld solar systems to decay when there are no dependencies.
Save Large Game to File Fails
Saving the Current Game to a file fails when the game data is larger than 2gB.
The code to save a game to a single file does about the same thing as zipping the two files together into one. My code to do this is very simplistic, simply loading the entire file into a QByteArray at once. Well a QByteArray is limited to 2gB in size.
This function is not important enough to do the work necessary to overcome this limitation.
Instead a message is presented now, when the file size is too large. The message advises the user to simply zip the files, and it reports the full path to the two files that are needed.
Save Game to File Fails
Saving any game to a file, other than the Current Game, does absolutely nothing.
Fixed file path error.
Save Customizations to Gear
Deantwo suggested that the spacecraft customizations be stored into the avatar's gear, rather than to a disk file.
This was such a good idea that I dug into it right away. It is done.
Terrain Improvement Option
Improvements were made to terrain generation. The changes do not affect worlds that have already been created. Can this be done?
A message now appears when an old version game file is loaded. The message box offers to fix the terrain. After the game is saved, the message does not appear again.
City Lights
Cities do not look like cities at night. There isn't enough light. They should glow more.
Added blobs of light to buildings at night, if they have power.
Celarious allowed me to download a large saved game file, in excess of 4gB. He was curious about why the file was so large. That file flushed out some bugs.
The original file is used more or less like this:
- 5mB of game data, empires, and species.
- 4gB of building blueprints, 329 of them.
- 300mB of spacecraft blueprints, 32 of them. Nice spaceships!
- 30mB of Universe and its atoms.
A big surprise was watching memory usage. As soon as QFile::open is called on the file, 8gB of memory gets consumed. That is without reading any data from the file. The memory does not appear to be released after I close the file. I am continuing to research this feature. Total memory usage only gained 1gB after that, for a final total of 11gB virtual and 8gB resident.
Another surprise was the 2,626 sectors, 52,526 solar systems, and 2,383 ringworld arc sections. This led to some improvements to the solar system decay logic, which reduced these numbers to 606 sectors, 13,615 solar systems, and 28 ringworld arc sections.
A small number of obsolete blueprints were deleted automatically.
Some of the decay logic happens in stages. After running the game a few times, the save game file lost about 110mB of size.
Decay Solar Systems
A ringworld prevents the solar system contents from decaying.
This was improved to allow ringworld solar systems to decay when there are no dependencies.
Save Large Game to File Fails
Saving the Current Game to a file fails when the game data is larger than 2gB.
The code to save a game to a single file does about the same thing as zipping the two files together into one. My code to do this is very simplistic, simply loading the entire file into a QByteArray at once. Well a QByteArray is limited to 2gB in size.
This function is not important enough to do the work necessary to overcome this limitation.
Instead a message is presented now, when the file size is too large. The message advises the user to simply zip the files, and it reports the full path to the two files that are needed.
Save Game to File Fails
Saving any game to a file, other than the Current Game, does absolutely nothing.
Fixed file path error.
Save Customizations to Gear
Deantwo suggested that the spacecraft customizations be stored into the avatar's gear, rather than to a disk file.
This was such a good idea that I dug into it right away. It is done.
Terrain Improvement Option
Improvements were made to terrain generation. The changes do not affect worlds that have already been created. Can this be done?
A message now appears when an old version game file is loaded. The message box offers to fix the terrain. After the game is saved, the message does not appear again.
City Lights
Cities do not look like cities at night. There isn't enough light. They should glow more.
Added blobs of light to buildings at night, if they have power.