Skip to content
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

AI will score against predicted switchin if predicting switch #6037

Open
wants to merge 7 commits into
base: upcoming
Choose a base branch
from

Conversation

Pawkkie
Copy link
Collaborator

@Pawkkie Pawkkie commented Jan 16, 2025

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.

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

I think there's also merit to tracking both potential battlers in parallel, specifically for Pursuit; as in, "score Pursuit damage against the mon that's switching out, score literally everything else against the mon that's switching in", but I think that case may require significant additional handling so I'm not sure it's in scope for this PR. I don't think this will be too bad either way though!

Issue(s) that this PR fixes

Closes #5227

Discord contact info

@Pawkkie

@Pawkkie Pawkkie added new-feature Adds a feature category: battle-ai Pertains to Battle Engine Upgrade's AI labels Jan 16, 2025
@Pawkkie Pawkkie marked this pull request as draft January 16, 2025 21:07
@Pawkkie Pawkkie marked this pull request as ready for review January 18, 2025 00:57
@Pawkkie
Copy link
Collaborator Author

Pawkkie commented Jan 18, 2025

Miraculously got this actually working, and it's ready for review :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-ai Pertains to Battle Engine Upgrade's AI new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant