My Introduction to ECS

Author: Alexander Avery

Posted: Thu | May 14, 2020

game-dev A shimmering and sharp amethyst crystal.

My discovery of ECS (entity component system)

I developed my first game, SpaceMail, with GameMaker Studio and GameMaker Studio 2. During the rework, I decided to use the Godot engine to cut my dependency on Windows. On both implementations, I used an object-oriented approach, as that’s what I had been taught in college.

The Amethyst game engine

I hadn’t heard of any other approach to game development and hadn’t imagined there would really be another simple approach. I only discovered ECS when my interest in Rust began. After using C++ in my networking class in college, I wanted to harness the power of low-level languages. I had nothing against the language C or C++, but what I struggled with was my inability to find proper documentation for libraries I wanted to use. Every reference or guide seemed either too antiquated or assumed I knew more than I did. This is where Rust shined for me. The Rust book itself was a massive help in picking up the language, and it seemed like every library I was interested in had decent documentation as well!

I knew I wanted to potentially use Rust in my future programs, so in my search, I came across the Amethyst game engine. It looked great, but one word deterred me from using it: data-driven. I hadn’t heard of this term before in game development, and considering that I was still struggling with understanding Rust at the time, I didn’t want to pile more concepts into my head. I abandoned the idea for a few months until I happened across a fantastic dev-log on YouTube by Thomas Randall.

Shining a light in the dark

Perhaps my mind had developed more that year, or maybe I caught these videos after a solid night’s sleep. Either way, Randall gave me a quick introduction to data-driven design that I understood. Not only did these videos help me understand what ECS is, more importantly, they explained to me why it is a helpful design pattern (also, his videos are full of hilarity).

Let’s try this thing out

Now that we’ve basically caught up to the present day, I am building a new game with this entity component system in mind, and I wanted to share with you some of the awesome ECS game engines that you can use!

Amethyst

This is the engine that introduced me to the term data-driven. If you like Rust, then this engine would be a great introduction to ECS. The Amethyst book, like lots of other Rust documentation, is thorough and helpful in getting started.

Engo

Engo is an engine for another systems programming language that I love: Go. It has the potential for mobile deployment, so if that’s your target, then this is a good engine for you.

Love2D and Tiny-ECS

Love2D is a popular game engine for lots of developers. Tiny-ECS will let you use what you are already familiar with to make a game with ECS architecture.

Pygame or Pyglet with Esper

Similarly, Python libraries will allow you to implement an ECS with pygame or pyglet. I have been using esper with pygame for my latest project: Happy Wizard.

I hope to at least give all the other mentioned game engines a try in the future, with a strong preference towards Amethyst and Engo, simply because I like the languages so much. Let me know if you use any of these engines for your games! Also, feel free to leave feedback on your particular experience with ECS and other programming paradigms.

Next: 4 Great Qualities of Codewars
Previous: New Beginnings
>> Home