Entity-Component Approach

Have trouble running Legend of Grimrock 2 or do you have questions about the purchasing options? Look for help here.
Post Reply
User avatar
zajoman
Posts: 29
Joined: Thu Feb 27, 2014 8:32 pm
Contact:

Entity-Component Approach

Post by zajoman »

Hi, Petri!

I'd like to ask you a few questions, again. This time about the entity-component style you switched to in Grim 2. When reading about the composition approach vs classical inheritance model for the first time, many people are in awe how amazing the former sounds on paper. Now that you've created a whole game with such an approach, I'd like to know what you think are the pros and cons and quirks of the system.

(I understand some of these questions may be too nosy, so please just ignore those you don't feel like answering.)
  • Despite the modular nature of components, did you end up with code duplication in some of them?
  • I assume that In LOG2, a component is a class (table with variables and methods). Do some components inherit from other components?
  • It's my understanding that your base GameObject has the position, rotation, and scale transform built-in; it does not have a TransformComponent like GOs have in Unity for example. Did you do this to simplify the logic, as every GO has to have the Transform anyway?
  • How do you manage the inter-component communication? Directly (self.go.otherComponent:doSomething()) or do you use some event dispatcher?
  • Some objects have the HealthComponent. Breakable stuff mostly. I assume monsters and party members handle health in a different (and more complex) manner. Right?
  • Bonus: Why do you not allow function_names_like_this() in mods? :) Only functionNamesLikeThis are allowed.
Thank you!
Check out Vaporum, the steampunk dungeon crawler we're working on. http://www.vaporum-game.com
Post Reply