Menu

HowToSavegamee

Sahits GmbH

Check savegame size

There are some changes in classes that are serialized that may cause a massive change in the size of the savegame. In most cases this is by adding a field that is included in the savegame that reference a whole lot of other objects. Here is how to analyze this and some of the more usual cases:
Take a look at the save game and look for instances of:

  • Logger
  • Binding or its subclasses
    The logger brings in a reference to the Classloader, which basically has a reference to anything. Logger fields should be annotated with @XStreamOmitField. Bindings can also be ignored but the implementation must ensure that the binding does work correctly on the loaded object (e.g. by using lazy initialization on the first use).

Debugging savegame

If the saving of a game takes long, or there is an unexpected increase in the savegame size this indicates that something is wrong. Usually this means that objects are serialized that should not be. This can happen through fields that are not annotated with @XStreamOmitField. An other issue might be fields that have a generic type. The latter case can be resolved by providing a non generic time for that member.

It is also possible that exceptions happen while saving. In that class take a look at the savegame file as well, which is incomplete. The last elment that is not closed will cause the problem.


MongoDB Logo MongoDB