• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: Modernizing the FireRed field engine?

Darthatron

巨大なトロール。
1,152
Posts
18
Years
The player doesn't face the trainer when initiating a battle.
Isn't this as easy as just changing the sprite? :\
EDIT: I miss understood. Nevermind.

The item sound.
This probably wouldn't be overly difficult. I'm fairly sure that all we would have to do is implement something to check the item numbers in the current routine(?), which is not overly difficult.

Pokémon Ability behaviours in the field.
Such as..? But this shouldn't be overly difficult, depending on the ability.

Battle Tower?
I've never looked in to this.

Berry behaviours.
This would probably be the most annoying thing to do.
 
Last edited:
10,078
Posts
15
Years
  • Age 32
  • UK
  • Seen Oct 17, 2023
Is there actually some standard trainer script to allow that, though?

As far as I know there is no way to make the player face the trainer in a -normal- trainer script battle.

To make it happen I guess the only ways are either: Replacing the trainer view radius with a line of Script tiles to run simple movements + battle. Although this would mean a lot of scripts it doesn't have to take up a lot of space if you keep track of your pointers and reuse the movements.

The other way would be editing the [!]-Walks up to player sequence which would require hacking the game engine directly I assume.

----------------------

With items having different sounds this is easy with a script using the additem command, as you can decide which fanfare to use depending on whether the item is a berry, pokéball-item or whatever. Having to use that command on PokéBall items however means more commands -> more bytes per script used as the 'giveitem' command does the equivalent in a much more simple form.



----------------------

Just realised I totally took this thread the wrong way :P I thought 'how can we implement these things in to hacks' rather than to improve the FireRed game itself XD which I'm guessing people don't want to go and rescript totally haha.

(And yes I agree hacking the engine directly is better, because then by patching it means in the future people won't have to go through these above efforts :P)
 
Last edited:

JPAN

pokemon rom researcher
104
Posts
15
Years
  • Seen Jul 2, 2016
I'll give my two cents on this...

The player doesn't face the trainer when initiating a battle.
I actually "solved" this problem earlier with the trainer flag hack, by allowing the script to be run like a normal script. There are commands to change the player facing, and the trainer position (and number) is kept on the routine that calls this behaviour. So, it's just a matter of changing my hack around.

The item sound.
In this one, I've got little to offer. I don't usually test with sound, so I never studied that area.

Pokémon Ability behaviours in the field.
I've been studying abilities lately, and this one, with a little asm, is quite feasable. For the egg hatching, It's on the same location of my walking scripts hack, and I've sucessfully made that change before. For other field abilities, I would need to know what they are before making any leaps, but it should be similar.

An IV checker character.
Also made this one earlier. Using the pokemon decrypt special + IV getter, you just need a looping script to find them all.

Battle Tower?
I'm yet to try this out, but I had plans to make something like this. What I thought of was to either have a pool of pokemon numbers or simply use the RNG to generate pokemon numbers, have a function to create a pokemon trainer dynamically on the RAM, and have the trainerbattle command call that trainer.
At the end of the battle, clean that trainer flag and you're ready for the next one. Only problem would be the xp gain, but that could be neutralized by force-level all your party pokemon to level 100 (or similar code).

Updated Berry behaviours.
This last one is involved with Item editing. I've studied them and so far they seem pure assembly, but I thought battles were pure assembly as well... I've managed to create some items that do act on pokemon on the screen, so it's doable, but the process I have is still buggy.

I'm not currently on my hacking computer, but I'm happy to give you the source code for the solutions to the problems I have solved. For the others, I can only offer my help.
 

HackMew

Mewtwo Strikes Back
1,314
Posts
17
Years
  • Seen Oct 26, 2011
[...] so we should limit our scope to the 3rd Generation only.

Why being limited? I get your point, but while modernizing the engine thinking about brand new features won't hurt. We might actually come up with some interesting ones.

The player doesn't face the trainer when initiating a battle.
Okay, I'll be honest: I started the thread mostly because I need some insight into this issue. FR/LG imitates RBY, where the player doesn't look at the trainer before the battle starts. The trainer has been facing the NPC since the Gold/Silver days, and it's still like this.

Speaking of initiating battles, the music when a trainer approaches is limited to three tracks - recent games have about 11, or 12, where an appropriate trainer theme plays for them (e.g. Ace Trainers, Youngsters, Miniskirts, Twins…) Darthatron and I took a bit of time to research it and we thought the music table was at 0x47A2D2, but changing it has no effect.

The item sound.
That Level Up sound is inappropriate for getting items - since Gold/Silver we've had the new Item Get fanfare . Is it also possible to implement the TM Get fanfare when a player receives a TM, and the Berry Get fanfare when the player finds a Berry?

Well, since I'll need all of those for my hack, I'll share my findings when I look into them.

Pokémon Ability behaviours in the field.
Implementing this would be tough. It basically improves Pickup, and abilities like Arena Trap increase the chance of encountering Pokémon. Oh, and items like Light Ball and Magma Armor have breeding effects, but that's going to be absolutely horrible to implement.

Well, maybe Magma Armor might not that hard to implement, for example. What about making a complete list?

An IV checker character.
There's one in Emerald!

In my opinion, the one in Emerald is almost useless, anyway: all he can do is revealing which IV is the highest in a vague manner. I planned something similar for my hack, except all EV/IV values would be shown. Getting the respective values is really a piece of cake. If anyone wants, I can provide a working example.

Battle Tower?
It's a de facto element of the Pokémon games since Ruby/Sapphire, and we don't have it. Would it be excessively hard to tap into the bank of trainers in the Trainer Tower, for instance? Would it be possible to implement more?

I have yet to do research about it, since it's not something I would need soon.

Updated Berry behaviours.
We've seen it in Emerald, but obviously it's much more difficult (in that it requires programming) to implement.

Again, what about writing down a list?
 

Vrai

can you feel my heart?
2,896
Posts
15
Years
  • Age 29
  • Seen Oct 24, 2022
Well, maybe Magma Armor might not that hard to implement, for example. What about making a complete list?

A complete list, you say?

Note: Almost all of these only occur if the Pokemon is in the lead slot. If it's not so, I'll mention it.

Arena Trap - rate of wild battles is doubled
Compoundeyes - rate of wild pokemon holding an item increases
Cute Charm - rate of wild pokemon of opposite gender increases to 66.7%
Flame Body - pokemon eggs hatch in half the time (can be anywhere in party)
Hustle - rate of wild battles decreases
Hyper Cutter - cut removes more grass than normal (can be anywhere in party)
Intimidate - cuts rate of weaker (five levels under and lower) wild battles
Keen Eye - cuts rate of weaker wild battles
Lightningrod - receives more phone calls (Emerald)
Magma Armor - see flame body (can be anywhere in party)
Magnet Pull - rate of seeing wild Steel pokemon +50%
Pressure - rate of wild battles is halved
Sand Veil - rate of wild battles during Sandstorm is halved
Static - see magnet pull but replace steel with electric (can be anywhere in party)
Sticky Hold/Suction Cups - pokemon hooked by a rod are easier to catch (can be anywhere in party)
Swarm - pokemon cries are heard more often (can be anywhere in party)
Synchronize - pokemon with the same nature are 50% likelier to find
Vital Spirit - rate of high leveled battles decreases
White Smoke - see pressure

Yup so that should be it. I don't know any stats about them, just what they do.
 

ZodiacDaGreat

Working on a Mobile System
429
Posts
17
Years
JPAN said:
Battle Tower?
I'm yet to try this out, but I had plans to make something like this. What I thought of was to either have a pool of pokemon numbers or simply use the RNG to generate pokemon numbers, have a function to create a pokemon trainer dynamically on the RAM, and have the trainerbattle command call that trainer.
At the end of the battle, clean that trainer flag and you're ready for the next one. Only problem would be the xp gain, but that could be neutralized by force-level all your party pokemon to level 100 (or similar code).
Uhm, if I'm not wrong there's a special to do a battle for Battle Tower, special 0x3B, I think.

HackMew said:
Why being limited? I get your point, but while modernizing the engine thinking about brand new features won't hurt. We might actually come up with some interesting ones.
I agree ^^
 

HackMew

Mewtwo Strikes Back
1,314
Posts
17
Years
  • Seen Oct 26, 2011
But other innovations that don't have to do with the engine directly would probably cannibalise the point of the R&D forum. :P

Well, the brand new innovations I was talking about were referred to the engine directly, actually.
Anyway, I've remade the ability list Vrai posted to add more detailed information (Vrai's list was missing Illuminate too). See also the notes below:

Spoiler:


  1. I was able to implement Flame Body and Magma Armor already. Source code available on request. (From 21 to 19).
  2. Among the others which are still missing, the ones that simply increase/decrease the encounter rate should be the easiest to implement. Such abilities are: Arena Trap, Illuminate, Sand Veil, Stench, and White Smoke. (So theoretically from 19 to 14).
  3. While Sticky Hold and Suction Cups cause bites to occur more often while fishing, I don't know exactly how much "more often". Does anyone know? Also, apparently Suction Cups requires that the Pokémon having it is the leading one in the player's party. At least according to Bulbapedia. Is that true or not? What about Sticky Hold?
  4. Regarding Swarm, Bulbapedia says that the chances of encountering wild Pokémon increase. True or false? Also, since it increases the cry rate, how much?
  5. As you can see, Lightningrod is missing, due to its peculiar effect. Does anyone think it's still worth it? If so, does anyone know the exact values? Bulbapedia doesn't say anything about its field effect.
  6. About Static and the similar ones... Vrai said the Pokémon can be anywhere in the party. However Bulbapedia thinks otherwhise. Who is wrong?
  7. Just to be sure, can anyone confirm the data on the list above? Also, is it complete?
 
Last edited:

HackMew

Mewtwo Strikes Back
1,314
Posts
17
Years
  • Seen Oct 26, 2011
Well HackMew, are these "brand new features" that improve the engine something that we've seen in a current game? If not, they probably are things we should spin off into another thread. Whatever the case, let's hear them. :D (Also, let's see code for what you've found related to this thread.)

I know that the abilities are similar, but should we implement a placeholder number (e.g. 30%, 50%, etc.) for the chances we don't know, is it trivial to change them later?

If Lightningrod actually does increase Match Calls, then it'd be irrelevant to FR/LG unless it was used to alter the chance of alerting trainers of VS Seeker. Or something like that. We could just not include it at all, and if some FR/LG hack includes a mobile phone, let the hacker decide the chance.

Oh, and don't forget about the enhancements made to Pickup.

edit: According to a certain site's "AbilityDex" (now you know what site it is) it relies on the lead Pokémon to trigger it.

Regarding the new features... I was just saying, I don't have anything special in my mind so far. The goal of the thread is indeed modernizing the engine, so I guess you're probably right about having another thread to talk about completely new features.

Surely we could use some placeholder values, but after all we need the exact ones to properly emulate then, at some point. So I think we should get all the detailed info first, and then think about implementing and whatnot.

I definitely agree on the Lightningrod ability.

As for Pickup, I did not forget about Emerald's enhancements. Considering it works in a similar fashion already, IMHO we could even leave it as is.

Now, here's the Flame Body/Magma Armor hack:

Code:
[div="font-family:consolas, courier new,monospace"].text
.align 2
.thumb
.thumb_func
.global MagmaArmorHack

main:
	sub r0, #0x1
	cmp r0, #0x1
	blt return
	push {r0, r4-r6}
	ldr r4, .POKEMON_PARTY
	mov r5, #0x6
	
loop:
	add r0, r4, #0x0
	mov r1, #0xB
	ldr r3, .READ_DATA
	bl bx_r3
	add r6, r0, #0x0
	add r0, r4, #0x0
	mov r1, #0x2E
	ldr r3, .READ_DATA
	bl bx_r3	
	add r1, r0, #0x0
	add r0, r6, #0x0
	ldr r3, .GET_ABILITY
	bl bx_r3
	cmp r0, #0x28
	beq fast_hatch
	cmp r0, #0x31
	beq fast_hatch
	add r4, #0x64
	sub r5, #0x1
	cmp r5, #0x0
	bne loop
	pop {r0, r4-r6}

return:
	str r0, [sp]
	add r0, r4, #0x0
	mov r1, #0x20
	ldr r3, .RETURN_ADR

bx_r3:
	bx r3

fast_hatch:
	pop {r0, r4-r6}
	sub r0, #0x1
	b return
	

.align 2
.POKEMON_PARTY:
	.word 0x02024284
.READ_DATA:
	.word 0x0803FBE8|1
.GET_ABILITY:
	.word 0x08040D38|1
.RETURN_ADR:
	.word 0x08046398|1[/div]

Once assembled and inserted, replace the bytes at 0x46390 with 00 49 08 47 XX XX XX XX (XX XX XX XX being the pointer to the routine's address increased by 1). FR US v1.0, by the way. Feel free to test and use it yourself, just don't claim it as yours.

On a side note, the sub-routine located at 0x3FBE8, used in the routine above, it's a powerful routine which can retrieve just any Pokémon info. The routine has two parameters, r0 being the Pokémon base address, and r1 being what I call "data index". As usual, the return value is written to r0. Here's the list I've collected so far:

Code:
[div="font-family:consolas, courier new,monospace"]0x00 - Pokémon ID
0x01 - Trainer IDs
0x02 - Nickname Max Length 1 (r6 should be the nickname's address)
0x03 - Font / Language
0x04 - Sanity
0x05 - Sanity
0x06 - Sanity
0x07 - OT Name Max Length
0x08 - Marks
0x09 - Checksum
0x0A - Filler
0x0B - Species
0x0C - Held Item
0x0D - Attack 1
0x0E - Attack 2
0x0F - Attack 3
0x10 - Attack 4
0x11 - PP 1
0x12 - PP 2
0x13 - PP 3
0x14 - PP 4
0x15 - PP Bonuses
0x16 - Coolness
0x17 - Beauty
0x18 - Cuteness
0x19 - Exp. Points
0x1A - HP EV
0x1B - Attack EV
0x1C - Defense EV
0x1D - Speed EV
0x1E - Sp. Attack EV
0x1F - Sp. Defense EV
0x20 - Happiness
0x21 - Smartness
0x22 - Pokérus Status
0x23 - Catch Location
0x24 - Catch Level
0x25 - 
0x26 - Hometown / Poké Ball / Trainer Gender
0x27 - HP IV
0x28 - Attack IV
0x29 - Defense IV
0x2A - Speed IV
0x2B - Sp. Attack IV
0x2C - Sp. Defense IV
0x2D - IsEgg
0x2E - Ability Bit
0x2F - Toughness
0x30 - Sheen
0x31 - 
0x32 - 
0x33 - 
0x34 - 
0x35 - 
0x36 - 
0x37 - Status Ailment
0x38 - Level
0x39 - Current HP
0x3A - Total HP
0x3B - Attack
0x3C - Defense
0x3D - Speed
0x3E - Sp. Attack
0x3F - Sp. Defense[/div]
 

Vrai

can you feel my heart?
2,896
Posts
15
Years
  • Age 29
  • Seen Oct 24, 2022
While Sticky Hold and Suction Cups cause bites to occur more often while fishing, I don't know exactly how much "more often". Does anyone know? Also, apparently Suction Cups requires that the Pokémon having it is the leading one in the player's party. At least according to Bulbapedia. Is that true or not? What about Sticky Hold?
Regarding Sticky Hold, both Serebii and Psypoke also agree that it is not required to be in the lead for it to work. :(

I dunno about the percentages, though.

Regarding Swarm, Bulbapedia says that the chances of encountering wild Pokémon increase. True or false? Also, since it increases the cry rate, how much?
This one I'm more confused about. Serebii and Psypoke, again, agree that it only increases cry rate, although Veekun agrees with Bulbapedia that it increases wild Pokemon encounter rates. I dunno. ):
As you can see, Lightningrod is missing, due to its peculiar effect. Does anyone think it's still worth it? If so, does anyone know the exact values? Bulbapedia doesn't say anything about its field effect.
It's not worth it. :D
About Static and the similar ones... Vrai said the Pokémon can be anywhere in the party. However Bulbapedia thinks otherwhise. Who is wrong?
Just to be sure, can anyone confirm the data on the list above? Also, is it complete?
Static was a mistake on my part, like the missing Illumination. It is, indeed, meant to be in the lead.

It seems to me that it's correct and complete, although clearly I'm not the best at judging these things. :)
 

altariaking

Needs NO VMs...
1,087
Posts
14
Years
another thing i think would be pretty cool is the animations from emerald.
this could be pretty tricky, but it would need a routine to check when a pokemon comes into battle, change the sprite, change it back again.
also, volt tackle. emerald has it, why not firered?
 

Logan

[img]http://pldh.net/media/pokecons_action/403.gif
10,417
Posts
15
Years
FireRed does have Volt Tackle actually, just not the breeding methods Emerald uses to get it.
 

sir.euge

Bunchies Back!
140
Posts
14
Years
  • Age 30
  • Seen Jul 17, 2012
Ok! So if i wanted to insert the flame body hack i would use XSE and decompile that offset then replace it and recompile? This is going to be my first try so bear with me.
 

Tropical Sunlight

The Faltine
3,476
Posts
16
Years
Ok! So if i wanted to insert the flame body hack i would use XSE and decompile that offset then replace it and recompile? This is going to be my first try so bear with me.
Actually, no. You need an ASM-thing-tool, but I don't know anything more. If you decompile those offsets in XSE it should be pretty weird.
 

Mr.Silver

Say Hello To Nurse Barbra
670
Posts
14
Years
I would like to add a suggestion if i may.

Gender differences (and gender based events).
Not just for pokemon, but for player events.
Its in ruby,sapphire and emerald. Heck its even in GenIV.

I would go into it further, but its 5:45am here
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I would like to add a suggestion if i may.

Gender differences (and gender based events).
Not just for pokemon, but for player events.
Its in ruby,sapphire and emerald. Heck its even in GenIV.

I would go into it further, but its 5:45am here

They already are. Use the checkgender command in a script. :P
 

Alignment

Revered with the stars
308
Posts
14
Years
  • Seen Dec 25, 2016
I have something that I've been trying to firgure out for a while.
Would it be possible to implement something like in Diamond and Pearl? I'm not sure if Emerald has it too :/
Well, what I'm talking about is the Pokedex. The Pokedex only updates once you've actually caught a Pokemon, however in D/P/PT once you see the Pokemon all the information is available. I want to see this in Fire Red as well. I'm pretty sure it's possible because when you talk to Prof. Oak through the PC in the PokeCenter, he is able to recall how many you've seen (in other words battled) and how many you've caught.

So the bottom line is, can we make it so that once we battle (not necessarily catch) we recieve the information we would have recieved if we caught it like size, location ect.

I hope that someone can help out .
 
2,048
Posts
16
Years
  • Age 31
  • Seen Sep 7, 2023
Actually, D/P's Pokédex works the same way as the other games - to see the type, weight, height and description, you have to capture it. The only difference is that the 'Pokédex' value shown on the continue screen and trainer card is the number seen, not caught. HG/SS reverted to the old system, where you have to capture a Pokémon for it to count towards the total.
 
Back
Top