2D AI

Started by
2 comments, last by Morley 12 years, 6 months ago
Hello, I was always wondering how to make AI for just a basic 2D shooter. I have a plan about how to go on them but it's super stupid and un-efficient. (java)
Advertisement
"Programming Game AI by Example", Mat Buckland, is a good reading.
The most basic AI in 2D is to take the current position of the player and subtract from it the current position of the enemy. This will give you a 2D vector that you can use to point/move the enemy so that it goes after the player. You'll want to scale this vector by some fixed amount so that the enemy doesn't jump right ontop of the play in one time step.
There are many AI examples/scripts, one kf the most simple being the Flocking AI as mmakerzem mentioned. After you get the flocking ai down, you can actually build upon it such as foreach loops and all that and raycasting.
Morley

Aspiring programmer, modeler and game designer.

This topic is closed to new replies.

Advertisement