Developing an AI Strategy


Now that you understand the basic concepts behind AI in games, you can start thinking about an AI strategy for your own specific games . When deciding how to implement AI in a game, you need to do some preliminary work to assess exactly what type and level of AI you think is warranted. You need to determine what level of computer response suits your needs, abilities , resources, and project time frame.

If your main concern is developing a game that keeps human players entertained and challenged, go with the simplest AI possible. Actually, try to go with the simplest AI regardless of your goals because you can always enhance it in phases. If you think your game needs a type of AI that doesn't quite fit into any I've described, do some research and see whether something out there is closer to what you need. Most importantly, budget plenty of time for implementing AI because 90% of the time, it will take longer than you ever anticipated to get it all working at a level you are happy with.

What is the best way to get started? Start in small steps, of course. Many programmers like to write code as they design, and although that approach might work in some cases, I recommend at least some degree of preliminary design on paper. Furthermore, try to keep this design limited to a subset of the game's AI, such as a single computer opponent. Start with a small, simple map or grid and simple movement rules. Write the code to get a single opponent from point A to point B. Then add complications piece by piece, building onto a complete algorithm at each step. If you are careful to make each piece of the AI general and open enough to connect to other pieces, your final algorithms should be general enough to handle any conditions your game might encounter.

Getting back to more basic terms, a good way to build AI experience is to write a computer opponent for a simple board game, such as tic-tac-toe or checkers. Detailed AI solutions exist for many popular games, so you should be able to find them if you search around a little on the Web. Another good way to get some experience with AI is to modify an existing game in an attempt to make its computer-controlled characters a little smarter . For example, you could modify the Henway game so that the cars speed up and slow down deliberately to make it tougher on the chicken. You could also change the speed of the moving guys in the Battle Office game so that they speed up when you get close to shooting them.



Sams Teach Yourself Game Programming in 24 Hours
Sams Teach Yourself Game Programming in 24 Hours
ISBN: 067232461X
EAN: 2147483647
Year: 2002
Pages: 271

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net