Page 1 of 1

Entity Prototype Composition

Posted: Thu Apr 21, 2016 10:57 pm
by metalhedd
Apologies in advance if this has been brought up before, It's difficult to search for.

So far one of the bigger problems I've had with modding is finding an appropriate prototype to base my new object on. the closest would be an ammo-turret, but I want it to also require electricity to work, and that's where the problem lies. There isn't an existing turret which both requires ammo, AND draws electricity.

What I'd like to see is "behaviours" which can be given to prototypes, instead of behaving like one existing entity, they would all be based on composable behaviours. 'draws_power', 'can-request-logistics', 'attacks-nearby-enemies', 'has-inputs', 'has-outputs', the lua api wouldn't look much different.. things like animations and sounds would need to be standardized so that they could apply to any entity, but other than that, it would basically just allow for more of the existing properties to be used with any prototype.

This is probably extremely difficult to implement this late in the game, but It's essentially an entity component system (forums won't let me post the wikipedia link in my first post), and It would really expand the possibilities of what mods can do.

Re: Entity Prototype Composition

Posted: Fri Apr 22, 2016 2:35 am
by Rseding91
metalhedd wrote:... but It's essentially an entity component system ...
Yeah that's not happening :)

It would require a complete re-write of the game from the ground up to *maybe* work and I have extreme doubts it could be done without a huge impact on performance and the number of bugs introduced/difficulty of debugging a given issue.

Those issues aside: I've never seen any game implement such a system that did anything close to what Factorio does today.

Re: Entity Prototype Composition

Posted: Fri Apr 22, 2016 12:06 pm
by metalhedd
totally understood :) The elecric ammo turret can never be.

Re: Entity Prototype Composition

Posted: Fri Apr 22, 2016 6:27 pm
by Adil
Well, you still can do a composition of different entities to get the functionality. Klonan's burner generator is an adamant example of such.

Re: Entity Prototype Composition

Posted: Fri Apr 22, 2016 7:54 pm
by seronis
Rseding91 wrote: Those issues aside: I've never seen any game implement such a system that did anything close to what Factorio does today.
Dont Starve uses LUA for its game behavior and scripting and does use such a component system, but it doesnt handle even 1% as many simultaneous entities either.