1

I have created some scripts inside Blender's editor for the Blender Game Engine. I am using the Burster plugin to display the blend file (more info on the plugin here)

Because I have learned that one cannot read or write files once the burster plugin displays the .blend file online, I have searched for another solution to saving some data. I have been populating the globalDict in the Blender Game Engine.

This has (unless I'm missing something here ... tiredness and all) allowed the data to be persistent, because the data is manually loaded from inside of a script. I do this because the scripts seem to persist from one opening of the blend file through Burster to the next.

So, onto my questions:

  1. Is there a better way to do data persistence using the above setup (Blender -> Burster)?

  2. If not (or even if so) I would like to know where Blender stores the python scripts that you create, edit and save inside of Blender.

Any advice or help would be very much appreciated.

Ivan Akulov
  • 4,323
  • 5
  • 37
  • 64
Aterxerxes
  • 554
  • 4
  • 13

3 Answers3

1

It really all depends on what kind of "persistence" you're looking to get.

If you want to have data that will stay around for the duration of the game, you have to use logic.globalDict, because that is the only structure which persists across scenes.

1

You can set an attribute in a game object.

    import bge

    def main():
        cont = bge.logic.getCurrentController()
        own = cont.owner
        x = 2
        own["x"] == x

    main()

Now to access it.

    import bge

    def main():
        scene = GameLogic.getCurrentScene()
        cont = bge.logic.getCurrentController()
        own = cont.owner

        obj = scene.objects["obj"]

        x = obj["x"]
    main()

And blender stores its files inside of the .blend file. I do not know a way to access them without blender.

A. Jones
  • 68
  • 6
0

By design, the Burster plugin is not able to save persistent data to the user's computer. The authors of Burster made this necessary restriction (and also turned off the automatic game launching) after I demonstrated some very serious security problems to them.

You can read the full details of what Burster can and cannot do here: http://geta3d.com/index.php?option=com_content&view=article&id=20&Itemid=23

Support for cookies (which would allow saving game state to the browser) was a planned feature, but I'm not sure Burster development is still on-going.

blendenzo
  • 633
  • 4
  • 9