underlay scene from external blend file ? ANSWERRED

Hi guys,

I have a blend file that contains my menu and inventory as sidebars, parented to the camera. From that blend file, I want to load my game levels (1 level per external blend file). I want my level to appear as an underlay scene, so that my menu and inventory sidebars remain visible.
Is this possible ??? :confused:

Thanks !

You’ll need python for this.
If you look at my latest version of DEEP Space you’ll see I have pretty much exactly that!

I use the function:


to get a list of all blender files in the subdirectory “Levels”

Then I use:

path = bge.logic.expandPath("//Levels/"+level)  
bge.logic.LibLoad(path, 'Scene', load_actions=True)

Where level is a string of the name of a blend file. (level should be a part of the list formed above)
This loads that scene. Unfortunately for you it does it as an overlay.
To put stuff on-top of it shunt it off to another scene that you then add as an overlay after you’ve loaded the level.

There is not much more to it that that.

Thanks for the fast reply and the blend file , sdfgeoff !
I’ll have a look at it right now.

@sdfgeoff : “There is not much more to it than that.”

Pfff … You’re obviously a much more advanced bge user then I am !
I think I will get it to work (it sort of works already with my files) … but I’m still not a 100% sure WHY it works. :o

Oh well. Many thanks !

The rest of it is just the user interface.
It is split into two scripts
Half of it, the bit that handles finding the files and selecting the level is in Scripts->menu.py the function “getLevelList”
The other half that actually does the loading is in Script->assets.py the function “loadLevel”

It would be much simpler if there was a good way of setting up user interfaces. At the moment I have a horrible solution.

Here’s a simple demo for this when I was testing it. It does not allow you to select the level, as it just handles importing the blend. It is the bare minimum, and isn’t really useful unless you always need to import the same blend file.
Documentation on libLoad is here. I don’t fully understand it (it being the libNew function…)

As for more advanced than you? I don’t know, I only learned about libLoad less than a month ago…