Does the game state need to be modeled entirely by object properties?

Hello all. I am wondering if designing in Blender limits me to only those variable types found in the “Type” menu when setting a Game Property. It would make things much, much easier for me if I could instead model the game state in Python, using custom-built classes; however, the Python API states that “only python built in types such as int/string/bool/float/tuples/lists can be saved” to globalDict. The global dictionary in general seems disappointingly limited, are there any other options for saving game states?

You can use any Python type you want.

I believe this only applies to when you “save” to disk (using the save game logic). You can still either;

Pickle your object.
Write an introspective base class for objects that need to be saved that can serialise the object (does something similar to pickle)
Consider why you need to save entire objects.

The following types can be pickled:

  • None, True, and False
  • integers, floating point numbers, complex numbers
  • strings, bytes, bytearrays
  • tuples, lists, sets, and dictionaries containing only picklable objects
  • functions defined at the top level of a module
  • built-in functions defined at the top level of a module
  • classes that are defined at the top level of a module
  • instances of such classes whose dict or the result of calling getstate() is picklable (see section Pickling Class Instances for details).

In essence, Python’s built-in data types are the fundamental units for creating any sort of object (class) or representing whatever data type you want. To say it is limited is somewhat inaccurate.