Add MultiScene (World) support
Closed this issue · 18 comments
The goal is to have several Scences to build the creations. And probably Scenes are going to be just a Thing that includes other Things (so the composition is getting richer and at several levels). With this approach we can for example create a fenced Scene. And this fence could be a railway so you can move around the Scene quickly.
So we have the concept of World, which is a list of Scenes.
In order to be compatible with the current approach, mono scene, an initial Scene will be created and all is used in McThings like now.
Ok, the goal is to create a fenced scene. This use case generates a pretty interesting architectural requirement with scenes used as a thing.
Scenes and Things have a common API, but they are different concepts. Both ot them can be a composition of things, but ... what are the diffs between them? Food for thought! Right now we are saving scenes saviing all the things inside them. But probably we can also save a Thing (with its children).
-
The Scene has a connection to the MC server. But this connection could be in the World object which has several scenes inside it. So the World will be the next unique object (singleton) and we can have several scenes. In this case, scenes are more like a composition of things.
-
Probably the key is that a Scene is directly a child of the World
-
The macro and micro APIs are identical yet in McThings. It is just a matter of scale.
-
Should we just define that a Scene is also a Thing? The temptation is great and analyzing the current APIs https://github.com/juntosdesdecasa/mcthings/blob/develop/mcthings/scene.py https://github.com/juntosdesdecasa/mcthings/blob/develop/mcthings/thing.py only the load/save is missing from then Thing API.
Ok, so the bet is to create the world class, which is linked to the minecraft/minetest world. So the connection is here. And there is only one world (the root of all the tree). And then scenes are the direct children of the world.
In all the design I am trying to avoid circular dependencies. But maybe the key is that we can just remove the Scene class ... but my intuition says me that it is a useful concept in the design and in the architecture.
It is important in the Future to have the ability of integrating McThings inside Blender:
and it has the Scene concept.
And when you are working in the creation/edition of the world, normally you are doing it in the context of a Scene.
And loading/saving a Thing probably is not that useful. So load/save could be something specific of a Scene. So a Scene could be right now a Thing with load/save function. So it can inherit from Thing adding this two new methods.
In any case, the use case is to fence a scene. Let's implement that and during the process, let's redesign what a Scene is and its relation with Things, and introduce the World class.
In any case, the use case is to fence a scene. Let's implement that and during the process, let's redesign what a Scene is and its relation with Things, and introduce the World class.
Ok, next steps:
- Add the World code and update McThigs Extra and Scenes so all works with the new design
- Think about and idea to fix the railway issue
After thinking about it, the railway is not a fence, it is just the new Border decorator :) i will change that later.
To test scenes, let's create a Decorator that joins two scenes using railways.
So pending:
- Check the margins in the border test for the railway
- Check the global tests to understand why there are so many railways created!
mcthings, mcthings_extra and mcthings_scenes updated to use the new world API.
Just missing final debug of the railway around the Scence for 0.40.0.
All done! Closing this ticket.
The scene is at:
https://github.com/juntosdesdecasa/mcthings_scenes/blob/develop/apps/scene_railway.py