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
Uh oh!
There was an error while loading. Please reload this page.
-
I've been looking at flame's code, and noticed that there are lots of similarities between
BaseGameandBaseComponent: they both have aComponentSet, facilities to add, remove and rebalance children.So I was wondering, what if, instead,
BaseGamehad a single "root"BaseComponentthat would serve as the container for all other components? This could have the following potential benefits:BaseGameandBaseComponent;BaseGameand theBaseComponent. For example, currently one of them haspropagateToChildrenwhile the otherchangePriorities, however, both methods should be applicable to any component tree;BaseGamehas a single root, certain features are easier to implement:onGameResizecan 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 rootWorldComponentwith 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