GlobalDict!

Hello!
Might sound a bit stupid but what exactly can you achieve using GlobalDict?
Some examples? I know you can use it for save load.
Why would you use GlobalDict?
Thanks.

In my opinion it’s a Global dictionary to save global variables.
It might be a persistent “object” as long as the BGE is running!
It’s very usefull, since your variables will “die” if they are hold in a scene based object, and the last is destroyed by scene change or end object. GlobalDict is scene independent so it’s like this safe vault for your data, no matter what happens…

bge.logic.globalDict is the one dictionary the Save/Load actuators knows about.

It is hardcoded into these actuators. This makes them a bit inflexible but avoids confusion how to set them up.

The idea of simplifying the actuators this way might be nice. But the fact that you need a good Python/BGE knowledge to fill global dict makes it … inflexible ;).
Please be aware if you use the save/load actuators the dictionary should not contain any references to game objects/meshes/materials/scenes etc… They can’t be saved as they will die with the scene. But you can save their states and assign the loaded states to objects that exist at the time of loading.

globalDict as central data storage is a question of your design, as there are a lot other options to store data independent from objects/scenes.
E.g. you can add any data to any module that is loaded (incl. bge.logic).

Okay! Thank you both!
I can load proprieties,values etc. Its quite useful.:smiley: