I really adore Factorio, and I love a modded Factorio even more (Bob, Angel, AAI, Deadlock <3). I wanted to start this topic for over year now, and after seeing the announcement trailer of Satisfactory I knew I just had to sit down and start writing.
When you place an entity (a prototype) in the world of Factorio, all its behavior is baked in. The entities that are currently available can been viewed here.
If you place inserter on the map, the way it behaves, how the UI reacts when the mouse hovers over it or click on it, is all baked in the entity's prototype.
When overriding/inheriting the prototype in your own mod for a custom variation of the inserter, you can adjust some properties like speed, artwork and stack-size, but not what you see in the UI when inspecting it with your mouse.
I think Factorio would become better moddable when the entity's behavior would be split up in components. To keep the example of the inserter, the components would be:
Code: Select all
- PhysicsComponent ; Defines the physical dimensions of the entity. - SelectionComponent ; Defines the UI / interaction boundaries of the entity. - InserterComponent ; Defines the actual behavior of the entity. - HealthComponent ; Defines the an entity has health, how much and that it can be killed/destroyed. - EnergyComponent ; Defines whether this component consumes or produces (electric or chemical)-energy and how much of it. For example: the InserterComponent should aware / linked to one or more EnergyComponents added to the entity, so it can draw energy and operate in it's update cycle. - LogicComponent ; Defines logic/combinator capabilities of the entity. - SpriteComponent ; Defines the visual representation of the entity, if and what animations/shadows are displayed on what layer for example. - UIComponent ; Defines user-interface representation of the entity, what UI pops up when clicking on the entity and what UI is shown when hovering over the entity. - AudioComponent ; Defines the audio capabilities when the entity is operating. - ContainerComponent ; Defines the capability to store (and possibly filtered) items. - ScriptComponent ; Defines the capability to run a Lua-script using the entity as context, to support specific behavior or direct the other components.
Components can be hierarchically structured when needed and changed at run-time (when a finished research adds new cabilities to existing entities for example).
This entity-component concept I am describing here is nothing new, it is widely adopted by all modern middleware game-engines. Ultimatily, by 'divorcing' the innate behavior of an entity into distinct components, the game's modding capabilities should be greatly expanded. It also allows for further performance enhancements and parallelization; the inserter-components's minimal data-structure can be memory-aligned and updated instead of dereferencing the entire entity in memory.
A mod-developer has little controle over how well an Vehicle-entity performs in great numbers, when the intent was only to create a 1x1-cell train system, but with this system the mod-developer only has to add and configure the components that it really needs to get the job done.
Obviously changing the entity-system is not a small endeavor, not something that can be squeezed in 0.17 release, but I am convinced that this modernizing change allows Factorio to grow to new heights and secure a place in the future, after all; it is the modding-support which yields such an amazing replayability.
Thanks for reading!