-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AI_FLAG_PREDICT_INCOMING_MON: AI will score against predicted switchin if predicting switch #6037
Conversation
Miraculously got this actually working, and it's ready for review :D |
I extended this to include handling to identify if the AI has a chase-effect move (ie. Pursuit) and pass the predicted switchout mon for scoring for that move specifically rather than the switchin mon that it uses for everything else. It's a bit gross by necessity, and I'm open to ideas for cleaning it up lol |
} | ||
} | ||
|
||
AI_SINGLE_BATTLE_TEST("AI_FLAG_PREDICT_SWITCH: AI would normally choose prediction-informed move against mon in predicted-incoming-mon scenario") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kinda lost at what exactly is being checked here, since the player and opponent only have one mon each?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's basically a sanity check for the predict-incoming scenario.
In that scenario, the test passes if it uses the move that I know scores the highest against the incoming mon.
In this test, I confirm that the move I'm checking against in the other test is in fact the highest scoring against the incoming mon in a vaccuum.
It's a sort of safety valve / sanity check, so if the other test ever fails AND this test fails, we know the prediction isn't broken, just that the score of the AI's moves has changed in a vaccuum which will also affect the switching test.
Hopefully that makes sense :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I (think) I get it. Could you summarize it in a nice comment and give the other test's name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed comment, let me know if that clarifies :)
All good to me, unless @AlexOn1ine has any objections, I'll hit the merge button |
Description
If the AI is predicting the player will switch using AI_FLAG_PREDICT_SWITCH introduced in #6028, this PR allows the AI to run its scoring functions against the predicted incoming mon rather than against the target that the AI thinks is about to switch out. This lets us take advantage of the prediction code to have much more sophisticated emergent behaviour, like using a Fighting-type move on a predicted switch to a Steel-type while the player's currently active mon is a Gengar.
Also includes handling to identify if the AI has a chase-effect move (ie. Pursuit), and if so, passes the predicted switchout mon for scoring for that move specifically rather than the switchin mon that it uses for everything else.
The last missing piece of this puzzle is to track the player's knowledge of the AI, through a sort of reverse AI_FLAG_OMNISCIENT. As is, things like crazy "use Focus Punch against a Gengar with a predicted TTar switchin" won't happen because the AI knows its own mon has Focus Punch, and thus won't see the player's TTar as a good switchin candidate. It'd be ideal for the AI to just use the player's knowledge in its predictions. That's future work though lol
Issue(s) that this PR fixes
Closes #5227
Discord contact info
@Pawkkie