So we've had some discussion lately on IRC, on issues, on Slack, and so on. It tends to get mixed up into a few related but maybe segregated topics, then gets too far off track or complex to follow easily. Thought I'd try to outline it here in a forum thread and let @manu3d also outline his recent musings and discussion on the topic.
I am definitely guilty of mixing it up myself as I try to link topics wanting to be sure related concerns are considered up front. My primary personal desire is getting the Context piece "finished" and applied so we can better control state in-game and have the world preview, module-specific config, and other things working better
Earlier I had thought there were only two topics and they were linked somehow, but I might have connected them where really just one lives inside the other, yet the two can live in separate harmony conceptually. There is also a third topic that got mixed in which is probably much further out - and might even itself be split into two. They are:
Configuration
This is the easiest / smallest piece and already has a pending implementation PR. Some related stuff that has come up:
CoreRegistry -> Context
This is a much bigger topic. CoreRegistry is in use all over the place (989 hits in my mega-workspace...) and while Context is ready to be used and in use plenty of places too all old usages are not yet converted. I am unsure if anything is outstanding before Context would be able to take over entirely for CoreRegistry. Also unsure how much if any change is expected to be able to fully support whatever a refactored Config system would need. Something about injection strategies?
Digging around I found issue #1770 which is an older issue by @Immortius for some engine improvements including assistance for removing CoreRegistry, but while it has a very hefty looking commit listed I don't think it was ever merged. May not have been finished and at this point it might be stale enough to involve problematic conflicts - although we did go v1.0.0 with the engine just a few months later, after which the related architecture may have been more quiet.
Am very curious on how this item would proceed but I suspect it may be longer term and likely need an engine bump to v2.0.0. I am also unsure who can sink effort hours into this.
Having actually written this I'm a little more relaxed in thinking this at least is more separate from the Config item than I thought, with Context just being a container. We still do need to work on it though. I wonder what if any impact there'll be from gestalt-entity-system progressing?
Inter-module sandboxing
The example that came up in issue #2668 was about having a module manage its own whitelist for which other modules could use it. Conceptually this seems useful, but it may not be very needed yet. The stated example would be the first, and I don't think it is enough to mandate implementation of a probably very serious architecture item in the near-term. Gestalt-module was implemented with the expectation that all modules would be equal and playing in the same sandbox, so changing that would be pretty major.
Probably we should shelve this one and keep it out of the two prior topics. Maybe keep it in mind for design purposes, but it is too far off to mix into anything current without blocking it for months if not longer.
It also would likely tie closely with the item below as some things you might want to keep private in a module is extended permissions granted by the engine. Yet other modules could define their own module-internal goodies they might want to keep away from others.
Modules with extended permissions
Perhaps interestingly as per notes in #1703 this is already supported to some degree in Gestalt, at least for the engine. It just hasn't had any implementation work done engine side (maybe in #1705 by @Marcin Sciesinski?), and as part of that the CoreRegistry -> Context piece should probably be finished first.
The idea is that modules could be allowed access to extended engine features not on the regular API whitelist via user/admin prompt/config. As a potential alternative to this could be engine extensions that do not live inside the module sandbox nor within the engine repo itself. I used to refer to that using a new /extensions directory with the same Gradle functionality as libs, meta repos, etc. That way you could develop the more peripheral engine features away from the engine repo itself, like VR / motion controller stuff or touchscreen support. Some others may call this "unsafe mods" or so on.
Like the previous item this is likely a substantial undertaking to do right, and would block anything in the short to mid term, so this is another item I would delay until at least we have some volunteer effort available. However since it does seem to be supported via gestalt-module somebody could try to run a proof of concept.
Others with potential interest: @msteiger @Skaldarnar @Rostyslav Zatserkovnyi
I am definitely guilty of mixing it up myself as I try to link topics wanting to be sure related concerns are considered up front. My primary personal desire is getting the Context piece "finished" and applied so we can better control state in-game and have the world preview, module-specific config, and other things working better
Earlier I had thought there were only two topics and they were linked somehow, but I might have connected them where really just one lives inside the other, yet the two can live in separate harmony conceptually. There is also a third topic that got mixed in which is probably much further out - and might even itself be split into two. They are:
- Simple non-hard coded configuration system - issue #2668 (lots of discussion) and PR #2757. Something @manu3d would like just to make rendering config more flexible to use (would naturally also be useful for other stuff)
- CoreRegistry -> Context. Long-standing desire to avoid the global nature of CoreRegistry in favor of the context-sensitive.. well, Context. @Florian started this, but it is a big thing to apply everywhere
- Inter-module sandboxing. Recently brought up by @SoniEx2 / APNG for perhaps somewhat esoteric reasons, but ultimately something we might want to consider
- Modules with extended permissions - #1703. Sometimes referred to as "Android style module permissions" but previously thought of primarily to sit between engine and modules, not modules to modules.
Configuration
This is the easiest / smallest piece and already has a pending implementation PR. Some related stuff that has come up:
- Splitting implementation from interface. This seems to have architectural support, but I am unsure if it relates here or more in general for the engine. Does the current PR pass that check or could it be done better?
- External library (like typesafe config) - likely lacks willing implementation effort since we're pretty far along with FlexibleConfig. Unsure if it passes the split implementation/interface notion.
- Is any consideration needed at this level for how config would work in different places? In the sense of module-specific config, config only being present in a particular Context, etc.
- Does this end up intruding any on config done in Components, does it need to be more ES friendly somehow? I noted how weirdly some world gen config (which gets displayed in the create game UI) use Component classes seemingly without interaction with the ES. Is that an example of where this kind of config would be a better alternative, or should the two link together closely enough to be seamless between UI config and ES Component state?
CoreRegistry -> Context
This is a much bigger topic. CoreRegistry is in use all over the place (989 hits in my mega-workspace...) and while Context is ready to be used and in use plenty of places too all old usages are not yet converted. I am unsure if anything is outstanding before Context would be able to take over entirely for CoreRegistry. Also unsure how much if any change is expected to be able to fully support whatever a refactored Config system would need. Something about injection strategies?
Digging around I found issue #1770 which is an older issue by @Immortius for some engine improvements including assistance for removing CoreRegistry, but while it has a very hefty looking commit listed I don't think it was ever merged. May not have been finished and at this point it might be stale enough to involve problematic conflicts - although we did go v1.0.0 with the engine just a few months later, after which the related architecture may have been more quiet.
Am very curious on how this item would proceed but I suspect it may be longer term and likely need an engine bump to v2.0.0. I am also unsure who can sink effort hours into this.
Having actually written this I'm a little more relaxed in thinking this at least is more separate from the Config item than I thought, with Context just being a container. We still do need to work on it though. I wonder what if any impact there'll be from gestalt-entity-system progressing?
Inter-module sandboxing
The example that came up in issue #2668 was about having a module manage its own whitelist for which other modules could use it. Conceptually this seems useful, but it may not be very needed yet. The stated example would be the first, and I don't think it is enough to mandate implementation of a probably very serious architecture item in the near-term. Gestalt-module was implemented with the expectation that all modules would be equal and playing in the same sandbox, so changing that would be pretty major.
Probably we should shelve this one and keep it out of the two prior topics. Maybe keep it in mind for design purposes, but it is too far off to mix into anything current without blocking it for months if not longer.
It also would likely tie closely with the item below as some things you might want to keep private in a module is extended permissions granted by the engine. Yet other modules could define their own module-internal goodies they might want to keep away from others.
Modules with extended permissions
Perhaps interestingly as per notes in #1703 this is already supported to some degree in Gestalt, at least for the engine. It just hasn't had any implementation work done engine side (maybe in #1705 by @Marcin Sciesinski?), and as part of that the CoreRegistry -> Context piece should probably be finished first.
The idea is that modules could be allowed access to extended engine features not on the regular API whitelist via user/admin prompt/config. As a potential alternative to this could be engine extensions that do not live inside the module sandbox nor within the engine repo itself. I used to refer to that using a new /extensions directory with the same Gradle functionality as libs, meta repos, etc. That way you could develop the more peripheral engine features away from the engine repo itself, like VR / motion controller stuff or touchscreen support. Some others may call this "unsafe mods" or so on.
Like the previous item this is likely a substantial undertaking to do right, and would block anything in the short to mid term, so this is another item I would delay until at least we have some volunteer effort available. However since it does seem to be supported via gestalt-module somebody could try to run a proof of concept.
Others with potential interest: @msteiger @Skaldarnar @Rostyslav Zatserkovnyi