Beginning Game AI
Hey. I am designing a game lately and as I was thinking about how to set up the enemy AI I was struck with an idea by looking at some writing on a whiteboard in English class.
I was thinking about making the enemeies "learn" from each other. This would be possible through the possibility that an enemy escapes from you in battle. Lets say that the enemy is keeping track of your specific moves and strategy and keeps an eye on the moves you use the most. If said enemey happens to escape, he goes and tells his buddies so the next random encounter will have enemies geared up to meet your last strategy(s).
I was thinking a simple method of getting this to work would to make an general array for each enemey type's "brain" LEts call this their memory array or just plain memory.
Ok now say we have a tough guy beating the crap out of an enemies buddies and he happens to notice a mage charring his gang to a crisp. He takes note of this in his memory. To have this done I am thinking about something like this:
We start with an empty array:
(Im not going to be correct with syntax... just to give you all a general idea)
{ [ Empty Array Slot 1 ]
[ Empty Array Slot 2 ]
[ Empty Array Slot 3 ]
[ Empty Array Slot 4 ]
[ Empty Array Slot 5 ]
}
There's our clean array. A fresh and stupid enemy.
Now that this enemy is in battle and notices our heroes beating up his friends and charring them to a crisp he will have something that looks like this stored into his memory:
{ [ Player ID 1, Fist Attack, moderate damage ]
[ Player ID 2, Fireball Attack, High Damage ]
[ Empty Array Slot 3 ]
[ Empty Array Slot 4 ]
[ Empty Array Slot 5 ]
}
Player ID is to keep track of which character the attack is coming from. It now knows to watch out for the Fist Attack which will be coming from Main Character. Our enemy also knows that this character is dealing a fair amount of damage.
In his next memory slot he notices the mage is standing in the background shooting Fireballs and dealing very high damage.
Our enemy escapes the battle.
He tells his troops and now the next random battles will appear with resistance to these attacks - Heavily armored guys that can resist physical damage and/or heavy magic resistant characters to resist the fireballs.
These enemies will store this information in a separate array which I will call the Long Term Memory. This will store your strategy information for use against you while the previous array (Short Term Memory) will be erased every battle as it will always be different enemies.
Now, because of these arrays, we will be able to have some moderately smart enemies that will anticipate your strategy in defeating them and will adjust their gear accordingly.
Sorry for the long post and I hope it all makes sense. Give me some feedback and let me know what you guys think. I'm currently working on implementing a system like this in the game Im designing (No its not a MMORPG *shudders at the thought of something like that*)
Thanks everyone!
Brandon Haston
Well, the simplest way is to record the number of times a certain move is performed then assign it a probability. The probablity is constantly updated as new encounters collect more data. So, you can simply build up a list of most likely moves based on frequency of use.
Of course, if you have a lot more detailed information, it gets harder.
The other way to do it, which is not as fast is to implement something similar to evolutionary programming and evolve finite state machines that can be used to predict behavior. That becomes alot harder and slower, but may yeild better results in the long run.
Of course, if you have a lot more detailed information, it gets harder.
The other way to do it, which is not as fast is to implement something similar to evolutionary programming and evolve finite state machines that can be used to predict behavior. That becomes alot harder and slower, but may yeild better results in the long run.
Quote: Original post by WeirdoFu
Well, the simplest way is to record the number of times a certain move is performed then assign it a probability. The probablity is constantly updated as new encounters collect more data. So, you can simply build up a list of most likely moves based on frequency of use.
Of course, if you have a lot more detailed information, it gets harder.
The other way to do it, which is not as fast is to implement something similar to evolutionary programming and evolve finite state machines that can be used to predict behavior. That becomes alot harder and slower, but may yeild better results in the long run.
I agree on that. Actually this is called: Location-Based Information System (LBS). So I just want to add respectively spam you with some other thoughs that
might be helpful for you to either combine or to concretly implement...
So LBS covers sections such as:
-Influence Maps(IMs)
-Smart Terrain
-Terrain Anaylsis (TA)
-Occupance Data
-Ground Control
-And of course Pathfinding helper Data
Example 1:
How do I figure out if enemies have taken over the control of a certain area in the map?
Solution: divide your map into smaller pieces and then for each tile
-add 1 for (Player A)
-add -1 for (Player B i.e: AI)
Player A controls the sqares that have positive values, and player B controls negatively valued squares... This provide you a way of measuring global and local control of your map.
Example 2:
You can add the principles from above add a a danger signification system which keeps track of areas where bad things have happend over a period of time.
In a RTS game you could do this by incrementing the cost in that area. So the ai units eventually won't walk though this region and will get killed all the time.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement