Mick West, a veteran game programmer, writes about game development, programming practice, and engine design.
HN links it for his 2007 article 'Evolve Your Hierarchy', which many credit as an early introduction to entity component system ideas.
To me, Win32 was already falling away from the more intriguing model, which was Win16.
Effectively, a Win16 system is/was basically exactly equivalent to an Erlang node, but one where your "processes" just happened to be paired, component-wise†, with handles to structs of GUI properties held in window-manager memory.
Like an Erlang node, Win16 is/was:
• green-threaded — i.e. they both have very low-overhead in-memory structures containing a tiny heap/arena and a reference to an in-memory delegate code module, through which execution would pass in turn. In Erlang, these are "processes"; in Win16, these are windows—i.e. actual windows, but also "controls" in the controls library.
• cooperatively-scheduled (yes, Erlang is cooperatively scheduled—when you're writing C NIFs. When you're executing HLL bytecode in the Erlang VM, this fact is papered over by the call/ret instructions implicitly checking reduction-count and yielding; but if you're writing native code—like in Win16—you do that yourself.)
• Message-passing, with every process having a message inbox holding dynamically-typed message-structs that must be matched on and decoded, or discarded.
• Offering facilities to register and hold system-wide handles to large static data-blobs (Erlang large-binaries, Win16 rsrc handles);
• Capable of doing IPC only by having processes post messages to another process's queue, and then putting themselves into a mode that waits for a response;
• Based on a supervision hierarchy:…
A few years ago I wanted to make a shoot-em-up game using C# and XNA I could play with my kids on an Xbox. It worked fine except for slight pauses for GC every once in a while which ruined the experience.
The best solution I found was to get rid of objects and allocation entirely and instead store the state of the game in per-type tables like in this article.
Then I realized that I didn't need per-type tables at all, and if I used what amounted to a union of all types I could store all the game state in a single table, excluding graphical data and textures.
Next I realized that since most objects had properties like position and velocity, I could update those with a single method by iterating through the table.
That led to each "object" being a collection of various properties acted on by independent methods which were things like gravity and collision detection. I could specify that a particular game entity was subject to gravity or not, etc.
The resulting performance was fantastic and I found I could have many thousands of on-screen objects at the time with no hiccups. The design also made it really easy to save and replay game state; just save or serialize the single state table and input for each frame.
The final optimization would have been to write a language that would define game entities in terms of the game components they were subject to and automatically generate the single class that was union of all possible types and would be a "row" in the table. I…
A lot of us - possibly yourself included - were exposed to ~ECS by this 2007 article: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
Archetypes are a conceptually simple implementation optimization (group similarly-populated objects) not unique to ECSes - e.g. v8 organizes javascript objects based on their "shape" (again, grouping similarly-populated objects, based on their "properties" instead of their "components") (2017 article: https://v8.dev/blog/fast-properties .)
You can add all kinds of automagic parallelizing and filtering libraries (which I imagine have some overlap with database query optimization and scheduling in their fundamentals), but the basics are incredibly trivial - to the point where you might re-invent it by accident without knowing it has a name.
Sounds like almost exactly where I started from.
Depends on the game your making but be careful of libraries. Game programming is very different from other types of development. SDL is a good place to start. Godot seems find as well.
You'll want some form of architecture that updates components of entities all at once rather than foreach entity object updating its physics, then sound, then tracking etc
This is for performance and debugging reasons.
This is a good start
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
Source - Just finishing up this game https://store.steampowered.com/app/1058510/Zunius/
Art, code, music and sound done by me
Drop me a line a leonf at coafresearch if you want to chat further
I think originally it was primarily about developer ergonomics - here's the first thing I ever read about them in 2007 where they tested it on Tony Hawk Pro Skater (http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/). The CPU/memory management has been an on-going discussion ever since! Being able to process domains as flat arrays helps with cache misses - but there is a lot of other overhead, depending on how you designed everything.
Making it performant was one of the big problems initially, and it seems like the `Component Graph System` this thread is about trying to answer "how do systems efficiently process components?"... But I don't really get how it answers that actually.
It might be worthwhile to take a look at certain types of game engine architectures.
Since modularity is one of the keypoints of how this editor/game engine work so well together, it's probably a good idea to have some idea of how to structure game components to lessen the 'ball of mud' feeling.
I've been pretty fascinated with data-oriented "entity/component" systems for a while, as opposed to heavily inheritance based models. There's a decent introduction here: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
It seems like a lot of modern game engines (one example would be Unity) utilize this approach to varying degree.