A.I. which can move around a randomly generated 2D city

I am writing an iOS game (using UIView) that has a randomly created 2D city. I need to attack AI, it will take a reasonable way to find a player (without colliding with buildings). Can someone point me in the right direction as to which algorithms I will use to achieve this?

Edit: I decided to use A *. I will create a grid on the map, check every intersection point of the grid, if this point is inside the building, I will invalidate the point. Attacking A.I. the player will move from his current location to a valid grid point that is closer to the target (within a certain radius of its location).

+5
source share
2 answers

You are looking for a class of algorithms called path search algorithms . There are many approaches that you can use.

The classic algorithms here are Dijkstra's algorithm and A * search , which can direct an object from one place to another along the optimal path. These algorithms work by modeling the 2D world as a graph , and then finding the shortest path from the start of the object to the destination on this graph.These two algorithms are widely used in AI and path finding, and I would strongly suggest investing time to learn more about them. There is a solid A * search tutorial available online if you want.

, , , . Berkeley "Overmind" StarCraft AI . , "" , , , . , , , , .

, !

+7

: Pacman: ? - AI 2D- . ( , Pacman) , , AI, . , ( ) ammoQ Dan Vinton.

Pacman .

+2

All Articles