Archive

Posts Tagged ‘artificial intelligence’

AI Question

January 20, 2011 Leave a comment

For artificial intelligence in my developing roguelike, Space Mercs, I am currently using an adapted version of the Dijkstra Maps as outlined by Brian Walker, maker of the outstanding (and quick-to-play) roguelike Brogue. The way it works is simple enough: you set a zero point somewhere on the map, and all walkable tiles adjacent to that point take on a value of 1, with tiles adjacent to them becoming 2, and so on.

22222
21112
21012
21112
22222

In the above example, the hero (or whatever the NPC’s objective happened to be) would be at the 0. The NPC then ‘rolls’ down the slope from highest to smallest number, eventually reaching 0 regardless of obstacles. This seems to take longer than A* pathfinding, but it has the nice advantage of being infinitely scalable–it takes nearly the same amount of processing power to have 1 enemy tracking your PC as it does for a horde of 15 enemies. When the Space Mercs are being tracked by a horde of xenos, you don’t want lag getting in the way.

If you have done any game development, what systems do you use for AI?

Advertisements