Basic game physics – from Newton to code

While we my not often think about it, movement of objects is one of the key aspects of most video games. In any game that has any sort of characters, enemies or items interacting in a fictional – or real – world, these agents and objects have to move in order for anything to happen.

In most cases, we want these movements to appear natural, or at least believable and consistent. This allows the player to better put themselves in the feet of the protagonist, or avatar, as they can control their movements in an intuitive way – not having to think about each key press individually, but merely willing to move in a certain direction and letting muscle memory take over from there.

Continue reading →

Brainstorming civilian AI

One of the projects I am currently working on is a game called Centipede in which the player controls a giant centipede in a city with the goal to cause as much havoc as possible.

Next to damaging and destroying buildings, vehicles, and other static objects, there are of course a large number of humans to serve as snacks, or – if armed – nuisances.

To make the game fun and engaging, it is important that these simulated humans react at least somewhat realistically to the chaos developing around them.

Ideally, their behaviour would also be reasonably complex and not entirely predictable, to make interacting with them more interesting.

Continue reading →

Snake: Smooth and accurate following behaviour

Following another object is one of the most basic movement behaviours an item can exhibit – both in the real world, and in games.

There are many different ways in which objects can follow each other, and depending on the circumstances, different kinds of movement may be appropriate.

Today we will look at one particular kind: A number of objects following another in a trail at regular distances. The movement found in games like Snake.

However – unlike the original Snake and many of its spin-offs – we will neither constrain ourselves to a grid, or to fixed time steps.

Instead we want our solution to follow arbitrary paths with arbitrary accuracy.

Continue reading →