AI for a Pokemon-Like Game

So me and a few friends have been working on a spoof of the old Pokemon games, and I'm getting to the point where I have to program the AI for the battles. For those of you who don't know, Pokemon uses a turn based battle system, and the stats of the battling pokemon and the moves being used determines the outcome of the battle. The player can switch out their current pokemon for a better one, and can use different moves at will. They can also use items for healing and stat modification.

I don't really want to go over the top with this, but at the same time I want the AI to provide some sort of challenge. I created a scoring system that can, at any point during the battle, assess the unique "state" and generate a set of scores (as well as a weighted total score). Each score is calculated based on whatever stat or principle it corresponds to, and they are all normalized. From there, I have a set of "flags" that are derived from the scores (such as offensive advantage, defensive advantage, etc). To generically describe all of the options the AI has available I've defined "Reactions" (such as direct attack, passive attack, use item, etc). Based on the scores and flags, the AI would prioritize or order the reactions, starting with the most desired and ending with the least desired. The game will then select the appropriate move or pokemon based on the AI's preferences and what is actually available. To keep things interesting, I'm going to implement different "personalities" (aggressive, defensive, etc), and will do so by changing the weights used to calculate the total score and changing how each AI prioritizes response types.

If anyone has any feedback or creative ideas that would be wonderful!
I would love to help with this.

I need a little clarification first if you don't mind?

1.) What exactly are you looking for?

You said you don't want to go over the top, though to me your idea is already a little too weighty. I would of thought something like this would have been a little more inline and procedural? Or are you trying something totally new?


2.) Could you better explain the "state" and "flags"?

I'm not fully understanding this scoring thing, I don't remember that on the original pokemon? Also you say "flags" are derived from score so I assume this is OOP? Not my strong point but I'm still willing to give input.


3.) I think you might be defining "Reactions" wrong?

In this line -
I've defined "Reactions" (such as direct attack, passive attack, use item, etc).


Are "Reactions" going to be objects? Have you gave any thought to "React" being a method of "Player"?

1
2
3
4
5
6
7
8
9
10
{
    // Start of battle, your function has already determined who strikes first, in this instance the player

    // Player chooses a move
    Player.React(&Player2);
    // AI does it's move based off it's own state and players state
    // An "Aggressive" AI may choose to attack the player if it's health is low and opponent health is low
    // A "Defensive" AI will heal itself despite of opponent health
    Player2.React(&Player1);
}



These are just thoughts.
Those are just conceptual things to describe possible behaviors of the AI players. Think of each reaction being one of several options that the AI can choose from, with the "score" and "flags" determine which option the AI chooses. The score and flags can be thought of as the thought process of the AI, they're not visible to the player. They just describe the state of the battle, such as who has more health and better stats. They simply quantize all the different things that human players take into consideration so that the AI players can do the same.

As for how I'll be implementing this in code, is irrelevant. I already have most of the described system in place, and making changes won't be difficult. I'm not concerned with how to program it, I'm more concerned with the underlying methodologies behind the AI.
Back in the dizzy when I worked on my pokeclone the AI I used was unreasonably unintelligent.

And I loved it.

The best thing I can recommend is add as much entropy as you can- to make it unpredictable. I recommend against giving it specific knowledge, but recommend you give it the ability to learn along with your player, but not to use that ability to remove the chaotic qualities that make games like this an array of laughs.

Unless you're going for a serious battle game, in which case you've already got that on lock.
If this is really a spoof and not a clone then the AI pretty much has to be stupid. You should look for the criticisms of the current state of AI in that franchise and embellish on them. If you want to maintain some semblance of a challenge then that might be tough. Maybe the evenly matched opponents should be completely retarded while the underdogs get some ridiculous 'luck' bonus?

I've always wondered what a Pokemon with ADD would be like, or one that talked back to it's handler. Can you imagine what it would be like if one just wandered off in the middle of a fight? Or instead of using some fancy firebreathing attack, it just picked up a big stick and started beating its opponent with it. What if the fight was more like a melee where the trainers barely got a word in edgewise? If a monster spends 30 seconds charging an attack, is it really necessary for me to tell my fighter to doge? Wouldn't that be obvious or does evolution not exist in this world? This has a lot of potential for humor.

EDIT: You should address the fact that Pokemon do in fact eat each other and that they don't subsist on amorphous and indescript balls of food stuff. This is a great avenue to inject some dark humor into the story.
Last edited on
I suggest books "Programming game AI by example" by Mat Buckland and "AI Game Engine Programming" by Brian Schwab. Second one is not only going over technical stuff, but also about desing choices when making an AI.

First of all, AI should not be ideal. Or player will either never win, or it would completely change bablance of the game. Consider what happens if that would be a feature in default AI: http://www.youtube.com/watch?v=IKVFZ28ybQs

AI should provide challenge and guide player to intended gameplay. For example 100% accuracy AI with progamer reaction time so 2 mooks will never let you came out of cover and stay alive for more than 2 seconds is bad for common FPS, but in the game promoting stealth or tactical approach it might be acceptable.

Well as for the AI being stupid, that is easily doable using the current system. Presently I have the framework for assessing the state of battle, the different AI personalities can react however they want. I actually have a couple of different personalities made to be stupid.

@ultifinitus: As far as entropy is concerned, I have some elements of randomness incorporated in the process of choosing the actual move to use. For example, the AI chooses a reaction of type X, and has 2 moves that are classified as type X. The underlying framework would select one of the two moves randomly with more weight assigned to the better move.

@Computergeek01: Pokemon is a turn based strategy game, so I'm not sure how to smoothly implement much of those ideas in battle, but I certainly can see their application in the overarching store/gameplay. Especially the cannibalism XD

@MiiNiPaa: I'll have to check those books out! I really love AI, I find it fascinating. I'm not too concerned about the AI being too good though, because even a perfect AI can be beaten. It's just a matter of training your pokemon and playing somewhat competently. It would be really cool if I could make it perfect though!
Topic archived. No new replies allowed.