Jump to content
  • Advertisement
Sign in to follow this  
Ecoste

2D AI

This topic is 2626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!