Java Game Programming – Intro to AI


Video is ready, Click Here to View ×

In this episode of Java Game Programming we expand our 2D Tower Defense by programming the beginning of some simple artificial intelligence for the enemies in our game. We teach them to observe their environment and react accordingly, the beginning steps of having self-pathfinding enemies with smart detection and the ability to adapt to changes in the game world.

Follow us on Twitter: @XCoastGaming

12 thoughts on “Java Game Programming – Intro to AI

  1. I need some explanation regarding the pathContinues() method inside enemy class. I do understand what "x" and "y" values hold (they hold the mouse click coordinates), but I simply cannot understand how these mouse coordinate values reach these "x" and "y". Up until this point I managed to figure out all of the stuff you showed. However, this one is hard for me to crack.
    Really appreciate the help!

  2. Not sure if you still pay attention to these comments but quick question. On the int[][] map = { blah blah blah} inside the boot class, we have it set up to 20 x 15 0's and we have the resolution set up to 1280 x 960. I want to change it to 960 x 768 which would be 15 x 12, but if I try erasing some of the 0's to make it 15 x 12 in the boot class, it crashes.

  3. It appears that this is the point where my game can't be directly programmed by your tutorials anymore. I need my game to collide with pixels of images that do not have an alpha value of 0, and not the tile grid. The tile grid is still going to be in, but I need to be able to have things like slopes and half blocks.

    Anyway, thank you so much for the tutorials! They've really helped me out a lot!!

Leave a Reply

Your email address will not be published. Required fields are marked *