Jump to content

About the Reborn AI


GreatNinja

Recommended Posts

(I didn't know where to start this topic, pardon me if this is the wrong place. I'm nowadays rarely here.)

Edit: Ugh, I wanted to post this in On The Hunt, this is definitely wrong. Sorry about that. Can't seem to delete this too. I hope someone can fix this.)

 

I finally decided to do another Nuzlocke run of Reborn. But as last time, I "cheated": I had too lenient rules (too much healing allowed, and every pokemon had 2 lives) because I thought a game as hard as reborn deserves lenient nuzlocke rules. But I think I improved and I can redeem myself with a real Reborn Nuzlocke. 

 

This is just to explain what exactly I need. To even having a chance of success, I need to know how exactly the AI behaves to find consistent strats in the boss fights. So, is there somewhere a documentation on AI-behaviour? Every detail matters, and the more, the better. Maybe the devs are even ok to share their code on the AI stuff (which most likely won't be understood without looking at the whole games code, but hey, maybe I can try?) And yes, I am sure that reborn AI is way different, by my experience. I have seen so many things I never saw in other games.

 

This is a really abtract question, which probably won't be answered, as I don't imagine there is a documentation about that. But maybe if I'm lucky, someone can give me a recap on the biggest changes. But if not, I at least want to know some information, so I will ask more specific questions from here on:

 

  • Are all the bosses equally intelligent? Are even random trainers as intelligent as bosses? What about later trainers? (For my later questions, just answer them for bosses if there is different AI levels)
  • If the opponent has one pokemon left, is he allowed to use Self Destruct/Explosion/Memento/Destiny Bond/Grudge/Perish Song? (Definitely important information to secure a win against Julia.)
  • Do Bosses only bring their Aces out when they have no other pokemon left, without being brutefully phazed in by Roar/Whirlwind and Red Card? Might be coincidence, but I don't think I have ever seen it. And I played through Reborn plenty times. Normally, the AI in main games just bring the best pokemon against yours, in order. But lets say this situation: I have an Umbreon left while my opponent just lost a Pokemon and has Alakazam and Machamp (Ace) left. Alakazam has only moves that can't hit Umbreon. Will the AI send out Alakazam or Machamp? 
  • Does the AI have something like a.. "pity system"? I have seen so many unreasonable decisions by the AI that seem only to be there to give me a chance. For example, using move X, which doesn't KO me, other than Move Y which secures the KO at all times. (Or maybe they only behave like that if they see a small chance that X CAN kill, but not for all damage rolls? That would be actually classic, but I think reborn might have like a 10% hard coded pity system (which actually would be bad for a nuzlocke attempts when switching around to PP-Stall, for example).
  • Can the AI remember information that it has seen through the battle? For example, if I reveal a Volt Absorb ability by letting it get hit by a thunderbolt from the opponent, and if I switch out after, does the AI remember that said pokemon has Volt Absorb? My guess is no, because in theory, you can have duplicate pokemon, but maybe yes?
  • How does the AI behave against Substitude? For example. Gen 4 AI (max intelligence) keeps spamming status moves against Subs sometimes... Also, does it still use the strongest move against the Sub'ed pokemon, or is it enough for the AI to use a move that breaks the sub? 
  • If you have any other interesting behaviours and interactions, just post it here. What more was hardcoded for Reborn AI? (Also does Rejuv have the exact same AI Code?)

I can probably test most of them out by myself, but it would be too tedious and most likely won't even guarantee that my guess was right, if I forgot THIS specific information. 

 

I really hope someone can help me with that. Have a great day. :)

Link to comment
Share on other sites

  • Global Mods

I'm sure one of the actual devs could give a much more accurate/comprehensive overview, but here's what I loosely know/remember at least. 

 

 - You should be able browse the whole AI code with either RMXP or something like Gemini to view the scripts file, but last I heard the E18 AI code was like, 50k lines long, so good luck. In general the AI uses a system where it will assign a score to the different current options it has (moves, item, switches) and then increase/decrease those scores based on tons of different factors (types, current hp, field, past turns etc), then picks the best scoring option.
 

 - I'm not sure if there's a generic AI 'level' that varies with trainers, but I know a lot of the unique trainer classes have extra AI stuff attached that's intended to make them use their designed strategies better. The Ace thing might also vary from trainer to trainer because of this? Or more generally, I would guess that the Ace probably has reduced AI scoring when considering switches, but a significant enough difference might be enough to overcome that bias.  

 

 - I don't think there's a flat hard-coded pity chance exactly, but it does sometimes change moves to try and save pp, catch switches etc, which can backfire on it reasonably often. I might be misremembering, but I also do think there was something about it giving extra score to moves that have a chance to KO over guaranteed KOs as a little bit of a pity / tense moment creator?   

 

- Yes the AI does have some memory of things it's seen in the past of the battle I believe, but I don't think it ever 'cheats' with knowledge that it shouldn't have access to or knowing the players action before deciding unlike some 'hard' romhacks/fangames... 

 

- Yes Rejuv (and Deso) should be using a lot of the same AI base, but they'll have their own unique trainer extras layered on top at least.

 

Also, the AI will have tons of improvements/changes for E19 once that releases, so........ 

Link to comment
Share on other sites

Hello, thank your for your really fast answer and your thoughts, it's really appreciated.

 

Didn't know the code was just available for us, lol. I guess that makes sense with all the random files there are in the games folder. I will take a look soon (but frankly, I doubt it will help, as I really suspect you have to understand the projects whole code to understand the AI-code, and then as you mentioned, 50k lines long is no joke, but I can try, I guess?)

 

7 hours ago, Dreamy said:

but I know a lot of the unique trainer classes have extra AI stuff attached that's intended to make them use their designed strategies better

Oh man this is useful information. I already know I'm gonna get destroyed at this rate xD

 

7 hours ago, Dreamy said:

- Yes the AI does have some memory of things it's seen in the past of the battle I believe, but I don't think it ever 'cheats' with knowledge that it shouldn't have access to or knowing the players action before deciding unlike some 'hard' romhacks/fangames... 

Blue Kaizo

Um this one is quite odd then. So the AI might, in this case, differ between my, lets say, Volt Absorb Lanturn and Water Absorb Lanturn? Because that would be cheating.

Also maybe you can say to me real quick, if the same applies to Sucker Punch and Pursuit? I vaguely remember a certain game cheating when it comes to these moves, but I can't remember which game exactly. Maybe even a main game. (For example, will the AI ever Sucker Punch when I use Substitude?)

 

Thank you again. Also if anyone else has other information, it's greatly appeciated. Maybe the devs will even say something. (But oh well I won't count on it, I'm sure they don't have time at all.)

 

I will probably reuse this topic whenever I have something new to ask about the AI.

Link to comment
Share on other sites

  • Veterans

oh my.

so my answers are going to be complicated by the fact that we're rewriting the entire AI for e19. some of the things here aren't quite set in stone because of that. it'll still be similar to how it runs now, but i don't know that for sure since it, *coughs, doesn't work yet

(moving this to the top) i'll say things like "generally" and "should" a lot because there's almost nothing that the AI is required to do, nor do we have 100% certainty of what it will do in a given situation. we feed it some information, it does some processing, it makes a decision. if it's a bad decision for the situation, we tweak the numbers a little.

20 hours ago, GreatNinja said:

Are all the bosses equally intelligent? Are even random trainers as intelligent as bosses? What about later trainers? (For my later questions, just answer them for bosses if there is different AI levels)

they are! each trainer class has a "skill" assigned to them. they generally break down into four categories: low, medium, high, and best. the way it's supposed to work:

low skill trainers know about moves and status effects. they don't remember any of your moves.

medium skill know about abilities and items. they remember the last move you used.

high skill.... uh, knows about some more niche battle things? i'm actually not sure, and i've gone through the ai several times. they remember all the moves used by your current mon.

best skill knows about field effects. they remember all the moves that all of your mons use.

we dunno how much of this system will be retained for e19. i'm frankly not sure it's the most consistent to begin with.

in general, trainer skill levels improve as you play the game. bosses are always at best skill.

20 hours ago, GreatNinja said:

If the opponent has one pokemon left, is he allowed to use Self Destruct/Explosion/Memento/Destiny Bond/Grudge/Perish Song? (Definitely important information to secure a win against Julia.)

it looks like they are. 

20 hours ago, GreatNinja said:

Do Bosses only bring their Aces out when they have no other pokemon left, without being brutefully phazed in by Roar/Whirlwind and Red Card? Might be coincidence, but I don't think I have ever seen it. And I played through Reborn plenty times. Normally, the AI in main games just bring the best pokemon against yours, in order. But lets say this situation: I have an Umbreon left while my opponent just lost a Pokemon and has Alakazam and Machamp (Ace) left. Alakazam has only moves that can't hit Umbreon. Will the AI send out Alakazam or Machamp? 

yeah, aces are generally held for last. there are some cases when this is effectively mandatory for story reasons (pulse-magnezone).

"generally" here means that the AI is situationally discouraged from sending out their ace unless it's essential to do so (which should happen in your example).

20 hours ago, GreatNinja said:

Does the AI have something like a.. "pity system"? I have seen so many unreasonable decisions by the AI that seem only to be there to give me a chance. For example, using move X, which doesn't KO me, other than Move Y which secures the KO at all times. (Or maybe they only behave like that if they see a small chance that X CAN kill, but not for all damage rolls? That would be actually classic, but I think reborn might have like a 10% hard coded pity system (which actually would be bad for a nuzlocke attempts when switching around to PP-Stall, for example).

dammit.

so, uh, it kinda does! on accident. i thought we had fixed the issue with damage rolls miscalculating, but perhaps we didn't fix it entirely?

higher skill levels should not have this issue. if they do in e19, it'll need to be fixed.

20 hours ago, GreatNinja said:

Can the AI remember information that it has seen through the battle? For example, if I reveal a Volt Absorb ability by letting it get hit by a thunderbolt from the opponent, and if I switch out after, does the AI remember that said pokemon has Volt Absorb? My guess is no, because in theory, you can have duplicate pokemon, but maybe yes?

so i alluded to this in the skill section, but yes- it remembers your moves based on skill level. it'll remember moves based on your mon's party index, so you can't fool it with duplicates.

as for abilities..... setting up a system to guess what ability your mon has would be a lot of work. so the AI gets to just... know what it is.

the justification for this is that you'll generally know what ability the mon has in a competitive setting and the skilled trainers will just know that. i'd say this is accurate in basically 95% of cases; some, like heliolisk, have multiple good abilities, so the AI technically shouldn't be sure.

20 hours ago, GreatNinja said:

How does the AI behave against Substitude? For example. Gen 4 AI (max intelligence) keeps spamming status moves against Subs sometimes... Also, does it still use the strongest move against the Sub'ed pokemon, or is it enough for the AI to use a move that breaks the sub? 

the AI should not be using moves that fail unless the information isn't accessible to them (for skill reasons, etc)

i don't think it has a preference beyond that.

20 hours ago, Dreamy said:

You should be able browse the whole AI code with either RMXP or something like Gemini to view the scripts file, but last I heard the E18 AI code was like, 50k lines long, so good luck.

technically it's only 42k!!!!

but, yeah, either RMXP or gemini would be useful for viewing it. the code file is scripts.rxdata in the data folder.

i do not recommend going through the AI code. on top of being stupid massive, it's not the most readable. we've cleaned it up a lot, and the e19 version looks like it'll stay under 10k lines.

dream mentioned a scoring system; basically what happens is we have a lot of "checks" that the AI looks for, and each of those checks has a multiplier attached to it that changes the score. if you're asleep, you want to use sleep talk, so we boost the score for that. if your opponent is burned, you don't want to use sparkling aria on them, so we drop the score. the multipliers are subjective based on how positive/negative the effects are. there's a huge boost in the sleep talk situation, but in the sparkling aria one it's much smaller.

20 hours ago, Dreamy said:

Yes Rejuv (and Deso) should be using a lot of the same AI base, but they'll have their own unique trainer extras layered on top at least.

deso uses our code. they'll also have the updated code when it's ready. i don't know what rejuv is doing these days.

12 hours ago, GreatNinja said:

So the AI might, in this case, differ between my, lets say, Volt Absorb Lanturn and Water Absorb Lanturn? Because that would be cheating.

i've basically already said this, but yeah, the AI will cheat on this. it's for technical reasons, and the in-game justification holds up reasonably well, so fixing this would fall well under most of the other priorities for the game.

13 hours ago, GreatNinja said:

For example, will the AI ever Sucker Punch when I use Substitude?

the AI doesn't cheat on this. sucker punch basically comes down to a guessing game. it's one of a few parts of the AI code that actually uses RNG in its scoring.

13 hours ago, GreatNinja said:

But oh well I won't count on it, I'm sure they don't have time at all.

i'm definitely putting off other work for this, but i like talking about my code.

someday there'll be a big devblog post about all the stupid shit we're putting in the e19 AI. until then, this'll have to do.

also, for the record, i appreciate just having questions about the AI. there are a lot of people who just complain about it acting odd and don't try to understand why or anything.

  • Like 1
Link to comment
Share on other sites

2 hours ago, andracass said:

it looks like they are. 

maybe this is the one thing you wanna fix?

I'm just gonna assume they are at least discouraged to do so, that's a logical conclusion I came into after understanding your scoring system (like the Sparkling Aria example), would explain why Julia doesn't explode as much as I expect.

 

2 hours ago, andracass said:

also, for the record, i appreciate just having questions about the AI. there are a lot of people who just complain about it acting odd and don't try to understand why or anything.

glad to read so, and I appreciate you going deep into it. it is kind of important for me, like I said. there are some bits of information I never noticed, even paying this game a ridiculous amount of times back then, like the Sparkling Aria one. (I can see why the code is 42k long.) Definitely worth asking here! But yeah, everything you told me makes sense (even the cheating bit) to me, keep up the good work.

 

2 hours ago, andracass said:

dammit.

so, uh, it kinda does! on accident. i thought we had fixed the issue with damage rolls miscalculating, but perhaps we didn't fix it entirely?

higher skill levels should not have this issue. if they do in e19, it'll need to be fixed.

uh maybe you fixed this because last time I remember this behaviour is on Victorias Incineroar, which might be a long time ago. (Which means it was post the version where Victoria used to have Emboar.) So I'm just gonna assume you fixed this "issue".

 

2 hours ago, andracass said:

someday there'll be a big devblog post about all the stupid shit we're putting in the e19 AI. until then, this'll have to do.

d-devblog? A complete one? This will be a dream. Especially after getting discouraged reading the code. I definitely encourage you doing so. I'm sure there are other crazy ones like me.

Which mean I will probably delay my plans for reborn though. But I planned the same for Rejuv so it's super duper fine.

 

2 hours ago, andracass said:

someday there'll be a big devblog post about all the stupid shit we're putting in the e19 AI. until then, this'll have to do.

Like I said earlier, I will probably reuse this topic if I have another series of questions (it will still be kind of rare), in this case, am I allowed to ping you? Just tell me real quick because I want to respect your work on this and not bother pings here and then. (Basically what I want to do is, whenever noticing something to write it down, and if I gathered enough questions, I will post it here.)

 

Thank you both so much again!

Link to comment
Share on other sites

  • Veterans
7 hours ago, GreatNinja said:

Which mean I will probably delay my plans for reborn though. But I planned the same for Rejuv so it's super duper fine.

the rejuv AI should still be fairly similar to reborn's- i just don't know if they're going to take the new one or not. there are some internal things that need to be sorted out for that, first.

  • Thanks 1
Link to comment
Share on other sites

  • Global Mods
17 hours ago, andracass said:

technically it's only 42k!!!!

oh, I thought the 42k was after a first trimming of 10k but then I checked and the message I was remembering was this:

Quote

 

“i made the ai 10,000 lines shorter by just deleting all the code that does stuff and replacing it with low quality jpegs of donkey kong

youre welcome”

 

 

 


 

 

14 hours ago, GreatNinja said:

maybe this is the one thing you wanna fix?

I'm just gonna assume they are at least discouraged to do so, that's a logical conclusion I came into after understanding your scoring system (like the Sparkling Aria example), would explain why Julia doesn't explode as much as I expect.

 

Since a draw technically ends in an AI victory, it makes sense for them to at least strongly consider it when it's down to a 1v1 (which I'm guessing is the case) 

 

Also, for a mostly unrelated but fun peek into the AI, here's one of my favourite old devblog posts: https://www.rebornevo.com/pr/development/records/jank-and-the-memestalk-r32/

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...