The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Sideshow Showcase (https://www.pokecommunity.com/forumdisplay.php?f=204)
-   -   Red Shin Pokemon Red/Blue/Green/JP builds (Bugfix, AI, and QoL patch) (https://www.pokecommunity.com/showthread.php?t=427398)

jojobear13 December 27th, 2020 10:15 AM

There was a typo in the object data of the unknown dungeon basement that affects the Green patches. I've fixed it and re-uploaded new Green patches. Please try again with these new patches if you are using Green version.

jojobear13 January 1st, 2021 11:43 PM

After some discussion with my Reddit liaison, I've started work on a very simple randomizer for Shin Pokemon. I'm planing to have it be a unix bash script that can be run under cygwin with core utilities. The user will be prompted to input the name of the rom file as well as the banks and hex addresses of some important labels I'm adding to the .sym files (the .sym files will be added to the github). From there, the script will automatically do the necessary hex-editing on the rom file.

While it does require a little more skill than the nice GUI options for other game, the tradeoff is that it is compatible with all unix-based operating systems and environments (very handy for developers). It will also continue to work when I make new updates to Shin Pokemon.

Initial plans are as follows:
--Mew, Mewtwo, and the bird trio are unaffected since their encounters are handled by map scripts and I don't want to mess with that yet.
--Likewise, scripted pokemon (gifts, in-game trades, fossils, game corner, etc) are slated for later.
--But your starters will get randomized of course.
--151 availability is only in the master branch since that is already built into the rom itself.
--Random encounter-able land & water pokemon will be randomized on a global scale (all instances of one species become all one other species).
--Super rod pokemon will be randomized on a global scale.
--Trainer pokemon will be randomized on a global scale.
--Pokemon are put into A, B, and C tier lists. Randomization occurs within each separate list to prevent something like Brock throwing 2nd-stage evolutions at you.
--No move randomizer planned yet since it takes a while to do it in a way that prevents soft-locking.

Current status: I can accurately write bytes to a rom file, and I can randomize an array of pokemon hex values. Looking feasible but I have a long way to go.

jojobear13 January 3rd, 2021 10:46 PM

So the randomizer bash script is making progress. I had to make sure VIM was installed to Cygwin so I could access the xxd command. Starter pokemon and trainer rosters can now be randomized.

zycain January 4th, 2021 6:37 AM

Hey Jojo, hope youre keeping well, good to see progress is still going well with this rom :) so i discovered the New Game+ mechanism and played around with it a bit, saving my party to a box first then setting up with a junk pokemon ready to switch over (i actually did this several times to get it all just how i wanted it and experiment with the mechanism, and i believe i have found a bug, i left the old game with 80 pokemon in the bank and switched into the new game with only 78, when i got to the pokedex i can see whats going on, even though i have bulbasaur in the bank and i picked charmander this time, the pokedex is showing bulbasaur as not owned (no pokeball) so i'm guessing its something to do with the initial selection process clearing out the pokedex for the options i didnt pick? or something is re-setting any found status on the first 3 as you select one? not sure but yeah have at it :)
All the best :)

jojobear13 January 4th, 2021 11:20 AM

Quote:

Originally Posted by zycain (Post 10255822)
Hey Jojo, hope youre keeping well, good to see progress is still going well with this rom :) so i discovered the New Game+ mechanism and played around with it a bit, saving my party to a box first then setting up with a junk pokemon ready to switch over (i actually did this several times to get it all just how i wanted it and experiment with the mechanism, and i believe i have found a bug, i left the old game with 80 pokemon in the bank and switched into the new game with only 78, when i got to the pokedex i can see whats going on, even though i have bulbasaur in the bank and i picked charmander this time, the pokedex is showing bulbasaur as not owned (no pokeball) so i'm guessing its something to do with the initial selection process clearing out the pokedex for the options i didnt pick? or something is re-setting any found status on the first 3 as you select one? not sure but yeah have at it :)
All the best :)

Wait, did Pokémon get deleted from the PC? Or is it the owned Pokémon in the Pokédex?

zycain January 4th, 2021 11:53 AM

1 Attachment(s)
Quote:

Originally Posted by jojobear13 (Post 10255984)
Wait, did Pokémon get deleted from the PC? Or is it the owned Pokémon in the Pokédex?

it didnt get deleted from the pc, just in the pokedex it's not showing as owned, and actually i just withdrew bulbasaur from the bank to test if that would trigger it to show again and it's still not showing in the pokedex as owned (with a pokeball symbol)

jojobear13 January 4th, 2021 12:20 PM

Quote:

Originally Posted by zycain (Post 10256002)
it didnt get deleted from the pc, just in the pokedex it's not showing as owned, and actually i just withdrew bulbasaur from the bank to test if that would trigger it to show again and it's still not showing in the pokedex as owned (with a pokeball symbol)

Ah, I see. That's good to know. I was worried I had a much bigger problem to solve. This is an easy fix. The issue is the StarterDex function that gets called every time you look at one of Oak's pokeballs.
Code:

; this function temporarily makes the starters (and Ivysaur) seen
; so that the full Pokedex information gets displayed in Oak's lab
StarterDex:
        ld a, %01001011 ; set starter flags
        ld [wPokedexOwned], a
        predef ShowPokedexData
        xor a ; unset starter flags
        ld [wPokedexOwned], a
        ret


The problem is that the whole byte gets cleared to zero after viewing the pokedex entry and then it is placed back into wPokedexOwned. Fine if you assume that the player has no pokemon, but a problem for NG+. It should be like this instead.
Code:

StarterDex:
        ld a, [wPokedexOwned]
        push af
        ld a, %01001011 ; set starter flags
        ld [wPokedexOwned], a
        predef ShowPokedexData
        pop af
        ld [wPokedexOwned], a
        ret


I've posted an issue on the github and slated the fix for the next version.

zycain January 4th, 2021 1:35 PM

Quote:

Originally Posted by jojobear13 (Post 10256027)
Ah, I see. That's good to know. I was worried I had a much bigger problem to solve. This is an easy fix. The issue is the StarterDex function that gets called every time you look at one of Oak's pokeballs.
Code:

; this function temporarily makes the starters (and Ivysaur) seen
; so that the full Pokedex information gets displayed in Oak's lab
StarterDex:
        ld a, %01001011 ; set starter flags
        ld [wPokedexOwned], a
        predef ShowPokedexData
        xor a ; unset starter flags
        ld [wPokedexOwned], a
        ret


The problem is that the whole byte gets cleared to zero after viewing the pokedex entry and then it is placed back into wPokedexOwned. Fine if you assume that the player has no pokemon, but a problem for NG+. It should be like this instead.
Code:

StarterDex:
        ld a, [wPokedexOwned]
        push af
        ld a, %01001011 ; set starter flags
        ld [wPokedexOwned], a
        predef ShowPokedexData
        pop af
        ld [wPokedexOwned], a
        ret


I've posted an issue on the github and slated the fix for the next version.

Thats fantastic, thanks for all your hard work :)

Jurei January 5th, 2021 7:02 AM

Hey jojobear13, I love this hack so far (actually my favorite one) but I would like to ask you if a japanese version of it is planned ? I've been digging through the net for a disassembly of the Green version with no success. If it's not in your plans, how would I proceed to make a translation of your hack ? (if you allow me of course). Thanks !

jojobear13 January 5th, 2021 10:02 AM

Quote:

Originally Posted by Jurei (Post 10256529)
Hey jojobear13, I love this hack so far (actually my favorite one)

Glad you enjoy it.

Quote:

but I would like to ask you if a japanese version of it is planned ?
Not planned. I'm not multilingual.

Quote:

I've been digging through the net for a disassembly of the Green version with no success. If it's not in your plans, how would I proceed to make a translation of your hack ? (if you allow me of course). Thanks !
Shin Pokemon is open source. You can clone the github repository, set up cygwin and rgbds to compile things, and start tinkering around. The first thing you'd want to do is restore the japanese characters by either replacing the text in gfx/font.png or restoring the japanese characters somehow. Then you would want to go to charmap.asm and remap the hex values from the english letters to the japanese letters.

This is not a beginner's-level endeavor.

darthbr January 7th, 2021 8:29 AM

How to make legendaries not spawn after beating future red?

jojobear13 January 8th, 2021 1:13 PM

Quote:

Originally Posted by darthbr (Post 10257796)
How to make legendaries not spawn after beating future red?

Go to Route25Script3 and start commenting stuff out that you want to exclude.

jojobear13 January 8th, 2021 2:08 PM

Attn all. A basic bash script randomizer, "randoshinred", is now in beta test for those who compile the master development branch.

Lord Gengar January 8th, 2021 6:33 PM

The randomizer sounds awesome; something that I feel more of these "expansion" hacks should implement as it creates a whole new experience- I'm tired of using the same dang 3 starters each time! lol

aicaimze January 8th, 2021 7:18 PM

do external randomizers still work?

jojobear13 January 9th, 2021 12:33 AM

Quote:

Originally Posted by aicaimze (Post 10258626)
do external randomizers still work?

No. Generic external randomizers for vanilla red/blue edit bytes that have changed addresses in Shin Pokemon. The game just crashes as a result. That's why I had to make my own external randomizer from scratch.

jojobear13 January 9th, 2021 1:56 AM

Quote:

Originally Posted by Lord Gengar (Post 10258612)
The randomizer sounds awesome; something that I feel more of these "expansion" hacks should implement as it creates a whole new experience- I'm tired of using the same dang 3 starters each time! lol

I've learned that this is harder than it looks. A few things I discovered:
  • A built-in randomizer should not go editing its own rom addresses. It will not write anything if using a flash card. If an emulator even allows this in the first place, the rom changes just get lost once you close out. The rom needs to be randomized again with every startup unless there is a way to save the modified rom from the emulator. BGB will let you save, but many people play rom hacks using phone emulators nowadays.
  • So another option is for a built-in randomizer to do its randomizing on the fly. Essentially just load random mons into party rosters and whatnot as needed. This takes lots of code to implement well, and doubly so if you want a lot of different choices (bank sizes can become an issue in GBC games). It also means you cannot track wild pokemon with your 'Dex because it references the wild tables stored in the game rom.
  • Finally, and most practical, is to simply edit the rom file with an external script or program. This requires that the randomizer knows the exact bytes that need to change and their exact positions within the rom file. If an assumed position is off by even one bit, then the whole rom file is probably hosed. Programs like Universal Randomizer are created with vanilla roms in mind where all the relevant byte addresses are well-researched and set in stone. Sometimes they work for rom hacks that just so happen to avoid shifting or changing any byte addresses used by the randomizer. Often, like in Shin Pokemon's case, some assumption the randomizer makes isn't true anymore and the rom file gets hosed somewhere.
  • So that leaves me with the little external bash script I wrote. Run it in a unix terminal. Externally edit the rom. Prompt the user for banks and hex addresses from the rom's matching sym file. Then use the input from the user to point to the correct locations. Better than having to update the dang thing every time I make a small change to the game code. Anyone can see inside the .sh script file to either adapt it for their own project or (more than likely) make fun of my atrocious coding practices.

jastolze007 January 12th, 2021 5:59 AM

I thought I'd report that upon testing to see if my PKMN could indeed correctly level up past 100 via the cap change I made, while rare candies work, the said PKMN doesn't gain any exp on 100. If I used a rare candy to raise it above 100 and then go into battle, it will reset to 100 and try to learn all of its level up moves. With that said, I've noticed in past Red builds I've made, that this only is affected when using a gift Pokemon. For instance, my Gyarados that I paid for when it was a Magikarp on Route 4 or starter PKMN. I know this isn't a problem from your code, but it's kinda unfortunate as I would have liked to continue to play.

jojobear13 January 12th, 2021 10:23 AM

Quote:

Originally Posted by jastolze007 (Post 10260587)
I thought I'd report that upon testing to see if my PKMN could indeed correctly level up past 100 via the cap change I made, while rare candies work, the said PKMN doesn't gain any exp on 100. If I used a rare candy to raise it above 100 and then go into battle, it will reset to 100 and try to learn all of its level up moves. With that said, I've noticed in past Red builds I've made, that this only is affected when using a gift Pokemon. For instance, my Gyarados that I paid for when it was a Magikarp on Route 4 or starter PKMN. I know this isn't a problem from your code, but it's kinda unfortunate as I would have liked to continue to play.

What did you set as the level cap?

jastolze007 January 12th, 2021 10:34 AM

Quote:

Originally Posted by jojobear13 (Post 10260774)
What did you set as the level cap?

I believe it was 250. I was at 101 via rare candy to test it and went into a battle via the randomized trainer.

jojobear13 January 12th, 2021 12:38 PM

Quote:

Originally Posted by jastolze007 (Post 10260784)
I believe it was 250. I was at 101 via rare candy to test it and went into a battle via the randomized trainer.

Pokemon structures only have 3 bytes allotted for experience. A max level of 250 causes the CalcExperience function to overflow into 4 bytes. This will be different depending on a mon's growth rate.

Let's look at mewtwo for example. Math will be done in hex so it's easy to see the bytes being used. 250 in hex is $A8. Mewtwo's growth rate is "slow", so the exp it needs to hit the level cap i$s 5/4 n^3. Calculating ($A8)^3 gives $485a00. That's three bytes, so we're good so far. Now multiply by 5 to get $0169C200. Uh oh, that's 4 bytes. You've overflowed so that leftmost 01 gets tossed out of calculations. That leaves $69C200 / 4 to give a final result of $1A7080. This is an incorrect exp result that corresponds to a much lower level.

By my calculations, the highest value for max_level without initiating an overflow for any of the growth rates is 140.

jastolze007 January 12th, 2021 1:19 PM

Quote:

Originally Posted by jojobear13 (Post 10260839)
Pokemon structures only have 3 bytes allotted for experience. A max level of 250 causes the CalcExperience function to overflow into 4 bytes. This will be different depending on a mon's growth rate.

Let's look at mewtwo for example. Math will be done in hex so it's easy to see the bytes being used. 250 in hex is $A8. Mewtwo's growth rate is "slow", so the exp it needs to hit the level cap i$s 5/4 n^3. Calculating ($A8)^3 gives $485a00. That's three bytes, so we're good so far. Now multiply by 5 to get $0169C200. Uh oh, that's 4 bytes. You've overflowed so that leftmost 01 gets tossed out of calculations. That leaves $69C200 / 4 to give a final result of $1A7080. This is an incorrect exp result that corresponds to a much lower level.

By my calculations, the highest value for max_level without initiating an overflow for any of the growth rates is 140.

140? That sucks. This is so much easier in gen 3 hacks, where I can go to 255 with no overflow errors. Thanks for the info. I was using a modified Gyarados with a medium slow exp formula instead of slow so it could go higher but that doesn't matter as much now, I suppose.

jojobear13 January 12th, 2021 2:56 PM

Quote:

Originally Posted by jastolze007 (Post 10260862)
140? That sucks. This is so much easier in gen 3 hacks, where I can go to 255 with no overflow errors. Thanks for the info. I was using a modified Gyarados with a medium slow exp formula instead of slow so it could go higher but that doesn't matter as much now, I suppose.

Not all is lost. The engine for doing multiplication and division actually uses 4 bytes, so there is a bit of leeway the function for calculating experience. I whipped up a little something in about an hour.

Try implementing the changes in this commit. This updates the CalcExperience function to do math with 4 bytes instead of 3 bytes. This will prevent the left-most byte from being dropped and give accurate math. Since pokemon are still restricted to 3 bytes of exp, I also made it so that it dynamically lowers the max_level for each pokemon (based on growth rate) such that the maximum experience achievable stays within 3 bytes. Theoretically, mons with the fast growth rate can go all the way to level 255 now while mons at the slow growth rate are capped to level 237.

jastolze007 January 12th, 2021 5:08 PM

Quote:

Originally Posted by jojobear13 (Post 10260919)
Not all is lost. The engine for doing multiplication and division actually uses 4 bytes, so there is a bit of leeway the function for calculating experience. I whipped up a little something in about an hour.

Try implementing the changes in this commit. This updates the CalcExperience function to do math with 4 bytes instead of 3 bytes. This will prevent the left-most byte from being dropped and give accurate math. Since pokemon are still restricted to 3 bytes of exp, I also made it so that it dynamically lowers the max_level for each pokemon (based on growth rate) such that the maximum experience achievable stays within 3 bytes. Theoretically, mons with the fast growth rate can go all the way to level 255 now while mons at the slow growth rate are capped to level 237.

I appreciate you doing all that man! I still need to find a way to update from 1.15 to more recent. I've been playing on Goomba and haven't been able to transfer save without starting over. Could I just apply the changes you made in the older version of code I have?

Also, would this work with a previous save? Or would I need to start over?

jojobear13 January 12th, 2021 6:41 PM

Quote:

Originally Posted by jastolze007 (Post 10260976)
I appreciate you doing all that man! I still need to find a way to update from 1.15 to more recent. I've been playing on Goomba and haven't been able to transfer save without starting over. Could I just apply the changes you made in the older version of code I have?

Also, would this work with a previous save? Or would I need to start over?

Yeah, it should work if you just apply those changes.

In terms of updating your game save, have you tried saving outside in pallet town and using the softlock teleport?


All times are GMT -8. The time now is 8:52 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.