yiotro / Antiyoy

A source code of android game called 'antiyoy'.
422 stars 54 forks source link

Diplomacy causes crashes #48

Open arendtio opened 6 years ago

arendtio commented 6 years ago

Recently I played a match with 4 colors and 2 players on a large map with diplomacy enabled. After 30 rounds or so the game started to become very slow for some actions. For example moving a single unit took about five seconds. After a few rounds I saved the game and shortly afterwards the game crashed.

I loaded the game again (which took about 8 seconds) and the game was still very slow. After a few rounds the game crashed again.

So I looked into the save game and found that the file was about 6MB and the cause seemed to be the diplomacy_into string which had a few thousand entries for the cooldown part. While I don't understand how the cooldowns work, they looked a little odd to me, as it was just a repetition of the same values:

and that combination repeated until the file had 6MB

I deleted some repetitions and afterwards I was able to load the game again and finsh the match without any latencies.

antiyoy.slot_prefs_39.xml.zip

yiotro commented 6 years ago

Hmm, this was actually very helpful. I thought that slowdown was caused by memory leak, so I've changed how I use StringBuilder object, but it looks like I was wrong.

Thanks for reporting about this. Those cooldowns should be removed from lists when they expire. I'll fix that asap.