The Diki Wiki from Dino Dini





Bees

From Igad

Jump to: navigation, search

Using random numbers to simulate intelligent behavior

Hit the HQ button in the viewer after starting to play to get a clearer image!

The bees in this video are driven using a very basic state machine with the key transitions being made using nothing more than random number checks. The bees have three basic duties:

  • Fetch food (there are four fields of flowers coloured green)
  • Ventilate the hive (The bees turn blue and move to the edge of the hive to flap their wings)
  • Chase off intruders (These are the red things that also have behavior driven by random number checks)

Yellow bees are idle in the hive. This is a simple demonstration of how intelligent looking behavior can be generated from simple rules, and this is a fundamental technique I use to generate intelligent and entertaining behavior in games. It was used, for example, in the Kick Off and Player Manager games that I designed.

The two bars on the left represent food reserves (green) and hive temperature (red).

Although the code is very fast and compact and tunable, it is something of an art to tune such systems to get the effect you desire. For me this is very close to the true art of video game development distinct from other disciplines. This simple simulation has about 50 different tunable parameters (at least - I have not counted them). Tuning is all about balancing these to create an effective result.

Now imagine a first person shooter where the NPCs had behavior such as you see here. Maybe this is an example of where the old techniques of video game development learned over decades can be made to enhance modern games. It seems to me much of this particular art is underused in modern games.

</embed>