Replies: 1 comment 1 reply
-
I think it is a very good idea, we actually discussed it last week in the team. Another feature that will be the result of this is that you can add a game to a game. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been looking at flame's code, and noticed that there are lots of similarities between
BaseGame
andBaseComponent
: they both have aComponentSet
, facilities to add, remove and rebalance children.So I was wondering, what if, instead,
BaseGame
had a single "root"BaseComponent
that would serve as the container for all other components? This could have the following potential benefits:BaseGame
andBaseComponent
;BaseGame
and theBaseComponent
. For example, currently one of them haspropagateToChildren
while the otherchangePriorities
, however, both methods should be applicable to any component tree;BaseGame
has a single root, certain features are easier to implement:onGameResize
can be handled by removing the current root and replacing it with a new root recreated from scratch to fit the new size;Navigator
) can be accomplished by replacing the current root with a new root that implements the UI for a new page. For example, consider a hero travelling on the world map and deciding to open his/her inventory. If the inventory is full-screen, I could just replace the rootWorldComponent
with theInventoryComponent
, and then switch them back when the inventory is closed. I can even make the WorldComponent run at 1/10th of the normal clock speed while the inventory is open by runningworld.update(dt/10)
in my inventory's update function.I don't see any downsides with this approach (but obviously my knowledge of the engine is very shallow), and it won't be a breaking change. A new method
BaseComponent replaceRoot(BaseComponent)
will be added.What do you guys think?
Beta Was this translation helpful? Give feedback.
All reactions