|
|
| Game Artificial Intelligence |
|
BitCruncher
Member #11,279
August 2009
|
What's up Allegro Devers, I have a basic framework for playable objects. Now, it is time to implement some form of AI. I have thought about the different ways to approach this. I can create separate types of entities all falling under a large 'enemy' class, or the enemies could be clones of the playable types separated in a different vector container from the playable objects. I have also read on some other techniques on other sites. What are some of the ways that you guys handle artificial intelligence?
|
|
Jesse Lenney
Member #8,356
February 2007
|
It really depends on the task at hand. You cant really write a universal AI algorithm I just think about what I want the AI to do...and make them do it. --- |
|
OnlineCop
Member #7,919
October 2006
|
Bop-the-mole: they pop up randomly, you hit them. The higher the level, the shorter time they'd stay up. The ghosts of Pac-Man had a simple AI: Locate the player's current tile. See what direction the player was facing. Attempt to move to a location based on different algorithms for each (one chases the player, one avoids the player, one goes "3 ahead, 1 to the side" (kind of like a rook in chess), one wanders randomly. Super Mario: enemies hit an obstacle then change direction. Some drop of ledges; others detect ledges and turn around. Homing missiles: Some go for the player, even if it means trying to go through a wall (and essentially blowing up on the wall instead of getting the player). Some go around obstacles like "smart targeting" and try to find you and kill you dead. Mario Kart: Try to stay on the track. If there are obstacles, try to go around without hitting the brakes. If you get bumped off the track, find the closest path to get back on it. If you get a power-up, use it according to the power-up type (aim at another racer if it's a turtle shell, use a speed boost when you're NOT going around a tight corner)... These are all "playable objects". But what kind of game is it? What do the AI need to do? -- |
|
Jeff Bernard
Member #6,698
December 2005
|
What do you want your AI to do? There are so many ways one could implement AI. Here's some stuff just from the table of contents of a game AI book I've got (each is not necessarily an algorithm, but maybe a concept, hey it's prolly still important, I haven't read the whole book and haven't actually coded a lot of these): Kinematics I wrote a Pacman agent (not the ghosts) for one of my classes. The behavior was simply do a specialized search to find the closest pill and mark that as the target. Next calculate all of the spaces that the ghosts could be in the next 3 cycles. Move to the space that is closest to the target while staying away from the ghosts. It was better at the game than I was. -- |
|
Tomoso
Member #3,128
January 2003
|
|
Jonatan Hedborg
Member #4,886
July 2004
|
BitCruncher said: What are some of the ways that you guys handle artificial intelligence? I would probably add a property to my "unit" class called "brain". Then use different brains for different AI's or controll schemees. Ie, one for the player and several for the different types of AIs. The Brain has an update function which is called each frame, and returns what action the unit should take that tick. Depending on the game, I would use a combination of Finitive state machines and A* path-finding. ------- |
|
|