• 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?".
  • 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: New Battle System

218
Posts
10
Years
  • Seen Nov 12, 2021
So...I can't use this without a second reference file. How would I associate Move names -> Move IDs (which is needed to make the table)? I'd first have to generate my file for my #defines for moves, then use that to replace the move names here before finally converting. I was looking for something more like this:


Thanks though :o

Can't you just #include move.h ?
 

Blah

Free supporter
1,924
Posts
11
Years
Dunno what list he'll be using then, was going to do it in alphabetical order using Pokemondb.net list of attacks in Pokemon.

I do have some questions. Could you tell me where to find the hex values for move types? Like in your Pound example, 0x00 = normal. Also, I get the Bitfield to binary but how did you calculate Bitfield, I don't know what that is.

Edit: Forget that bit field, I think I know how to work it out. I'll explain when I give you my first example.

Umm, I don't mean to offend you, but I'm not sure that you know enough to help out just yet. I wouldn't be confident using the stuff you made if I knew you didn't know the basic data types.

Maybe something easier will pop up for you to do. I've explained all your questions in that conversation I linked you previously.

I modified the pokemon.h file with the forms added, and I intend to do the megas soon after :)

Great! I noticed someone forked the repo, I guess that was you? Will wait along for a PR later :D

Can't you just #include move.h ?
Nope, I'm writing all the file generation programs in Python, not C. While I could try doing it in C, I'm unfamiliar with the string regex libraries C uses (and honestly I'd much rather keep it using this system). I could use Shell script/bash but I have a feeling most people here don't have that on their machines.
 

GOLDstandard

Eclectic
51
Posts
10
Years
Great! I noticed someone forked the repo, I guess that was you? Will wait along for a PR later :D

I have never used github before so...
What does that even mean? All I tried to do was submit an edit to the repo online. Is that what a fork is? Also, what is a PR? hahaha, sorry for the questions

Edit: added megas
 
Last edited:

PokemonBen

Kanto Champion
60
Posts
8
Years
  • Age 24
  • Seen Apr 27, 2020
Umm, I don't mean to offend you, but I'm not sure that you know enough to help out just yet. I wouldn't be confident using the stuff you made if I knew you didn't know the basic data types.

Maybe something easier will pop up for you to do. I've explained all your questions in that conversation I linked you previously.
Well that's a shame but I understand.
 
794
Posts
10
Years
This is amazing FBI. I can't wait to see an usable version of this. I'd also gladly help with tables. Though, I have some questions.

Read if you have time but don't know C or ASM & are interested in helping:
Spoiler:

I read your linked conversation with BluRose but there are still some things that aren't clear to me. Let's say I want to do Acid Amror.

Spoiler:
 

PokemonBen

Kanto Champion
60
Posts
8
Years
  • Age 24
  • Seen Apr 27, 2020
This is amazing FBI. I can't wait to see an usable version of this. I'd also gladly help with tables. Though, I have some questions.



I read your linked conversation with BluRose but there are still some things that aren't clear to me. Let's say I want to do Acid Amror.

Spoiler:

He has a new system called Bitfield where you do not need to do u8 contact ect. This is mine for Acid Amor before he told me to stop: Link I don't even know if I am doing it right, as I never actually showed him.
 

Blah

Free supporter
1,924
Posts
11
Years
This is amazing FBI. I can't wait to see an usable version of this. I'd also gladly help with tables. Though, I have some questions.



I read your linked conversation with BluRose but there are still some things that aren't clear to me. Let's say I want to do Acid Amror.

Spoiler:

Either is fine. It just has to be in a static format so I can write a program to generate the table :)
 

Blah

Free supporter
1,924
Posts
11
Years
This is amazing FBI. I can't wait to see an usable version of this. I'd also gladly help with tables. Though, I have some questions.



I read your linked conversation with BluRose but there are still some things that aren't clear to me. Let's say I want to do Acid Amror.

Spoiler:

Either is fine. It just has to be in a static format so I can write a program to generate the table. Have effect accuracy == move accuracy in your table, and priorities are just 0, 1, 2, 3, 4 (I don't know if there is a move with +4 priority, fakeout maybe?). Recall that there are also negative priority moves as well. For the u8 is_special section, use 0x3 for status move.
 

BluRose

blu rass
811
Posts
9
Years
Spoiler:
I don't believe FBI answered the "this and accuracy" question, only really saying that it should be equal in the case of Acid Armor, which is true.
"Effect Accuracy" is going to be the chance of the secondary effect happening. It should be 0 for Acid Armor because Acid Armor doesn't have a secondary effect. For example, Aurora Beam--a move with a 10% chance of lowering attack--has a table that should look something like this (correct me if I'm wrong, someone):
Code:
struct move_table {
    u8 script_id; 0x00
    u8 base_power; 0x41
    u8 type; 0x0F //I don't have a tool with me so going off of memmory here for ice type
    u8 accuracy; 0x64
    u8 PP; 0x14
    u8 effect_accuracy; 0x0A //10% chance of lowering attack
    u8 affected_targets; 0x00
    u8 priority; 0x0
    u8 contact : 0;
    u8 protect : 1;
    u8 magic_coat : 0;
    u8 snatch : 0;
    u8 mirror_move : 1;
    u8 kings_2,k : 1;
    u8 crit_chance : 0;
    u8 padding_field : 0;
    u8 is_special; 0x1
    u16 move_id; 0x3E //again, no tool, going off of memory here
};

And, also, Gen 3 Tools has a Move Editor which has the full list of priorities~ One thing that sticks out in my mind is that the lower priorities are the highest values...
And, the "padding_field" is just filler to make the bitfield 8 bits, right?
 
Last edited:
794
Posts
10
Years
Either is fine. It just has to be in a static format so I can write a program to generate the table. Have effect accuracy == move accuracy in your table, and priorities are just 0, 1, 2, 3, 4 (I don't know if there is a move with +4 priority, fakeout maybe?). Recall that there are also negative priority moves as well. For the u8 is_special section, use 0x3 for status move.

Got it. One more thing. Bluerose explained the difference between accuracy and "effect_accuracy" which is the chance of the secondary effect happening. Though, how will you know which effect to apply? In vanilla games, there is one more byte responsible for the effect, for example 0x11 nay be the chance of paralyzing and 0x12 the chance of poisoning.
 

BluRose

blu rass
811
Posts
9
Years
Got it. One more thing. Bluerose explained the difference between accuracy and "effect_accuracy" which is the chance of the secondary effect happening. Though, how will you know which effect to apply? In vanilla games, there is one more byte responsible for the effect, for example 0x11 nay be the chance of paralyzing and 0x12 the chance of poisoning.

That would be the "script_id", likely referring to the Battle Script. However, he told me (and then linked to all) to leave that field "empty" (0x0) for all moves.
I don't know, but I'll bet that FBI wants to entirely redo the effects and such so that we might be able to add more effects later on (from the OP: "It'd mean that battle scripting is also not going to be needed for Fire Red hacking, as you can just add to the source.")
We'll probably have to go through all of these moves and then add on the Script ID later or something. Or maybe he's going to have the effects set in stone by their IDs and controlled by some code elsewhere? I don't know, haha...

Two other things:
http://bulbapedia.bulbagarden.net/wiki/Move_data_structure_in_Generation_III
And one other thing to keep in mind is that we'll have to fix a few of the bugs in the original games (one that comes to mind is that the charging turn for Focus Punch has a higher priority than switching out, which can cause your Pokémon to use it before switching out in a Double Battle).
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Kleenexfeu has just told me about this, and I am definitely interested in helping or getting involved - especially since I need a battle engine myself and it makes sense to have the same battle engine at the core of my engine and your FireRed proposal.

I can worry about porting it to C++ and to match with my engine, so I'm not worried about that.
 

Blah

Free supporter
1,924
Posts
11
Years
I don't believe FBI answered the "this and accuracy" question, only really saying that it should be equal in the case of Acid Armor, which is true.
"Effect Accuracy" is going to be the chance of the secondary effect happening. It should be 0 for Acid Armor because Acid Armor doesn't have a secondary effect. For example, Aurora Beam--a move with a 10% chance of lowering attack--has a table that should look something like this (correct me if I'm wrong, someone):
Code:
struct move_table {
    u8 script_id; 0x00
    u8 base_power; 0x41
    u8 type; 0x0F //I don't have a tool with me so going off of memmory here for ice type
    u8 accuracy; 0x64
    u8 PP; 0x14
    u8 effect_accuracy; 0x0A //10% chance of lowering attack
    u8 affected_targets; 0x00
    u8 priority; 0x0
    u8 contact : 0;
    u8 protect : 1;
    u8 magic_coat : 0;
    u8 snatch : 0;
    u8 mirror_move : 1;
    u8 kings_2,k : 1;
    u8 crit_chance : 0;
    u8 padding_field : 0;
    u8 is_special; 0x1
    u16 move_id; 0x3E //again, no tool, going off of memory here
};

And, also, Gen 3 Tools has a Move Editor which has the full list of priorities~ One thing that sticks out in my mind is that the lower priorities are the highest values...
And, the "padding_field" is just filler to make the bitfield 8 bits, right?
Yeah, padding is just padding. As for negative priorities, can you post a table for a negative move? I might have to change some fields to be signed depending on the values. Thanks for clarifying the accuracy thing btw.

Got it. One more thing. Bluerose explained the difference between accuracy and "effect_accuracy" which is the chance of the secondary effect happening. Though, how will you know which effect to apply? In vanilla games, there is one more byte responsible for the effect, for example 0x11 nay be the chance of paralyzing and 0x12 the chance of poisoning.
Doesn't even matter. That'd be done in the move specific battle script. I don't think you can change say, that thunder applies paralysis in a tool can you? If the answer is no, the we'll just put it into the move script.

Just saw this. FBI, I had no idea you were capable of all this stuff. Sounds exciting though and can't wait to see how it turns out. 8)
Thanks :D

That would be the "script_id", likely referring to the Battle Script. However, he told me (and then linked to all) to leave that field "empty" (0x0) for all moves.
I don't know, but I'll bet that FBI wants to entirely redo the effects and such so that we might be able to add more effects later on (from the OP: "It'd mean that battle scripting is also not going to be needed for Fire Red hacking, as you can just add to the source.")
We'll probably have to go through all of these moves and then add on the Script ID later or something. Or maybe he's going to have the effects set in stone by their IDs and controlled by some code elsewhere? I don't know, haha...

Two other things:
http://bulbapedia.bulbagarden.net/wiki/Move_data_structure_in_Generation_III
And one other thing to keep in mind is that we'll have to fix a few of the bugs in the original games (one that comes to mind is that the charging turn for Focus Punch has a higher priority than switching out, which can cause your Pokémon to use it before switching out in a Double Battle).

This is kind of a design issue I've been tinkering with. I'm unsure if I should make a dual task based system, or an invested callbacks system :/

This is sort of what I'm looking at:
Code:
Setup (task):
	- Graphics set up BGs
	- Object sliding
	- Battle_init -> set map load/exit callbacks/structs for battle
	- del(setup)

Battle (task):
	- Turn counter ++
	- Trainer was challenged/run send out anims for each side (BS)
	- player pick move to use
	- AIs pick move to use
	- execute moves -> Run "battle script" tasks for move
	- update battle field
	- check battle is over -> end (captured, frontier mode loss, dex, money, revert forms, ect)
	- give exp, learn move, evolve checks
	Back to turn counter ++

Battle End:
	- free resources
	- exit to map

In doing it this way, we need to exit to the main loop to update things, so you'll need a dual task-system. One for the entire "loop" and another for the battle script. I've left out a lot of detail in this pseudo frame, just to keep it simple.

So there won't be classic BS commands, and I don't think existing BS commands would be compatible since the RAM data structures are completely different and some of the ROM tables have been reworked as well. In any case, I imagine making a library of functions and in the BS you just call a series of them for the behavior you want. I'll be extracting a lot of the resources from the default game in regards to this.

We'll probably have to go through all of these moves and then add on the Script ID later or something.
Yeah, since we haven't made a move script table yet, nor have we started to. If someone wanted to go ahead and do that, you can :/

Kleenexfeu has just told me about this, and I am definitely interested in helping or getting involved - especially since I need a battle engine myself and it makes sense to have the same battle engine at the core of my engine and your FireRed proposal.

I can worry about porting it to C++ and to match with my engine, so I'm not worried about that.

Hey Jambo! I look forward to your contributions :D


---

I apologize for the lack of updates these past couple of days. I've been hooked into watching shows, but I marathon-ed them all , so I'll get back to work shortly. There are some unpushed changes which I'll get to pusing as well.
 

BluRose

blu rass
811
Posts
9
Years
Yeah, padding is just padding. As for negative priorities, can you post a table for a negative move? I might have to change some fields to be signed depending on the values. Thanks for clarifying the accuracy thing btw.

Doesn't even matter. That'd be done in the move specific battle script. I don't think you can change say, that thunder applies paralysis in a tool can you? If the answer is no, the we'll just put it into the move script.
Spoiler:

So there won't be classic BS commands, and I don't think existing BS commands would be compatible since the RAM data structures are completely different and some of the ROM tables have been reworked as well. In any case, I imagine making a library of functions and in the BS you just call a series of them for the behavior you want. I'll be extracting a lot of the resources from the default game in regards to this.

Yeah, since we haven't made a move script table yet, nor have we started to. If someone wanted to go ahead and do that, you can :/
Spoiler:
Well, here's one for Vital Throw:
Spoiler:

We can change that Thunder applies paralysis in a tool, but it's via changing its move script. For example, both Thunder and Thunderbolt have the same move script, and that is to apply Paralysis to the target and then be directed to the normal damage. Ice Beam and Blizzard do, too, except Blizzard has to be modified to Gen IV and above standards, which state that Blizzard has 100% accuracy while Hailing.

*misses BSP already*

DizzyEgg and I are working on the python Move Scripts but have not begun on tables.
What do you mean by the Move Script Table, then? Just a bunch of values that correspond to a script that does a certain thing (for example, -Accuracy Script, +Attack Script, Paralysis Chance Script, etc.)?

EDIT: ACTUALLY, Thunder has its own specific move script which tells us that, if raining, then the accuracy is 100%. Then it goes to the Paralysis one which goes to the damaging one. But Blizzard does actually have the exact same effect as Ice Beam in Generation III.

EDIT EDIT: Also, are you going to make it so that a value of 0x0 for accuracy never misses, like in Vanilla? Or should we just make it 0xFF to make it simpler?

EDIT EDIT EDIT: Lastly, do we want to use the padding byte in the bitfield to account for Brightpowder? The only reason I ask is that only a little over half (~11:8 ratio) of the moves are affected by Brightpowder (at least, in Generation III, I have no idea about VI). Bulbapedia states, however, along with Smogon, that Brightpowder just increases Evasiveness in total by 10%, so I really don't know.

FINAL EDIT: First batch of 51 move bytes from the end (Psycho Boost):
These do not account for possible changes to the padding at the end of the bitfield based off of Brightpowder.
Spoiler:
 
Last edited:

Blah

Free supporter
1,924
Posts
11
Years
I are working on the python Move Scripts but have not begun on tables.
What do you mean by the Move Script Table, then? Just a bunch of values that correspond to a script that does a certain thing (for example, -Accuracy Script, +Attack Script, Paralysis Chance Script, etc.)?

Firstly, I'd like to let you know I got 12 notifications from this post, lol.
What do you mean Python move scripts? Python is only used for generating the tables and #define files ect. I'm not using python for anything beyond building, inserting and generation! As for what I mean by move script table, is it's a table of move commands/functions.

Code:
Move table format in ROM:
[4 byte func ptr][4 byte func ptr][4 byte func ptr] ...
The script_id field is a number which associates to an element in the aforementioned table.
Moves with 0x0 as the script ID = no effect. The effect will be a standard portion of code which is run, all that does is run the damage calculator using the move power (will not consider secondary effects outside of ability). If it's not 0x0, then a custom script will be run based on the number. All status moves, and moves with secondary effects would call the function with ID = 0, plus some other effects. Easy, right?

EDIT EDIT: Also, are you going to make it so that a value of 0x0 for accuracy never misses, like in Vanilla? Or should we just make it 0xFF to make it simpler?
It doesn't really matter, but lets make it higher than 0. Since [0-100] is the normal bounds of a move's chance to hit, it makes logical sense for a move to never miss to have an accuracy value outside that scope. I would just use if accuracy > 100. So anything over 100 is fine.

EDIT EDIT EDIT: Lastly, do we want to use the padding byte in the bitfield to account for Brightpowder? The only reason I ask is that only a little over half (~11:8 ratio) of the moves are affected by Brightpowder (at least, in Generation III, I have no idea about VI). Bulbapedia states, however, along with Smogon, that Brightpowder just increases Evasiveness in total by 10%, so I really don't know.

Sure. Use the padding as you want, it's just padding. Let me know of any changes you make to the move struct though (you can add more fields if you wish, once again let me know!).
 

PokemonBen

Kanto Champion
60
Posts
8
Years
  • Age 24
  • Seen Apr 27, 2020
Okay, this seems a lot more complicated then what I thought you wanted people to do. No wonder I was getting confused.

Wish I could help, but learning C# on Youtube means info goes in one ear and out the other.
 

BluRose

blu rass
811
Posts
9
Years
Firstly, I'd like to let you know I got 12 notifications from this post, lol.
What do you mean Python move scripts? Python is only used for generating the tables and #define files ect. I'm not using python for anything beyond building, inserting and generation! As for what I mean by move script table, is it's a table of move commands/functions.

Code:
Move table format in ROM:
[4 byte func ptr][4 byte func ptr][4 byte func ptr] ...
The script_id field is a number which associates to an element in the aforementioned table.
Moves with 0x0 as the script ID = no effect. The effect will be a standard portion of code which is run, all that does is run the damage calculator using the move power (will not consider secondary effects outside of ability). If it's not 0x0, then a custom script will be run based on the number. All status moves, and moves with secondary effects would call the function with ID = 0, plus some other effects. Easy, right?

It doesn't really matter, but lets make it higher than 0. Since [0-100] is the normal bounds of a move's chance to hit, it makes logical sense for a move to never miss to have an accuracy value outside that scope. I would just use if accuracy > 100. So anything over 100 is fine.

Sure. Use the padding as you want, it's just padding. Let me know of any changes you make to the move struct though (you can add more fields if you wish, once again let me know!).
Oh, really? I'll try to edit less, then...
*never uses programming jargon again*
Okay, then...
Either way, the big block of 51 moves should be good, even if I use the wrong terminology to describe it.

Just like vanilla, no? In which a script ID of 0 just makes it use a move that calculates the damage and then applies it to the opponent, and then everything else has a different effect. Do we want to rewrite the AI or do we want to keep to the original move script table?

The thing then comes to mind would then be if you are going to make programming exceptions due to the accuracy above 100--for example, would it display in the Summary as, say 255 Accuracy instead of the hyphen that is usually present? And, eventually, would it be able to miss due to enough Sand-Attacks (.25 modifier (I believe 6 Sand-Attacks) makes a base of 255% accuracy down to 63.75% accuracy, less reliable than Focus Blast)?

I'm so sorry for these questions, by the way, and thanks for answering all of them thus far...
 
794
Posts
10
Years
EDIT EDIT EDIT: Lastly, do we want to use the padding byte in the bitfield to account for Brightpowder? The only reason I ask is that only a little over half (~11:8 ratio) of the moves are affected by Brightpowder (at least, in Generation III, I have no idea about VI). Bulbapedia states, however, along with Smogon, that Brightpowder just increases Evasiveness in total by 10%, so I really don't know.

FINAL EDIT: First batch of 51 move bytes from the end (Psycho Boost):
These do not account for possible changes to the padding at the end of the bitfield based off of Brightpowder.
Look at Doom Desire, third byte.
Spoiler:

I don't think we should use padding to account for brightpowder as its effect is now different than it was in gen III. Currently, it boosts evasion of the holder by 10%.

Also, for anyone who wants to help with the move table. Me and BluRose are working on moves from genI,II and III, so starting from IV might be a good idea. And please keep the same format as BluRose.
 
Last edited:

BluRose

blu rass
811
Posts
9
Years
I don't we should use padding to account for brightpowder as its effect is now different than it was in gen III. Currently, it boosts evasion of the holder by 10%.

Also, for anyone who wants to help with the move table. Me and BluRose are working on moves from genI,II and III, so starting from IV might be a good idea. And please keep the same format as BluRose.

Got it~

Format referred to:
Spoiler:
If you have any questions, feel free to post them (or you can just VM/PM me if you'd like). (Granted, FBI might want to confirm this; I'm not the owner of the thread, haha).

Update on moves: I just have my 52 while DizzyEgg has 200 of them done :P
He told me to do the rest, so that means that I have about 102 more to go, all of which I can do after homework and such but will likely not get them done (tonight, we have this youth group-esque thing that goes from 6:00 to 9:00), so I'll see what I can do.

EDIT: Got my section done~

Spoiler:
I checked every single one of my moves against the list on veekun for being affected by Mirror Move or this list for those with a high critical hit ratio. Also, I had 1 move that had a never miss effect--Magical Leaf. I made it have 255 accuracy, don't know how you're going to handle it, FBI...
If problems come up, just say!
Now, I'm going to end up making two script effect tables. The way he told me to make them would be the same way that Vanilla does: With a pointer leading to a Battle Script signifying each. However, if what FBI said about RAM allocations being different is really true and most of the Battle Scripts are useless under this system, how are we to do this, then?
Should we have a whole new effects possible table?

And, lastly, sorry for the amount of notifications you've probably received, DizzyEgg...
 
Last edited:
Back
Top