Welcome Guest [Log In] [Register]
Multiplayer battle; how the game selects them
Topic Started: Nov 12 2011, 02:03 PM (599 Views)
Prof. 9
Member Avatar
Moderaptor

MRE asked me to look into this, it didn't seem like it would take long.

Both GBAs randomly select a battle stage value and a background value. Right before the white fadeout to the battle, one GBA's values are used and the other GBA's values are discarded.

The routine to generate a battle stage and background is located at 0x081209DC. The pointer to the start of the battle settings for multiplayer battle stages is at 0x0800A944.

This is how it selects a battle stage:
Code:
 
- load stage amount from 0x08120A14 + mode * 0x04
- get random value with min = 0x00 and max = stage amount - 0x01
- for RandomBattle, add 0x60 to the value

These are the possible battle values:
SingleBattle: 0x00-0x43
TripleBattle: 0x00-0x5F
RandomBattle: 0x60-0xA3

Resulting value is the battle value. (Are there unused battles?)

0x0812B62C: absolute max battle value (if the battle value is higher than this, it crashes/desyncs/bad things happen)
0x081209F2: base battle stage value for RandomBattle


This is how it selects a background:
Code:
 
get random value with min=0x00 and max=0x14
load 8-bit value from 0x08120A20+result

Resulting value is the background value. Apparently backgrounds 0x02, 0x12, 0x14 and 0x15 are avoided.

0x0812B630: absolute max background value (if the background value is higher than this, it crashes/desyncs/bad things happen)


If you want to always force 1 specific battle, you can simply set the 3 stage amounts (0x44, 0x60 and 0x44) to 0x01. The three stage amounts are located at 0x08120A14. For Single and Triple, you will always get battle 0x00; for RandomBattle, you will always get battle 0x60 (unless you change the base battle stage value for RandomBattle to 0x00).
:ninja: Follow me on Twitter! :trap: Fork me on GitHub!
Posted Image
Profile
Quote
 
MegaRockEXE
Member Avatar
BN Guides Author

Proof of concept
Posted Image
Getting both games to fight one battle and using a cheat, it's possible to have 2 players fight on one side.
Use this code on both games.
3203AD26 0001

Obvious bugs with the cheat is that when the other player is forced to fight on player 1's side, chips/crosses are shared. The converted player can also be hit by player 1 and not the enemy, so technically they're not really on player 1's side. Defeating the enemy on player 2's side also won't end the battle.

Ideally the second player should be a copy of player 1's data [00 23 00 00] [00 23 00 00] but this causes player 2 to be unplayable. This would eliminate any of the problems described above. It may require some ASM for that to work.
Edited by MegaRockEXE, Nov 12 2011, 07:28 PM.
The Rockman EXE Zone | YouTube
Profile
Quote
 
Zanerus
Member Avatar
Dedicated Member
Wait how did you get a navi as the enemy? It's worth knowing more about so I'm interested how you did that.
Zane's poetry Hour here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8752185/1/

AEZ Patch version 4 finally out: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8667690/1/

Chip hacker starters can find my notes here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8685052/1/ PM me for any questions.

modding Guide Index can be found here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8750547/1/

Insanity is simply silliness misunderstood.
Profile
Quote
 
MegaRockEXE
Member Avatar
BN Guides Author

Once you follow the instructions Prof.9 posted, you should be able to get one battle to load all the time (background can also be fixed to 1). Using this, you can write a new battle either over the old ones or point to a new one which would add more enemies.
The Rockman EXE Zone | YouTube
Profile
Quote
 
Zanerus
Member Avatar
Dedicated Member
At that point it's just like editing a normal fight? Fair enough. No other questions of note I can think of.
Zane's poetry Hour here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8752185/1/

AEZ Patch version 4 finally out: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8667690/1/

Chip hacker starters can find my notes here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8685052/1/ PM me for any questions.

modding Guide Index can be found here: http://s6.zetaboards.com/The_Rockman_EXE_Zone/topic/8750547/1/

Insanity is simply silliness misunderstood.
Profile
Quote
 
MegaRockEXE
Member Avatar
BN Guides Author

The cheat I posted was not working anymore for some reason.
I was trying this and it worked, but it's still a sloppy solution.
Code:
 
3203aA9E 0000
The Rockman EXE Zone | YouTube
Profile
Quote
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Guides & Research · Next Topic »