Like I mentioned last time, properly designing and explaining an ECS is best if done in the context of a game. I am actually designing a game while doing it, but for explaining it I want a very simple game.
Breakout is very simple (and is one of the first games I’ve ever owned back on my Atari 2600), so I’m satisfied that it’s a good choice.
I will, however, expand a bit on simple breakout in order to use a bit more functionality out of ECS. Instead of single player Breakout, I’ll make Breakout Deathmatch!
Instead of just one player, there will be two. Here’s the basic design:
Please excuse the horrendous drawing. Another benefit of doing Breakout is that it won’t require anymore of my art.
- The bricks will be colored differently on each side.
- Each ball will be ‘owned’ by the last player that hit it with their paddle.
- When a brick is broken by a ball, the player that owns that ball will get points.
- When a ball breaks an opposing brick, it will give more points than a same side brick.
We’ll get back into actually implementing this and see the basic patterns for a system.
All posts about the development of SwiftECS can be found here