View Single Post
Old January 11, 2020, 19:48   #22
Pete Mack
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,975
Donated: $40
Pete Mack is on a distinguished road
In concert with a compression library, human-readable save files might work. It is IO that is slowest, tho decimal-binary conversion still remains a hog.* Xml machine-encoding schemes are a possibility; they are widely used as a compromise between human readability (ASCII), schema conservation (XML), and performance in both disk and CPU.

Here is one written in C.

The most elegant, though, would be to use the existing parser model to read and write the save file.
You'd have to flatten the various lists--one for dungeon architecture, other for monsters, objects, inventory, and player stats.

As a matter of fact... maybe i should give it a try.

* even in CPU-heavy apps, decimal conversion takes something like 50% of processor time.
Pete Mack is offline   Reply With Quote