• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Decomp Hackers: how do you setup your AI?

853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
So I have some big ideas that hopefully I'll be able to see to fruition, but looking at CFRU and they setup their battle ai, got me thinking.

They used a rating based system, and then a bunch of conditional statements if I remember correclty.

For those that mess around with the system decision making, what kind of things do you do?

Do you prefer some type of rating system, do you prefer strict control of conditions?
Or something more loosely defined?
 
536
Posts
4
Years
  • Age 37
  • Seen today
I've done a rating system (more of a weighted point-based setup). I also give the AI some knowledge that a human opponent wouldn't have (like what move you chose), but then I give it a random chance on if it acts on that information or not. The intent is to simulate the AI making a good guess at what you will do since a human can do this around 2/3 of the time.

I do not prefer strict control. At best this can lead to the AI feeling samey and predictable. At worst it makes the game unfun as you throw yourself into a meat grinder of perfect-playing opponents.
 
1,403
Posts
9
Years
  • Seen yesterday
I also give the AI some knowledge that a human opponent wouldn't have (like what move you chose), but then I give it a random chance on if it acts on that information or not. The intent is to simulate the AI making a good guess at what you will do since a human can do this around 2/3 of the time.
That's very clever! I like it a lot.

Myself, I'm using a rating system too. I work out all the options that are available to the AI, score them, remove the ones that score significantly worse than the best option, and then pick from the remaining ones proportional to their scores (i.e. higher-scoring is picked more often). The difficulty with this approach is dealing with switches, or more specifically, being able to score states in a way that will only rate switches highly if the following turns are advantageous too; it's no good switching into a Pokémon that resists the predicted move only to get blown out by a coverage move on the next turn.

I strongly dislike conditional-based approaches because they're often either too simple and thus exploitable, or so complex that they're almost impossible to extend or maintain. My ratings are produced by a hand-written scoring function applied to simulated results of the AI's options. I like that approach because imo it strikes a nice balance between being able to make decisions dynamically, but still being bound by the sorts of things a human (specifically, me!) would consider. But if I'm not able to get that to perform acceptably I'm going to explore using machine learning to find a scoring function, at the cost of having something that's understandable, and potentially feels quite alien in its approach to playing.
 
853
Posts
3
Years
  • Age 33
  • Seen Nov 9, 2023
Both very interesting, I didn't even think about how switches would be handled.
it seems like the consesus is to use ratings systems, but like the idea of guessing (with conditional statements/functions) in the same way that a normal player would, based on knowledge of the type weaknesses of their team, and the possible moves of the opponent pokemon.

I haven't gotten deep into this side of things yet, so I don't know if that's best or not, but I like the idea of keeping a natural feel.
 
17
Posts
5
Years
  • Age 35
  • Seen Apr 12, 2024
There's a few things that come to mind when dealing with AI for me:
-A scoring system, first of all. Start at 127 and work your way up or down (0-255). Talking about the switching scoring system:
--Raise if enemy's mon checks/counters your mon
--Lower if your mon checks/counters enemy's mon
--*Lower if your mon usually has a super effective move (usually is dependent on what setting; in-game playthroughs typically don't have "usually"s)
--Lower if your mon does have a super effective move
--Raise if your mon is starting to trend toward having not very effective moves
--Last, semi-randomly pick from the top 3 highest scores, weighted to ensure the highest pick is weighed more
-*Common teams and sets for expecting Pokemon, moves, and stats (and scoring appropriately) [this is also a case of "usuals", it depends on the setting]
--*If they are usually passive or deal little damage to your Pokemon, try to set up (this depends on very specific cases and thus would be something to be done after the core AI)
-Having the AI be able to calculate the damage based on revealed information and the aforementioned "expecting" cases
-*Expecting a good same type move from a Pokemon (in a competitive setting; not so much typical in-game playthroughs, but maybe for the Battle Frontier)
-*Last, the ability to go through with long-term game plans (wholly determined by specific cases, much better saved until end of AI tweaking)
Personally, I'd like to see a game mode where it's like the Battle Tower, but with 6v6 "[Gen 3] OU" battles from Smogon sample teams. That's why I've been working on my own AI with Smogon info. I haven't gotten far with the AI, but I hope to implement all of the things I just mentioned.
 
Last edited:
110
Posts
1
Years
  • Age 47
  • Seen today
I just wonder if anyone can play perfectly really because of the ability to switch and whether you are responding or just initiating.
 
Back
Top