Our game continues…

As a training project for new starters we get them to work on a game where the objective is for a character (provisionally named Roland), to escape a mine which for excitement, is home to a prehistoric pterodactyl. The development is partitioned into two area, game mechanics and character modelling.

Two models have now been completed: the player character, and the enemy pterodactyl.

The player character

Below is both the player, animated as it will appear in game. The game is intended to be a modern take on an 80’s classic, so we want to initially appear to be 2D, but with the lighting and movement benefits we get from a 3D model.

The idle animation
The jump animation
The run animation

The enemy!

Here is a screenshot of the pterodactyl in Blender with a coloured render.

Planning the pterodactyl movement…

The intention is that pterodactyl is to fly around the cave, protecting it’s eggs and hunting the game character (which it sees as a threat).

There are five external states for the pterodactyl :

  1. Sitting
  2. Walking / crawling
  3. Taking off
  4. Flying to destination
  5. Landing
The state transition diagram for the birds external states

It seems natural that a real bird would spend the majority of it’s time at the nest, only leaving it to hunt. Also, that it would prefer not to be in the air flying unless there was a reason to be. This might be modelled with two timers:

  1. Time spent away from the nest
  2. Time spent in the air without rest

It maybe realistic for the birds simulated intelligence to try to minimise both of these times.

The bird (internally) has five states:

  1. Guarding the nest
  2. Patrolling the cave (exploring)
  3. Aware that prey is close
  4. Actively hunting
  5. Returning to nest
The state transition diagram for the birds internal states
The bird in flight
The bird at rest

How, and when does the pterodactyl select a destination?

It seems reasonable to assume that the pterodactyl has to select a destination that is first in its line of site. We therefore have to determine what the line of site is.