ROM Hack Transplanting an EXP System in Pokémon

Drayano

.
OP
Member
Joined
Oct 26, 2008
Messages
793
Trophies
0
Age
31
Location
United Kingdom
XP
395
Country
Anyone who's played most of the Pokémon games probably knows already that Black/White have a different EXP system that scales the EXP according to the level difference between the opponents, whereas every other Pokémon game simply has a static amount dependent on the species and level. I was wondering if it's possible to take that Black/White experience system and somehow put it in a different DS Pokémon game - namely, Heart Gold/Soul Silver.

The problem is I literally have no idea where to begin on something like this. I have no idea where in the data the exp formula is contained, not sure how I'd change it, etcetera. If anyone could give me some pointers on how to go about doing it (assuming it's not too much hassle, if it is I'll probably drop it anyway since I don't know if it'll be particularly effective due to other problems) I'd appreciate it.

If it's any help, the experience formula in B/W takes this format:
Delta_exp_gen5.png


Whereas the one in every other Pokémon game including HGSS has this format:
ExpGainFormula.png


If it's important...
  • a is either 1 or 1.5, dependent on if the opponent is owned by a trainer or not.
  • t is 1, 1.5 or 1.7 dependent on whether the used Pokémon originally belonged to the trainer using it.
  • b is the base experience of a Pokémon species, a value which depends entirely on the Pokémon being fought (i.e. Blissey has a value of 255 in any non BW game)
  • e is 1.5 if the Pokémon holds a Lucky Egg.
  • L is the level of the Pokémon who was defeated and thus giving exp.
  • s is the number of Pokémon who participated in a fight against the defeated opponent. It's also affected in some ways by the EXP. Share item.
  • p refers to an upgrade which can be obtained in BW only for temporary times and can take several discrete values such as 0.5, 0.66, 0.8, 1.2, 1.5 and 2. For Gen IV purposes it's not important.
Feel free to shoot me down since I can't see something like this being simple at all, though, just thought it'd be worth asking regardless.
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
you know that action replay code that doubles triples or otherwise increases the exp... that area is where the programming is for handling that (or near abouts). EIther it points to a specific pokemons exp (the static point in memory which can be different for every pokemon) or it points to that formula. Either way put a breakpoint and work backwords or forwards until you find the asm that looks like that formula.

I would first try to figure how to make that formula in asm then search for it. After that its a simple redirect to the bigger and or rewrite of the smaller code.
 

Drayano

.
OP
Member
Joined
Oct 26, 2008
Messages
793
Trophies
0
Age
31
Location
United Kingdom
XP
395
Country
Okay, so for HG/SS that'd be (2* EXP):
9223E7EA 0000319C
0223E7EC 60080040
0223E7F0 309C1C28
D0000000 00000000

And Black is (2* EXP):
521CB52C 59A8437E
023AE840 59A8437E
023AE844 51A80040
123AE848 00004770
021CB52C F988F1E3
D2000000 00000000

White is (2* EXP):
521CB54C 59A8437E
023AE840 59A8437E
023AE844 51A80040
123AE848 00004770
021CB54C F978F1E3
D2000000 00000000

...Regrettably I know basically no ASM and I'm clueless on how to insert a breakpoint ;; I do apologise as I'm pretty sure you've given me some very helpful advice there, I'm just a little too clueless >.>;

edit: After some thought I probably won't implement this anyway, but thank you for the help you gave.
 

andibad

Soon™
Member
Joined
Sep 14, 2009
Messages
701
Trophies
0
Location
hospital
XP
247
Country
Indonesia
Okay, so for HG/SS that'd be (2* EXP):
9223E7EA 0000319C
0223E7EC 60080040
0223E7F0 309C1C28
D0000000 00000000

And Black is (2* EXP):
521CB52C 59A8437E
023AE840 59A8437E
023AE844 51A80040
123AE848 00004770
021CB52C F988F1E3
D2000000 00000000

White is (2* EXP):
521CB54C 59A8437E
023AE840 59A8437E
023AE844 51A80040
123AE848 00004770
021CB54C F978F1E3
D2000000 00000000

is seem +4 .... if i not wrong is offset right (on left side)? is seem on that offset is same manipulation BW and HGSS...

sorry if my comment is useless XD

but is possible to change exp formula's.
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
hopefully there won't be a size constraint and he won't have to add any code. You are going to need to dissect those codes and see what information is being held at those points in memory. If it points directly to where the arm9/overlay resides in memory then this shouldn't be a big deal but if it points to another file.... still not a big deal. take a look at the code after attaching crystaltile2 to an emulator... (sounds confusing but relative search anything - that can be found - in game- then use the memory dump that comes up to look at where that code is pointing to. View that spot in ct2 in asm view and take your time figuring out what does what.
The problem with using ct2 to edit the asm is you have to know how to parse the asm code exactly. You can still edit it with other tools if ct2 gives you problems.
Oh, With an action replay code actually now that I think about it just copy the asm directly over it from the one game to the other. the only problem with that last idea is that any arcodes after this that reflect exp will cause problems.
head over to kodewerx for their info on action replay code structure and the various ways of doing things. This is actually very do- able.

Please do not get discouraged by the what is being said and take the time to just look at it. looking at nds machine code isn't that scary... confusing at first maybe but not that big a deal.

edit after looking it seems that its either referring to three points in memory or the exp code is redundantly held in three points in memory. Either can be worked with.
 

Prof. 9

Well-Known Member
Member
Joined
Jun 17, 2008
Messages
324
Trophies
1
Location
The Netherlands
Website
twitter.com
XP
853
Country
Netherlands
I gave this a try just now.

::Black/White Experience Formula (very inaccurate)
5223E78C 43485C10
E2000740 0000002C
B406B500 5C2A5C11
300A0048 310A1889
E922F0F2 1C014340
BC0EDF0D 31014341
5C104801 BD004348
00002D74 00000000
0223E78C FFD8F5C1
1223E790 00002105
D2000000 00000000

This is my custom routine.

Code:
push r14
push r1,r2
ldr r1,[r2,r0]		; r1 = L
ldrb r2,[r5,r0]		; r2 = Lp (does it get the Level for the victorious Pokemon or the Pokemon that gets Exp?)

lsl r0,r1,0x01		; 2 * L
add r0,0x0A		; 2L + 10
add r1,r1,r2		; L + Lp
add r1,0x0A		; L + Lp + 10
blx 0x020F2998		; (2L + 10)/(L + Lp + 10)	(very inaccurate)
mul r0,r0		; ((2L + 10)/(L + Lp + 10))^2
mov r1,r0
swi 0x0D		; ((2L + 10)/(L + Lp + 10))^0.5 (very inaccurate)
mul r0,r1		; ((2L + 10)/(L + Lp + 10))^2.5

pop r1,r2

mul r0,r1		; b * multiplier
add r0,0x01		; b * multiplier + 1
ldr r0,=0x00002D74
ldrb r0,[r2,r0]		; r0 = L
mul r0,r1		; L * b * multiplier + 1
pop r15            ; back to the main Exp routine

It works in theory, but it's so inaccurate that the Exp you gain becomes about 1 if you're higher-leveled than the opponent. I'm not sure how to fix that (it involves a lot of bitshifting, I believe).
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
this is my point you know what to look for so look for the beginning of this near that area in memory in the one game whose exp code you want to copy...
so look for it instead of making it up...
Yeah I am so lazy I am making you do it, as I don't really have any interest in doing this myself I just know it can be done.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    This was one of the craziest movies I've seen about our food industry, lots of stuff I didn't know. A must see. https://youtu.be/OqzjC-ENrl8?si=GYxmdY5nShzGniVi
  • OctoAori20 @ OctoAori20:
    Oh, that dude?
  • OctoAori20 @ OctoAori20:
    I stopped believing or caring about that dude when I found out about some of the more questionable nonsense he did in his life.
  • BigOnYa @ BigOnYa:
    Like what? I didn't know or hear.
  • K3Nv2 @ K3Nv2:
    You mean like every famous person that ever existed
    +1
  • K3Nv2 @ K3Nv2:
    I get so tired of hearing oh I liked him until...
  • OctoAori20 @ OctoAori20:
    I just know dude was a chronic alcoholic and such.
  • BigOnYa @ BigOnYa:
    I've been to his chicken restaurant he started in his 2nd movie, Holy Chicken, was pretty good. It is only 15-20 miles from me in Ohio. It only lasted 1 yr or so then closed tho.
  • OctoAori20 @ OctoAori20:
    There are very few people I just have just an immense dislike of and he's one of those very few people, the only other example is Gene Simmons. My musician uncle on my mother's side of the family actually met Gene once during some event and said he was the most unpleasant person to be around.
  • K3Nv2 @ K3Nv2:
    I met myself once turns out that guy is a giant piece of shit that doesn't deserve any of my respect
  • BigOnYa @ BigOnYa:
    Damn alcoholics! (Sshhh- Opens another beer)
  • OctoAori20 @ OctoAori20:
    Agreed, Ken
  • OctoAori20 @ OctoAori20:
    I can't say I've ever tried even a sip of beer tbh-
  • K3Nv2 @ K3Nv2:
    You met yourself also and is a giant piece of shit?
    +1
  • OctoAori20 @ OctoAori20:
    Then again, I don't think I'd really enjoy it //shrug
  • OctoAori20 @ OctoAori20:
    I'm sure it's an acquired taste :P
  • K3Nv2 @ K3Nv2:
    Poor lad can never enjoy the amazing taste of four loko
    +1
  • BigOnYa @ BigOnYa:
    Root beer is a gateway drink, don't ever try it either.
  • K3Nv2 @ K3Nv2:
    @BigOnYa, don't you love how smooth MD20 is
  • BigOnYa @ BigOnYa:
    Mad dog 20 20? Oh yea fixed the typo. I haven't seen that or had forever. Do they still make it?
  • K3Nv2 @ K3Nv2:
    I think it's why I'm alive
    +1
  • BigOnYa @ BigOnYa:
    What happens if when playing Paper Mario, you start a fire in-game?
  • Psionic Roshambo @ Psionic Roshambo:
    Paper Mario is a drug dealer and he is all about the paper yo lol
    +1
    Psionic Roshambo @ Psionic Roshambo: Paper Mario is a drug dealer and he is all about the paper yo lol +1