4 ms·
Position is usually an entity level property. But, assuming it isn't, you would make that portion of things it's own component/trait of the entity. Components
by throwaway13337 5y ago
Position is usually an entity level property.
But, assuming it isn't, you would make that portion of things it's own component/trait of the entity. Components that rely on it could be declared to require it (in Unity, there is a RequireComponent annotation). So you can be sure if that component exists, that its required component also exists on the entity. I think this is a reasonably satisfying solution.
- jcelerier 5y ago> Position is usually an entity level property. that's a very very video game centric point of view. If a pattern only works in a couple fields of application, it's not a very good pattern..
- adamrezich 5y ago...for anything other than the field where the pattern makes sense, of course
- void_mint 5y agoThis is a dogmatic take. From wikipedia > Entity–component–system (ECS) is a software architectural pattern that is mostly used in video game development.
- munificent 5y ago> that's a very very video game centric point of view. ECS was invented for and is primarily used by videogames. > If a pattern only works in a couple fields of application, it's not a very good pattern. I completely and totally disagree. How would you even define a "field of application" without there being patterns and practices that are unique to it? If every domain uses the same techniques, what is the difference? Off the top of my head, here are some patterns that I rarely see outside of their primary domain: Programming languages and compilers: * Recursive descent * Top-down operator parsing * The visitor pattern * Mark-sweep garbage collection and the tri-color abstraction Game and simulation programming: * ECS * Per-frame arena allocators * Game loops * Double buffering * Spatial partitioning
- jcelerier 5y agoExcept the visitor, which can be useful in pretty much any system with polymorphism, and maybe "game loops" I definitely would not call any of those patterns ; methods and techniques maybe. These words don't mean the same thing, a pattern is much more general than a technique !
- munificent 5y ago> Except the visitor, which can be useful in pretty much any system with polymorphism In principle, yes. In practice, I've almost never seen the visitor pattern used outside of programming languages. Maybe once or twice in UI frameworks. > methods and techniques maybe. These words don't mean the same thing, a pattern is much more general than a technique ! What's your definition of a "pattern" and why wouldn't the things I list fit in it?
- ehaliewicz2 5y agoIf it's extremely useful in a particular situation, why does it matter if it's not useful outside of that situation?
- learc83 5y agoECS in this case isn't referring to the general method of using entities that have much of their logic defined in components. As you'd have in classic unity with RequireComponent. ECS is a specific software architecture where (among other things) there is no entity level property because an entity is just an identifier--all properties are stored in logicless, data only components. Unity DOTS has an implementation of this.