News for hackers. Stuff that matters.
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by zubairq on Saturday December 28, 2019 @02:29AM (#21897664)
How is an Entity Component System different from Objects and Controls in something like Visual Basic for example?
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by ratww on Saturday December 28, 2019 @07:16AM (#21898509)
Visual Basic controls are more like React components, I think.

ECS is, traditionally, just a way to dynamically add behaviour (components) into "blank slate" entities.

Instead of making a EvilMonster class in a game you just have it as a conceptual entity (normally it's just an integer, like a database id) associated with a bunch of components (normally just plain structs) and their parameters: Renderable, RigidBody, Collider, HasEnergy, HasTransform, AudioEmitter, etc.

You can stitch entities and components together using either code or some external data source. The "S" part of ECS is called the system, and it implements the behaviour defined by components.

The upsides of this IMO is that this is a fantastic way to structure your code. The data-oriented aspect is also great for enabling non-coders to assembly complex entities. And some other clever people (such as the sibling answer) found out this is also a great optimisation technique.

There are multiple implementations, of course, so people have different opinions.

Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by m12k on Saturday December 28, 2019 @04:30AM (#21898046)
I wrote a comment on another post where I explain the cache optimization benefits of ECS, https://news.ycombinator.com/item?id=21674818
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by adamnemecek on Saturday December 28, 2019 @02:58AM (#21897748)
Ecs is more like a database.
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by TeMPOraL on Saturday December 28, 2019 @03:25AM (#21897832)
ECS is all these things and none of these things. It's several separate concepts under the same name; different applications/games pick different pieces of it.

It's kind of meta, really; you can imagine ECS itself as an entity, and different meanings of it as different components that could be included in it.

Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by dyarosla on Saturday December 28, 2019 @09:56AM (#21899183)
ECS is meta? Love the recursive definition ;)