Fandom

GameBlender 4 Ever

SaveLoaderStoreRestore

57pages on
this wiki
Add New Page
Talk0 Share

This page is still under construction

Under Construction

When you see this graphic it means that the page you are viewing is not yet complete.
If it is a tutorial for example, it may be missing vital steps, or it may not yet be written to completion.

| Edit this page | View all articles still under construction |


What is meant by store a scene?Edit

A scene consists mainly of a bunch of objects. These objects are setup at startup as defined in the blendfile. While running the gameengine the objects change their internal states (I will call them elements states) as position, orientation, properties, object state etc.. When the scenes is reloaded all these changes are lost. To recover the objects elements the previous state must be stored in an scene independend container.

The preferred choice is GameLogic.globalDict.

Why GameLogic.globalDict?Edit

First of all GameLogic will not change during scene reload. So the elements states can be stored anywhere within GameLogic. GameLogic.globalDict has the advantage that it can be saved to disk by the KX_GameActuator. With the same actuator the file can be read from file and stored to global dict.

Prepare the scenesEdit

I assume you have your own scenes prepared. For this tutorial we need two demo scenes to switch between them.

How to store a sceneEdit

This is quite easy. First of all, you need the SaveLoad.py. I assume you already did the SaveLoaderLinking Tutorial. After that, the SaveLoad.py should be present in your file. Now you have to define when you want to store the scene. In this tutorial it will be done when switching to another scene. That allows to reload the scene when you came back.


File:X.png


Back

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.