• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Consistent non-random AI - Revised!

v20.1 Consistent non-random AI - Revised! 2.0.4

This resource pertains to version 20.1 of Pokémon Essentials.
v2.0.4
  • Fixes AI using Fake Out after the first turn.
  • Fixes AI not having a low enough score to not use some status moves on pokemon with Guts or other abilities that would benefit from it.
I realized I was using certain methods in the AI that were only defined in the Generation 9 Pack, so those without the gen 9 pack would have crashes.
Therefore I defined these methods in my AI too.
v2.0.2
  • Cleaned up remnant code from Ashen Frost that I had missed that was causing AI crashes.
  • Made my plugin to load after Essentials Deluxe to avoid its methods overriding mine and causing crashes. (I have added support for Essentials Deluxe in my AI anyway)
Fixed AI getting insane scores on speed reducing moves like icy wind against slower pokemon when it could just OHKO them with another move instead.
It's been a while, and after running this AI on multiple projects and adding more and more elements to it, I'm confident to finally publish a massively improved iteration of the original plugin, which now feels very barebones in comparison.

In addition to what it was already doing, now this AI comes with these improvements:
  • Added a lot more move function specific code in AI Move EffectScores. AI should now have massively improved and consistent decision making for most moves.
  • Improved priority move related AI using Reborn's priority moves AI as a base
  • Reworked the process of selecting the proper damaging move. Most damaging moves whose power depends on other factors are now handled in pbGetMoveScoreDamage instead of pbGetMoveScoreFunctionCode and will be chosen based on their calcualted resulting damage rather than arbitary scoring.
  • A completely made from scratch AI on selecting the next pokemon to bring into battle that decides based on approximate incoming and outcoming damage calculation, speed comparison, and a lot of other factors. To achieve that a fake battler is created for every party member not yet into battle, and the one that gets the best outcome in a clash with the current opposing pokemon is chosen.
  • Reworked AI for usage of healing items in battle. Instead of arbitary scoring based on isolated factors and rng, it now basically uses logic similar to recovery moves for healing items, and similar to set-up moves for X items, with the proper damage and other calculations to assist in decision making.
  • New code for the purpose of calculating if a pokemon will survive another pokemon's moves after taking into account damage calculation, abilities, items, priority moves on the following turn, and other factors.
  • Code that helps AI access the biggest threat in doubles+, and prioritise targeting it.
  • Integration of the new elements from the Generation 9 Pack v2.0 for compatibility.
  • Emulation of "mind games" for sucker punch and wide guard.

More techical info:
Obviously when you make the AI calculate more and more factors for its decisions, eventually the processing time for the decision making grows long enough that it is felt by the player during battle, especially in doubles, where slower PCs had to wait quite some seconds every turn for the AI to finish deciding.
The main culprit of this was just how many times the AI had to go through the entirety of pbRoughDamage (a pretty lengthy method) for every single little thing. We are talking about countless iterations.
To solve this, the AI now calculates all possible damages between every pokemon in the battle once at the start of the turn, and saves them in a hash through the registerDamagesAI method. And so instead of recalculating it every time, it just grabs the appropriate calculation of x move vs y opponent from the hash.

Things that I hope to tackle in an unknown future:
-Improving decision making in doubles. Naturally the more factors are in the battle at the same time, the more complex the AI processing becomes. I am very satisfied with singles right now, but doubles definitely has space for improvement.
-Mega Evolution related AI, especially calculation of damages after mega evolution for a pokemon that isn't mega evolved yet. More ambitious goal: choose to not mega evolve if it's more beneficial to stay in current form, or to hold the mega evolution for later.
v1.0.1
-Fixed an error when the AI tried to switch while having only 1 pokemon alive.
Back
Top