[ian-reeds-games] Dev 40: Huge save game improvements and some new bugs

  • From: Ian Reed <support@xxxxxxxxxxxxxxxxxxx>
  • To: ian-reeds-games@xxxxxxxxxxxxx
  • Date: Sat, 02 Nov 2013 14:45:43 -0600

Hi all!

Several months ago I attempted to fix the problems with saving and loading.
I spent several days on it and in the end couldn't get the new system working.

After dev 39 I attacked the problem again from a different angle, and failed again.
Fortunately that new angle brought me to better understand the problem.
So I had a third attempt at it and I'm very happy to say that saving and loading is now very fast and much more memory efficient. I'm thinking this may solve all the out of memory exceptions people would get when saving.

I used Allan's first Warlords map for testing and my focus was on getting the save game size down as much as I could, which in turn helped the speed of saving and loading.

My test case was to open Allan's map, then save to see how big the file came out.

Here are my results:
Save game size
was: 23847 KB
now: 2295 KB

Saving and loading times in seconds was:
save game 4.0822478
load game 22.2466055
Now:
save game 0.160851
load game 0.2320303

As you can see the new saved game size is less than one tenth of the original.
And the time it takes to load is 95.8 times faster than previously.

It turns out there were some gross memory inefficiencies that started with the feature that let you do things like attack_health_inflict directly in a unit file, and later compounded by random damage and healing. So while these inefficiencies were my fault I'm quite glad to have them greatly reduced.
I wish I could have fixed it ages ago, but I'm just not that smart, smile.

As with many updates old saves will not work in the new version and this is especially true this time.

I had to change a good amount of code to get these benefits, and whenever I change a lot of code it is likely new bugs will appear. I've played through simple fight and defeating your dark side without any errors.
I've also played the first warlords map enough to kill some orcs.
So if you're interested in helping me find the bugs feel free to update and give it a shot. If you're sick of all the bugs then don't get dev 40. Wait for dev 42 or so, smile.

And a special apology to Craig as I had to make all the unused point objects null in order to reduce save game size.
Sorry if this breaks your scripts.

Thanks for your patience.
Ian Reed


Other related posts: