chessmasterhong / WaterEmblem

https://chessmasterhong.bitbucket.io/projects/WaterEmblem/
118 stars 27 forks source link

Reduce data being saved during suspend game #179

Closed chessmasterhong closed 9 years ago

chessmasterhong commented 9 years ago

Currently, suspending the game saves all properties of each unit. This causes issues in certain browsers with limited Local Storage space. As of commit cad2e1268e5af053bb8accf518fdefb46a7d6deb, saving the ig.game.units array takes up a little over 86kb. The full save size will be more since we also need to save other game data as well.

The objective is to trim the amount of data saved down to the essentials. Examples are type, checkAgainst, entitiesAvoid, etc. as they are never changed after entity creation. We only want to save data that can change either through certain events while playing the game or through random number generation.

chessmasterhong commented 9 years ago

This issue has been addressed in commit f78d6b377a90fb478bd0b4166cf8e171fefee351. However, if any additional save data can be trimmed (or added), it can be easily done so based on the implementation.