Scene Management

Hello,

I have been thinking this for a while and finally came out with an idea. Maybe it was obvious or @lubos already had a nice solution for this in mind but now that logic nodes are coming I think it’s a good time to start the topic.

In the same way that Unity manages Scenes and Unreal manages Maps, Armory needs a way to change from one scene to another.

Can Blender Scenes be used for this? In the past I used multiple Scenes in Blender to compose an image but I think this can be used in a different way for Armory. I guess that Armory could use these Scenes to build not just one level but N-levels and load one at startup (selecting which somewhere) and then having a way (scripting, node) to load one (synchronously / asynchronously).

Using the new Scene5.blend as reference; in the screenshot I created two more fake Scenes. I renamed the default one to “Stage1” and created “Stage2” and “Menu”. Imagine setting “Menu” as the start scene and, after hitting play, change to “Stage1”. Of course, after completing “Stage1” go straight to “State2”.

Having a load Scene would be interesting. Create a new Scene called “Loading” and jump to “Loading” between stages. This, maybe, reveals the need of passing arguments between Scenes or having parameters in that loading scene function/node, so “Loading” knows which Scene to load asynchronously after started playing.

This is just a thought… this solution could have a lot of problems… are assets/nodes/materials/etc. going to be shared without problems between scenes?

If this is not possible for some reason… how do you think scene management could be done in Armory?

Edited: By the way… I’m loving the logic nodes!

3 Likes

Thanks for bringing this up, handy to draw more ideas on this topic.

I am also hoping that Blender Scenes can be used for this. Some functionality is already implemented, added example scene at:

  • https://github.com/armory3d/armory_examples/tree/master/logic_scenes

  • Set Scene node makes it possible to switch to different scene

  • Spawn Scene node drops different scene contents into active scene

  • These nodes are asynchronous on HTML5 targets, but not yet on native / C++ ones - the code in Armory is already async, ‘just’ need to implement async loading in Kore (underlying C++ lib) itself

  • There is not yet much control on assets management - contents of new scenes should get loaded properly though

  • This is mostly untested territory still - for example when switching to the scene with no camera, Armory goes down

(Unfortunately I already discovered bug in the Spawn Scene node, this one-line patch is needed to make it work properly. No need to recompile anything.)

There is also this ‘burried’ drop-down button under Properties - Render - Armory Project - Play Active Scene. When unchecked, it is possible to select which scene to load at startup:

Will need to clean up the UI soon, it’s still all over the place…

2 Likes

Oh! You are right, almost everything is there already! :blush:

I patched SpawnSceneNode.hx manually and the new example is working like expected.

I will try to test these nodes with different assets shared between scenes (also with externally linked assets) to gain more understanding of how is behaving everything with the Blender multi scene approach.

1 Like

Hi!

Just to let you know that tests with simple shared objects between scenes and simple data blocks (objects, meshes, simple materials) are working ok!

Hope to find more time in the near future to test more complex things.

1 Like