Cowboy Programming
cowboyprogramming.com · Personal blog · on HN since 2007
Mick West, a veteran game programmer, writes about game development, programming practice, and engine design.
What HN saysHN links it for his 2007 article 'Evolve Your Hierarchy', which many credit as an early introduction to entity component system ideas.
31HN people shared it
13linked it in comments
20stories submitted
309story points
3 years agolast shared
2007people per year2026
Most-shared posts
- 1Evolve your hierarchy13 people · 30 points · first shared 2009 · 10 comments on HN
- 21995 Programming on the Sega Saturn3 people · 157 points · first shared 2016 · 31 comments on HN
- 3My coding practices in 19913 people · 12 points · first shared 2008 · 1 comments on HN
- 4The Seven Stages of the Programmer2 people · 57 points · first shared 2009 · 22 comments on HN
- 5Mature Optimization2 people · 24 points · first shared 2007 · 5 comments on HN
- 6Programming Poker AI2 people · 3 points · first shared 2008 · discussion on HN
- 7Fluid Mechanics in Game Programming1 people · 19 points · first shared 2008 · 3 comments on HN
- 8Debugging Heisenbugs1 people · 3 points · first shared 2008 · discussion on HN
- 9Practical Hash IDs (2005)1 people · 2 points · first shared 2015 · discussion on HN
- 10Pushing Buttons: Resolving Ambiguity in Video Game Controls1 people · 1 points · first shared 2022 · discussion on HN
- 11Managed Code in Games1 people · 1 points · first shared 2016 · discussion on HN
- 12Homepage1 people · first shared 2022
- 13Falling sand game from the 80s1 people · first shared 2018
- 14Style1 people · first shared 2023
What HN people wrote when they linked it
smcameron · 2022-09-10
Mick West... after a bit of rummaging around in the cobweb infested corners of my brain I remember Cowboy Programming: https://cowboyprogramming.com/
trentonstrong · 2012-06-08
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.
drblast · 2018-06-17
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…
nayuki · 2023-11-09
Me too. From what I can see, its stylesheet https://cowboyprogramming.com/wp-content/themes/tiga-06/style.php returns an HTTP 404 status but the actual text seems to be correct CSS code.
MaulingMonkey · 2021-09-08
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.
mrspeaker · 2021-07-16
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.
pepemysurprised · 2021-06-21
Also see my comment above, but you find this kind of storage commonly in game development [0] where you are optimizing for batch access on specific columns to minimize cache misses. It's usually used as the storage layer for Entity Component Systems. It's also called data-oriented design [1]
[0] http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
[1] https://en.wikipedia.org/wiki/Data-oriented_design
jaberwocky333 · 2019-10-06
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
corysama · 2019-06-12
For nostalgia purposes only: http://cowboyprogramming.com/2010/06/03/1995-programming-on-the-sega-s…
Things were much simpler back then. But, simple did mean easy. It meant you had to do every little thing manually from scratch.
glaberficken · 2018-12-17
Maybe this is the original author?
World of Sand by DOFI (2005)
http://ishi.blog2.fc2.com/blog-entry-158.html
can anyone find an earlier falling sand type game?
edit: Found this after some googling:
http://cowboyprogramming.com/2007/03/05/falling-sand-game-from-the-80s…
very interesting! (includes assembly source code)
cpeterso · 2012-09-08
Here are some game tech articles that I found interesting:
* Fixing Pathfinding Once and For All: http://www.ai-blog.net/archives/000152.html
* Scenegraphs: Past, Present, and Future: http://www.realityprime.com/articles/scenegraphs-past-present-and-futu…
* Evolve Your Hierarchy: Refactoring Game Entities with Components: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
dkersten · 2009-08-25
Sounds like he wants "Entity Systems" (as defined by how game developers use the term).
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
http://www.gamedev.net/community/forums/topic.asp?topic_id=468572
http://www.gamedev.net/community/forums/topic.asp?topic_id=489703
http://didntread.wordpress.com/2009/07/14/building-a-stackless-hierarc…
derefr · 2017-05-28
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:…