behavioral aggressive alien would look like this: int
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. Building the Roids 2 Program Example Rather than modify an existing game to demonstrate AI programming, I decided that it would be better to demonstrate AI within the context of a program example that doesn’t involve an objective. In other words, I wanted to create a program that you could tinker with without worrying about messing up the outcome of a game. The program I’m talking about is called Roids 2, and it’s a revamped version of the Roids program from Hour 18. If you recall, the original Roids program displayed an animated asteroid field. You’re now going to add a flying saucer to the program that is intelligent enough to dodge the asteroids, or at least do its best to dodge the asteroids. The Roids 2 program example is very similar to the original Roids program, except for the addition of the flying saucer sprite. The remainder of the hour focuses on the development of this program, and how AI influences the flying saucer sprite. Writing the Program Code The Roids 2 program begins with the Roids.h header file, which declares global variables that are important to the program. More specifically, a flying saucer bitmap has been declared, along with sprites for the asteroids and the flying saucer: Bitmap* _pSaucerBitmap; Sprite* _pAsteroids[3]; Sprite* _pSaucer;
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services