ECS Pattern: Entity Follow Entity

When I write games I have always something following something else. Camera follows hero. Light follows ghost. Goody follows space ship. Weapon follows player. And so on and so on. This is a very common pattern in my opinion. I do like to show you how to do it with an entity component system. Show you the beauty and reusability of this pattern.

In object oriented way you would give the items to the corresponding object somehow by reference or something. In an entity component system you go the other way around the items does have a link to the object they shall follow. Once you have your system which makes it happen, that every item entity with a link to an other entity will follow that other entity you will be able to let nearly every thing follow anything else.

Read on →

History Back and Forth

When ever you write a level editor or maybe a turn based game it would be of great help having undo and redo functionality at hand.

Based on the Game Programming Pattens Book from Robert Nystrom I did like to implement an undo / redo history object. The implementation is based on the command pattern by the gang of four.

The whole thing start with a command interface which looks like this

package mygame;

public interface Command {
    public void execute();
    public void undo();
}
Read on →

Simple Game Server with Zay ES Part 2

The first part of this serie was about the game server itself. It was not much... but hey now we proceed and write our first simple client! For the client we reuse the VisualAppState from the invader game we wrote in the previous article series about entity system. That spares us a lot of work. And kind a proofe that the VisualAppState is something like a design pattern in ES. We can as well reuse the old EntityDataState.

So ok then let's begin.

Read on →

Lost & Found: Best Test Driven Development Article Ever Read

A year ago I stumpled over one of the best article about test driven development I ever read. Event the title is crispy I mean Stepping Through the Looking Glass: Test Driven Game Development how cool sounds that? Noel did a decent job to explain the mantra (write a test, see it fail, write code, see it proceed, refactor test, refactor code), the use of mockups and the idea of fixtures. There are 3 parts and they are definitly worth reading it. And you will not believe but those articles are over ten years old and still relevant still fresh still entertaining.

Read on →

Simple Game Server with Zay ES Part 1

This time I'm not sure where I will end and what the result will be, but anyway I want to write this article about Game Servers, as well for my self having it documented somewhere. I will shortly describe how to use Zay ES net to implement your own very simply game server. As a base I took the sample from Paul Speed. The sample will be extremly simple and just to the point. I removed every distracting stuff. After having a starting point I will evolve it a bit to show it's coolness.

Read on →

Book: Game Programming Patterns

I recently read Game Programming Patterns book from Robert Nystrom one of the best books about programming I've ever read. I read the entire book from beginning to end and I couldn't stop. Normally programming books bores me to death, expecially design pattern books. The samples are often extremly boring, the text bone-dry and the explanation over complicated.

This book is crispy, fun and it explains you the pattern in a fresh and understandable way. It is also helpfull if you are not a game programmer as it explains the design patterns from the gang of four from a different perspective than you know from your daily work.

I will maybe show some of the patterns as a Java implementation in one or the other blog article. One of my favorit one is the command pattern with history functionality. Very use full for level construction tools.

Entity Component System Part 6

Fireworks

Some simple effects would be cool. But how to achive that? For example we may want a crackle when a bullet hit an invader or some cool 8 bit shot sounds when we fire. And for sure we want to see some nice explosion and hear an impressive blast. You got the point.

In this article we will look how we can get visual explosion. We need, yep exactly, yet another system. I like the fine granularity of those systems. This makes it as well easy to spot the bad guy if something is not working anymore.

Read on →

Entity Component System Part 5

Boom Booom Boooooom

Yes exactly all those bullets and not effect, not hit, no explostion, how boring is that. Let's implement a collision system and let's damage those invaders with the ships bullets. For this we need a couple of things.

In this article series I left out that the invaders as well can shoot at us, but I guess after you are through this article you should have an idea how to solve this.

Read on →

Entity Component System Part 4

Smoking barrels

Now we can control our ship and even the invaders move around, but nobody shoots. Let's change that in our example game. We want to shoot those invaders. There is quite a couple of things involved by that. We need a bullet blender model first. To spare you some time you can have mine from my google drive as usual. Place this beside the ship and the invaders models. Don't forget to convert it to j3o by right clicking the blend file.

Read on →

Entity Component System Part 3

I like to move it move it

Yes there is no point in call that a game when nothing moves on the screen. Not even our ship in the base is controlable in any way. At least we should be able to control the ship, move it left and right. I show you a way to do this by moving the mouse pointer left and right. Sounds promising, no?

Read on →