Editor Modularity and a Plugin / Extension Framework #1103
Replies: 4 comments 3 replies
-
Bevy is using plugins already in other places where they are not implemented as a separate process. There the decision was to stay in process. Probably because we should not push solutions up to another level of complexity if a less complicated solution will do the trick.
I'd vote for the most simple solution. |
Beta Was this translation helpful? Give feedback.
-
There are good points on both sides here. IPC solves a lot of the problems inherent to "in-process" / dynamically linked plugins. But it also creates new problems (cpu overhead and code complexity). I would prefer it if the Bevy Editor was just a "normal" Bevy App that uses normal Bevy Plugins. This keeps the complexity of the system low, the barrier to contribution low, and the performance high. If the current Bevy Plugin approach by itself isn't a suitable solution for editor extensions, I think it makes sense to solve that problem generically so that it can feed back into other Bevy Apps. Maybe that means adding WASM App Plugin support. Maybe it means sorting out dynamic plugin loading (which we already have partial support for ... but only when the plugin is compiled on the same machine / toolchain as the editor ... and I'm not even sure it still works). IPC feels a bit like a "special case" solution. It might work for the Bevy Editor by exposing specific pieces of functionality, but I would feel less comfortable asking all Bevy users to solve their problems that way in their apps as it "punts" the problem to user-code. Whatever solution we choose should follow the current "Bevy App Model" imo. Anything else feels like a compromise / forces people to rewrite things when they want them to be "dynamic". In the early days of the editor, I think it makes sense to use "compiled in" plugins. Bevy Plugins are my ideal extension model (from an api perspective), they require no additional architectural changes, and we can start writing code now. Any future "dynamically loadeded" solution should support an interface that is as close to the current Plugins as possible (ideally identical). So if/when we need to support dynamic scenarios (and/or sandboxing), it shouldn't be a significant change to port things over. The "compiled in" approach also encourages a "source first" approach (kind of like crates.io). This encourages open development, but it comes at the cost of making it hard to create monetized proprietary products. In the short term this is probably a good thing as the market for that is pretty small and open development means we can all learn from each other. I think its been a good thing for the crates.io ecosystem. But long term I think it makes sense to support developers that want to sell products. |
Beta Was this translation helpful? Give feedback.
-
Dynamic loading is inherently much more unsafe than IPC, so that's something to consider. |
Beta Was this translation helpful? Give feedback.
-
So, broadly speaking, my personal vision for the Bevy Editor is:
To me, this imposes the following constraints:
The existing plugin model, as I understand it, is just simple syntactic sugar. There's no scoping, no enforcement of separation of concerns, no current way to dynamically load them etc. For game-specific logic, you often want the level of power / customizability that comes with working with raw source files, and are willing to tolerate a higher level of vetting to avoid unintended behavior of all sorts. I don't think that's the case for extensions that modify the editor itself. |
Beta Was this translation helpful? Give feedback.
-
Like most high-intensity tools, Bevy's game engine will require a high degree of customizability. The variety of games made (from visual novels to platformers to factory builders to 3D open world games) will have very distinct workflows: necessitating the addition of some niche features and rendering other features nearly obsolete.
Rather than attempting to capture every possible use case in the editor through configuration, I propose that we make extensions ("plugins" is already used for something else in Bevy) a core part of the editor's architecture, as you see in programs like VSCode. Ideally, I think it makes sense to build the editor's core functionality through these extensions as well, as you see in Factorio's mods, maintaining a single workflow to modify the editor. This encourages modularity, will help us develop the API as we build the editor, and ensure that core functionality can be interacted with, modified and toggled just as easily as other.
As I understand it, there are two proposed architectures for this:
Pros of dynamic loading
Pros of interprocess communication
I think IPC is the clear winner here.
Beta Was this translation helpful? Give feedback.
All reactions