Simple AI movement

I’ve been playing around with some simple AI movement algorithims. In the demo below the blue character is constantly moving in a wander behaviour. The 3 red characters move based on the behaviour chosen in the select box. The behaviours are as follows:

  • Wander: Moves forward according to thier orientation, which constantly changes randomly.
  • Seek: Moves toward a target point, in this case the blue character.
  • Flee: Moves away from a target point, again the blue character in this demo.
  • Arrive: Move to a target position, easing to a stop. This point is randomly chosen in the demo.

Source code note: If you are curious about the implementation, you can look at gamecore.js. The AI logic for this is in the newAI() function. The rest of the code is a simple game engine, and not directly related to AI.

Tagged:

programmer, game-dev, development, code, programming, Game-dev, games, design patterns

You can contact me on Twitter.

Recent & Popular Articles

Browse All >