Jump to content

Going to be making a Randomizer for Pokemon XD GALE of Darkness (Dolphin Only)


Reclaimer Shawn

Recommended Posts

So, around the Internet I seen people requesting for a Randomizer for Pokemon :XD:. One is being researched for Pokemon Colosseum, but I thought I'd do something much more practical. Randomizers work by talking a table of values in the game that define what Pokemon spawn and what trainers have. This Modifies actual ROM Data. So, I thought about taking a RAM Approach. The game's pokemon are stored in 2 areas of memory after the values from said events are called. I can modify temporary memory and easily due that. A flaw to Randomizersee is limited customizability and the fact you have to use the program again and again on the game rom to produce a different outcome. By a RAM approach, I'll be making a difficulty scaler and each Pokemon battle should be pretty random.

I have a feature right now that allows you to make everything shiny and catch it that way, as well as initiating a final boss fight. Best thing is, it'll be something different every millisecond of the day, as long as you have the program idling in the background. It'll even randomize trainer Shadow Pokemon as well (you can encounter anything as a Shadow!) This will be written in Lua and in a standalone Cheat Engine trainer (I already got some functionality down) that modified the Dolphin Process (this inew no way encourages pirating, as you could simply dump the ROM file of an actual copy) So, give me some feedback. What do you all think?

Link to comment
Share on other sites

So, around the Internet I seen people requesting for a Randomizer for Pokemon :XD:. One is being researched for Pokemon Colosseum, but I thought I'd do something much more practical. Randomizers work by talking a table of values in the game that define what Pokemon spawn and what trainers have. This Modifies actual ROM Data. So, I thought about taking a RAM Approach. The game's pokemon are stored in 2 areas of memory after the values from said events are called. I can modify temporary memory and easily due that. A flaw to Randomizersee is limited customizability and the fact you have to use the program again and again on the game rom to produce a different outcome. By a RAM approach, I'll be making a difficulty scaler and each Pokemon battle should be pretty random.

I have a feature right now that allows you to make everything shiny and catch it that way, as well as initiating a final boss fight. Best thing is, it'll be something different every millisecond of the day, as long as you have the program idling in the background. It'll even randomize trainer Shadow Pokemon as well (you can encounter anything as a Shadow!) This will be written in Lua and in a standalone Cheat Engine trainer (I already got some functionality down) that modified the Dolphin Process (this inew no way encourages pirating, as you could simply dump the ROM file of an actual copy) So, give me some feedback. What do you all think?

That sounds like a really cool idea. I have all the code infrastructure to make an :XD: randomiser the ROM way but it just hasn't been a priority. Your method sounds really cool though. I probably know the most about the data formats in :XD: so let me know if you need any help. ;)

A few questions though:

1. The trainer pokemon are divided into several different files. One for the main story mode, one for mt. battle, one for colloseums, one for battle mode and some other less relevant ones. I'm pretty sure they aren't all always in RAM and they are loaded and unloaded as necessary. I can't remember for sure though so I could be mistaken. Have you checked yourself to confirm this and more importantly, if that is indeed the case, would that pose a problem or do you think your program could keep track of this?

2. Are you going to make sure that the shadow pokemon are on required trainer battles? That's how it is in :XD: normally so that you don't have to hunt down random trainers looking for shadow pokemon. If you fail to snag a shadow pokemon would it be randomised again by the next time you encounter it? Also, there is a value I recently found in the shadow pokemon data which I haven't documented yet that determines whether or not the shadow pokemon goes to miror b. For example, the hexagon brothers don't pass their shadows to miror b. because they are rebattled. Although the game only includes 83 shadow pokemon, the data accommodates up to 128. The rest just don't have any data so you'd have to fill it in with some randomised data but that's easy enough. As I think you noticed from your code generator, things fall apart if you reuse shadow ids so it might be best to make sure you don't exceed the limit.

3. Does your program factor in the notorious "shiny glitch" in colosseum/xd? In :XD: shadow pokemon were never shiny but I ran some tests in my hack and the shiny glitch is definitely in :XD:. Would your program be able to change the pokemon's pid upon purification to have the same ability, gender and nature but with shininess calculated using the player's trainer id? Or, I think an easier and better way would be to change the function that calculated shininess in RAM. I know exactly where to find the function and all you would have to do is change it so it always uses the player's trainer id instead of the shadow pokemon's OT.

I can't think of anymore potential problems for now but I will be sure to let you know if there's anything else to look out for. Good luck!

Link to comment
Share on other sites

For question 1:

The one's that can be encountered after starting the game via continue: I'll take a look at that. I believe it's just called from game data and loaded into two slots of RAM, but I'll have to check that out. Fortunately enough, if theyou weren't, they'don't have little relevance.

For question 2:

Nope. Pokemon generated by this will be entirely random.

I could possibly have an encountered Shadow Pokemon be recoverable after a battle with it by loading it into a table. So far though, I think I just want it all to be random. Even if they don't catch a shadow pokemon, one will eventually come up with the same shadow pokemon data anyways (although it may be a different pokemon) Didn't want things to be too predictable though ;)

For question 3:

Didn't know that glitchy was present in :XD:. I just set the game trainer's TID and SID to zero, along with the Pokemon generated in a battle. The PID of generated pokemon is set to 4294967293(should wield a Pokemon that is Shiny, has a Bashful nature, and has 31 IVS in everything except HP, which is 29) I could have the program check if the Shadow Pokemon value suddenly changed to and have it check if it is indeed the same pokemon. If the value suddenly changes, have it freeze the address until all stat changes are over, then unfreeze it. I haven't implemented that yet though.

Link to comment
Share on other sites

For question 1:

The one's that can be encountered after starting the game via continue: I'll take a look at that. I believe it's just called from game data and loaded into two slots of RAM, but I'll have to check that out. Fortunately enough, if theyou weren't, they'don't have little relevance.

For question 2:

Nope. Pokemon generated by this will be entirely random.

I could possibly have an encountered Shadow Pokemon be recoverable after a battle with it by loading it into a table. So far though, I think I just want it all to be random. Even if they don't catch a shadow pokemon, one will eventually come up with the same shadow pokemon data anyways (although it may be a different pokemon) Didn't want things to be too predictable though ;)

For question 3:

Didn't know that glitchy was present in :XD:. I just set the game trainer's TID and SID to zero, along with the Pokemon generated in a battle. The PID of generated pokemon is set to 4294967293(should wield a Pokemon that is Shiny, has a Bashful nature, and has 31 IVS in everything except HP, which is 29) I could have the program check if the Shadow Pokemon value suddenly changed to and have it check if it is indeed the same pokemon. If the value suddenly changes, have it freeze the address until all stat changes are over, then unfreeze it. I haven't implemented that yet though.

1. Basically the other important ones are mt. battle and colosseums. I think that the mt.battle file is only loaded when you're on mt.battle and the colosseum data only when you're in a colosseum. I think when you say 2 slots, you mean how there are 2 copies of the trainer data? In the game files there are 2 copies of each "deck". For example, in story mode there is deck_story.bin and deck_story_EU.bin. I presume the EU one is loaded in the european versions but they're exactly the same data so their purpose is currently unknown to me. However, I know for sure that it has no effect on the US version and the EU one can be ignored. I'm not sure how you can figure out which one is the useless one in RAM but maybe you could find it by trial and error. I've actually deleted all the data in the EU files and the game still runs just the same.

2. That's okay then. Oh also, the miror b. shadow dragonite even is triggered once you've caught exactly 82 shadow pokemon and visit gateon port. Randomising the shadow pokemon means it could be triggered early and it could mess with some flags but I'm not really sure what might be affected if anything.

3. Yeah I set the function to calculate with 0 regardless of the trainers' ids so it stays consistent. I think it won't persist through trades but they probably aren't worth trading anyway. did you set the pid to 0xFFFFFFFD because that makes it shiny? You can actually change a value somewhere in one of the ASM routines so that the game just recalculates the pid until it's shiny, allowing the ability, gender and nature to still be random. I can track that down for you if you'd like.

Oh and I have a symbol map from dolphin saved with all the functions I've found being named for convenience. Remind me to send that to you some time. How good is your ASM? I know a good tutorial for ASM hacking in dolphin and since it's all in RAM you could do some really cool stuff by playing around with the functions.

Link to comment
Share on other sites

Oh and I have a symbol map from dolphin saved with all the functions I've found being named for convenience. Remind me to send that to you some time. How good is your ASM? I know a good tutorial for ASM hacking in dolphin and since it's all in RAM you could do some really cool stuff by playing around with the functions.

Sorry I haven't been back on in so long. The program is almost complete (I'll be calling this a beta release because I might add some extra little tidbits in the future. What I meant about the two slots of memory was that in the game, there are spots where temporary data is stored (in the RAM) From what I can see, the game checks the battle said person is in, and fills these temporary data slots using the data pulled from the ROM. My program just intercepts those two slots after data has been filled, and fills its own data so the randomized pokemon appear instead. I have the program generating Level 100 Pokemon and having stats anywhere from Nother good EVS and IVS to perfect stats. The program will most likely be finished by tomorrow. However, I might need your help on two things. If you have the function(in Cheat Engine format) that causes the Shiny Glitch, could you please send it to me and tell me how to implement it so I can solve that problem. Also, I've never made ASM codes, but could probably learn if I were guided in the correct direction. From programming in Lua and Java, ASM has started to make more sense. Registers being spots where data is held (kind of like variables), and cmp and jmp kind of acting like program if..then statements. If you wouldn't mind teaching me a bit, I'd be more than happy to learn.

Link to comment
Share on other sites

Sorry I haven't been back on in so long. The program is almost complete (I'll be calling this a beta release because I might add some extra little tidbits in the future. What I meant about the two slots of memory was that in the game, there are spots where temporary data is stored (in the RAM) From what I can see, the game checks the battle said person is in, and fills these temporary data slots using the data pulled from the ROM. My program just intercepts those two slots after data has been filled, and fills its own data so the randomized pokemon appear instead. I have the program generating Level 100 Pokemon and having stats anywhere from Nother good EVS and IVS to perfect stats. The program will most likely be finished by tomorrow. However, I might need your help on two things. If you have the function(in Cheat Engine format) that causes the Shiny Glitch, could you please send it to me and tell me how to implement it so I can solve that problem. Also, I've never made ASM codes, but could probably learn if I were guided in the correct direction. From programming in Lua and Java, ASM has started to make more sense. Registers being spots where data is held (kind of like variables), and cmp and jmp kind of acting like program if..then statements. If you wouldn't mind teaching me a bit, I'd be more than happy to learn.

I can't wait to try it out when it's done! I've never used cheat engine but I'll look into it and see what I can do. I normally use dolphin debug mode to view the ASM code and then locate that code in the game files and edit them in ROM. I can give you the memory address in Dolphin's RAM and what to change it to if that helps.

Yeah ASM isn't too bad once you get the general idea. There is a really great tutorial on hacking super smash bros ASM which is really useful. The combination of this and general programming knowledge should be enough and you can ask me if you need any help too :).

Link to comment
Share on other sites

I can't wait to try it out when it's done! I've never used cheat engine but I'll look into it and see what I can do. I normally use dolphin debug mode to view the ASM code and then locate that code in the game files and edit them in ROM. I can give you the memory address in Dolphin's RAM and what to change it to if that helps.

Yeah ASM isn't too bad once you get the general idea. There is a really great tutorial on hacking super smash bros ASM which is really useful. The combination of this and general programming knowledge should be enough and you can ask me if you need any help too :).

I'm finished with the randomizer! Although, I do need your help a bit. Pokemon HP values and the HP Stat are two different things (Max HP you can have at that level with current EV/IV and then there's the current value) The game just pulls the health value from what the original pokemon's current HP was going to be and simply places it there. If I just write to the address via the program, a battle will last forever. I need a function that immediately changes current HP to Base HP, but only when the pokemon comes out for the first time in battle. I also need the code to disable the shiny glitch. I can easily just have a person run that code in Dolphin along with my program in the background. I'll make sure to credit you 100% in that department.

Link to comment
Share on other sites

I'm finished with the randomizer! Although, I do need your help a bit. Pokemon HP values and the HP Stat are two different things (Max HP you can have at that level with current EV/IV and then there's the current value) The game just pulls the health value from what the original pokemon's current HP was going to be and simply places it there. If I just write to the address via the program, a battle will last forever. I need a function that immediately changes current HP to Base HP, but only when the pokemon comes out for the first time in battle. I also need the code to disable the shiny glitch. I can easily just have a person run that code in Dolphin along with my program in the background. I'll make sure to credit you 100% in that department.

To fix the shiny glitch, set the value at RAM address 0x8014416c to 0x38600000. This will make the game calculate all shininess based on a trainer id of 0 and secret id of 0 regardless of the pokemon's OT. If you'd like to put that in as a gecko code it would be : 0414416c 38600000 . The address is from the emulated RAM in dolphin debug mode but I'm not sure exactly how that translates to cheat engine.

As for the HP, is that your program keeps writing to the memory address? I'd imagine you could keep track of every time the opponent's pokemon has changed and if it's a new pokemon then write to that address once. When you say the battle lasts forever, why exactly doesn't it end?

Edited by StarsMmd
Link to comment
Share on other sites

My program was set to copy the base HP that was randomly generated by the program to the current HP 6 seconds after it fainted (so decent enough time was allowed to have it switch out) Even if I was supposed to knock out the trainer, he sends out another pokemon due to the fact the program generates a random pokemon after HP hits zero for one of the two pokemon. If you know where the address is that shows how many pokemon are in a person's party (the Pokeballs above their pokemon), tell me and I'll see if I can'tell use that) And finally, the addresses will probably be very similar, if not the same.

Link to comment
Share on other sites

My program was set to copy the base HP that was randomly generated by the program to the current HP 6 seconds after it fainted (so decent enough time was allowed to have it switch out) Even if I was supposed to knock out the trainer, he sends out another pokemon due to the fact the program generates a random pokemon after HP hits zero for one of the two pokemon. If you know where the address is that shows how many pokemon are in a person's party (the Pokeballs above their pokemon), tell me and I'll see if I can'tell use that) And finally, the addresses will probably be very similar, if not the same.

I see. The easiest way would probably be to look at the 6 memory addresses for the opponents team and count how many of them have data in them. Is that something you could do?

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...