Jump to content

D/P/Pt Battle RNG research


Recommended Posts

I am a TAS speedrunner looking to try and complete D/P/Pt games as fast as possible, but would like some info on what RAM addresses to look at regarding the battle RNGs of the games - stuff related to critical hits, accuracy of attacks, Quick Claw activation, and so on. The notable breakpoints page mentions a lot of invaluable addresses to look at, but almost nothing on the battle system at all. Any help would be appreciated in this area.

Thanks in advance

Link to comment
Share on other sites

  • 9 months later...

I remember a long time ago when I was poking around in RAM I found a value that effected "hax" in battles. Freezing it at 0 caused everything to always fail baring moves with 100% accuracy from landing, and setting it to 0xFFFFFFFF caused everything that could happen to happen.

I didn't save the offset, but I can try to look for it again.

Link to comment
Share on other sites

Super old bump there Kazo ;)

The Battle RNG calculations probably carried over from gen 3, which you can see at TASVideos by FractalFusion.

In battle: Accuracy

The game determines attack accuracy right before it says "X used attack", if the attack does damage. If the attack does not do damage, the game determines it after it says "X used attack".

When the game rolls for attack accuracy, the game will cycle the RNG 3 times on that frame.

  xxxxxxxx
 xxxxxxxx
 aaaaxxxx   Attack hit: aaaa mod 100 < acc%     otherwise miss

In battle: Critical hits

The game determines critical hits a few frames after the message "X used attack", provided that the attack does damage, and the attack did not miss, and it is not a tutorial battle where the game forbids critical hits.

When the game rolls for critical hits, the game will cycle the RNG 3 times on that frame.

  xxxxxxxx
 xxxxxxxx
 xxxaxxxx   Critical hit: a==0

This assumes a 1/16 chance of a critical hit. It does not describe situations where the critical hit ratio is raised to be greater than 1/16, or the target has the ability Battle Armor (no critical hits).

In battle: Damage variation

For almost all attacks, the amount of damage that an attack does varies between about 85% and 100%. The game determines damage variation three frames after it checks for critical hit.

When the game rolls for damage variation, the game will cycle the RNG 3 times on that frame.

  xxxxxxxx
 xxxxxxxx
 xxxaxxxx    Damage variation, max: a==0   min: a==15

The lower the number, the more damage the attack does.

It is not known for certain if 0000 is the only value that does max damage (a property in the first two generations where only the "best" value yields max damage).

Gen 3 used the main LCRNG for the battle determinations, and iirc so did gen 4.

Gen 5 uses a new seed generated when the battle scene is loaded (after the flash), so it'd be much harder to cheat with.

%100 and *100 respectively for accuracy, %16 and *16 for everything not a multiple of 5%.

Edited by Kaphotics
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...