øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1993.msg22114e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0860.htmldelayedslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1993.45e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0860.html.zxá,g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ…¬OOKtext/htmlISO-8859-1gzip@øÕOÿÿÿÿÿÿÿÿÑHTue, 10 Mar 2020 06:16:24 GMT0ó°° ®0®P®€§²ð®à,g^ÿÿÿÿÿÿÿÿ6/O Final Fantasy IV: Side Project (Random AI Routine complete!)

Author Topic: Final Fantasy IV: Side Project (Random AI Routine complete!)  (Read 10577 times)

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #45 on: January 03, 2015, 08:59:42 PM »
Yeah. That should be doable.
Let's see... Did I post the disasembly for that mod...?

 :edit:
I did, but... Which stat are you talking about specifically?
It looks like, in the commented disassembly, I talked about adjusting magic defense base and magic defense multiplier, but not magic defense percentage (which is what I thought you were talking about).

Hmm... that is what I'm talking about. The percentage is what is being used, let me check something then...

Yes, I'm not sure why it happens, but the SwordRat's AI is supposed to be Magic Evasion 8% but that's only if its Level 6 against a Level 10 Party, at Level 7 its Magic Evasion goes down to 06 and askews the entire process.

 :edit: ...Oh. I see the problem now. I feel a bit stupid, like Really stupid for not noticing this. I accidentally tied Magic Evasion base to 24 which is Magic Defense all around!  instead of 34, and I tied Magic Defense to Right Hand Quantity, yikes!
« Last Edit: January 03, 2015, 09:06:51 PM by Grimoire LD »

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #46 on: January 03, 2015, 09:33:44 PM »
So... I don't need to fix anything?

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #47 on: January 03, 2015, 09:41:45 PM »
No, no everything's working fine now. I'm still surprised at myself that I misread My Own Notes!!! And wrote Magical Defense into the AI Setup and the Magical Evasion as Magical Defense, how positively careless of me.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #48 on: January 03, 2015, 11:03:55 PM »
No, no everything's working fine now. I'm still surprised at myself that I misread My Own Notes!!! And wrote Magical Defense into the AI Setup and the Magical Evasion as Magical Defense, how positively careless of me.

We all do that sometimes - especially me  :wink:  -- or should that be  :blush:

Either way, I just wanted to say: Holy **** this is quite the hack! I was trying to sit down and finally learn Assembly but this looks like so much fun...  :happy:  -- Assembly is hard...  :sad:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #49 on: January 03, 2015, 11:21:05 PM »
No, no everything's working fine now. I'm still surprised at myself that I misread My Own Notes!!! And wrote Magical Defense into the AI Setup and the Magical Evasion as Magical Defense, how positively careless of me.

We all do that sometimes - especially me  :wink:  -- or should that be  :blush:

Either way, I just wanted to say: Holy **** this is quite the hack! I was trying to sit down and finally learn Assembly but this looks like so much fun...  :happy:  -- Assembly is hard...  :sad:

Thanks! It is actually very simple, much simpler than I anticipated and if I really wanted to I could add AI patterns for every monster by going into the ROM data, to go beyond 99 instead of using FF4kster to get by the 99% limit on Magical Evasion. It was just a matter where to plug the hack in. As it stands though this hack is probably one of the most nonintrusive I've ever made and after this is released I wouldn't mind creating a separate patch for this hack alone.

I'm not mathematically inclined, but I'm good at record keeping (as observed with my topic) and I use that constant memorization in place of mathematical skills in this case, but you are mathematically inclined, so SNES ASM should come pretty easily to someone that excels in logic.

ASM is a lot of fun though, it really makes you stop saying "Man I wish I could do That with FFIV..." and can make you say: "I'm Going to do That with FFIV!" Hence, Combat Boost on my side and Threat from Within (along with many other impressive hacks) from Chillyfeez's side. So it is well worth the time to pick up.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #50 on: January 04, 2015, 12:30:40 AM »
Yeah, LordGarmonde, you would probably pick up ASM pretty quickly, I'd think.

The thing is, SNES really is limited to so very few actual operations - all of my hacks put together probably only use about 17 different ops - acting on various registers and/or pieces of RAM.

The thing to remember is this: observable change happens when ROM affects RAM in a different way.
So...
1) decide on something you want the game to do differently
2) figure out how RAM needs to be different than normal in order to make this happen (often the hardest part - I've spent days at a time on this step)
3) change the code that normally affects that portion of RAM so that it does what you want instead.

I know, I know I make it sound so simple, ya?
That really is all there is to it, though.
It helps to have an idea for a hack in mind.
Start with something relatively small.
And bookmark this page:
http://wiki.superfamicom.org/snes/show/65816+Reference
It's an alphabetical list of all 255 SNES opcodes (and "42," which apparently does nothing - fitting for an ultimate answer to which there is no question, but I digress), plus a bit of a tutorial on how to use them (but the list is the part you'll come back to over and over again).

I also learned quite a bit about ASM in action just by studying Grimoire's command disassembly.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #51 on: January 04, 2015, 01:34:30 AM »
Thanks! It is actually very simple, much simpler than I anticipated and if I really wanted to I could add AI patterns for every monster by going into the ROM data, to go beyond 99 instead of using FF4kster to get by the 99% limit on Magical Evasion. It was just a matter where to plug the hack in. As it stands though this hack is probably one of the most nonintrusive I've ever made and after this is released I wouldn't mind creating a separate patch for this hack alone.

Agreed - I'd like to see that as well, but of course it's hard to play it safe with places to inject custom code without conflicts. I'm constantly amazed at everything you guys got not only to work but to work together!

Yeah, LordGarmonde, you would probably pick up ASM pretty quickly, I'd think.
I'm not mathematically inclined, but I'm good at record keeping (as observed with my topic) and I use that constant memorization in place of mathematical skills in this case, but you are mathematically inclined, so SNES ASM should come pretty easily to someone that excels in logic.
Thanks guys! :blush:  I will say it's kind of a double-edged sword. Sometimes I'm a little too logical and having bashed out so many calculations in C over the years really spoiled me. I have to remember now that to multiply two numbers I need to transfer them to the appropriate registers (in the proper order) and then wait. I compare it to sticking two things in a microwave and waiting for the ding!  :tongue:

ASM is a lot of fun though, it really makes you stop saying "Man I wish I could do That with FFIV..." and can make you say: "I'm Going to do That with FFIV!" Hence, Combat Boost on my side and Threat from Within (along with many other impressive hacks) from Chillyfeez's side. So it is well worth the time to pick up.

Yep - When someone asks me what makes this so much fun I just say: 1/2  the fun is figuring out how this game works -- 1/2 the fun fixing it and dreaming up new stuff, and then working it in -- and 1/2 the fun is playing around with all the other stuff that other people come up with that you'd never have thought of... that's why it's so much fun!

The thing is, SNES really is limited to so very few actual operations - all of my hacks put together probably only use about 17 different ops - acting on various registers and/or pieces of RAM.

The thing to remember is this: observable change happens when ROM affects RAM in a different way.
So...
1) decide on something you want the game to do differently
2) figure out how RAM needs to be different than normal in order to make this happen (often the hardest part - I've spent days at a time on this step)
3) change the code that normally affects that portion of RAM so that it does what you want instead.

I know, I know I make it sound so simple, ya?
That really is all there is to it, though.
It helps to have an idea for a hack in mind.
Start with something relatively small.
And bookmark this page:
http://wiki.superfamicom.org/snes/show/65816+Reference
It's an alphabetical list of all 255 SNES opcodes (and "42," which apparently does nothing - fitting for an ultimate answer to which there is no question, but I digress), plus a bit of a tutorial on how to use them (but the list is the part you'll come back to over and over again).

Yeah - Backwards-ass RAM logic will get ya every time - and me at least twice  :wink:   I've also been surfing around looking for various resources - and I hadn't settled on an opcode list - l have now:  bookmarked, chillyfeez approved

I also learned quite a bit about ASM in action just by studying Grimoire's command disassembly.

That's half of what makes me so eager to finally try and learn - that analysis is Amazing with a capital 'A'  -- the other half, of course, is what can be done with it: so many great hacks! :childish:
"Now I know; and knowing makes it even more confusing..."

Spooniest

  • Antlion
  • *
  • Posts: 59
  • Gender: Male
  • Coffee Warrior
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #52 on: January 04, 2015, 05:14:35 AM »
Uh, this concerns your Party Changing hack...

How do you handle the final scene? Do we just fade from Zeromus back to Cecil and start the Bridge Theme? Because that seems like a rather sharp edit to the story. Cecil doesn't die because of reasons? And the victory fanfare comes out of nowhere?

What did you do?
DID YOU ORDER THE CODE RED?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #53 on: January 04, 2015, 07:31:42 AM »
Uh, this concerns your Party Changing hack...

How do you handle the final scene? Do we just fade from Zeromus back to Cecil and start the Bridge Theme? Because that seems like a rather sharp edit to the story. Cecil doesn't die because of reasons? And the victory fanfare comes out of nowhere?

What did you do?

This is a concern I see a lot when people theorize about a hack like this. I don't see it as much of an issue to figure out. The battle sequence (in which the non present characters appear to heal the heroes) can easily be edited, to, say, only show the deceased characters. It's probably also entirely possible to alter which characters appear, though I haven't seen research on this yet (I'm sure we can figure that out if we put our minds to it).
As for the "map view" portion of the ending events: simple alterations would suffice - make the rest of the party not appear at all is an easy solution. For more complicated fixes, I've had success hacking in variable NPCs, so that can be done, too, using event flags (of which there are over 100 unused) that are set differently based on which characters are in the party.

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #54 on: January 04, 2015, 11:46:36 AM »
Thanks guys! :blush:  I will say it's kind of a double-edged sword. Sometimes I'm a little too logical and having bashed out so many calculations in C over the years really spoiled me. I have to remember now that to multiply two numbers I need to transfer them to the appropriate registers (in the proper order) and then wait. I compare it to sticking two things in a microwave and waiting for the ding!  :tongue:

If you've programmed in C, I think you're in great shape to learn assembly.  In C you are really thinking about how array buffers work and pointer arithmetic and such, all very good foundations to go deeper into the figurative rabbit hole that is assembly.  People who have only worked with C++ or Python (even though python is the best thing ever imo) might have a harder time thinking about registers and memory. 

Bonus if you often use a ton of global variables in C, often a bad idea in programming, since that's all this game does.  The hardest part about deciphering this assembly is not what the instructions are doing but what all the memory references are for without the variable names.

Quote
http://wiki.superfamicom.org/snes/show/65816+Reference
Just a heads up about that site is that while I was writing a disassembler for analyzing this game I noticed some errors on that wiki page.  One that comes to mind is rather important I think: the description for the SBC instructions says "Subtracts operand from the Accumulator; subtracts an additional 1 if carry is set" which is backwards.  It subtracts an extra 1 if the carry is CLEAR.

Just curious, does anyone know why they didn't use the stack for temporary variables?

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #55 on: January 04, 2015, 02:29:46 PM »
Just curious, does anyone know why they didn't use the stack for temporary variables?
... Isn't that the primary purpose of pushing and pulling the registers and the accumulator?

Quote
the description for the SBC instructions says "Subtracts operand from the Accumulator; subtracts an additional 1 if carry is set" which is backwards.  It subtracts an extra 1 if the carry is CLEAR.
Never noticed it said that. The opcode list is really what I was recommending there. In my experience, that part's accurate.

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #56 on: January 04, 2015, 06:08:36 PM »
Just curious, does anyone know why they didn't use the stack for temporary variables?
... Isn't that the primary purpose of pushing and pulling the registers and the accumulator?

Absolutely, with PHA, PLA.   But they only do that to save them momentarily, and all the other temporary storage is from some other memory.  They use a lot of temporary global variables.  Though granted it's hard to tell which of the global uses are truly temporaries.  I was more referring to instructions with stack-relative addressing, like "AND $#04,S", so you wouldn't need the global memory, and would probably make our deciphering easier since we know a stack-relative address like that is certainly a local variable which is only used inside that very routine, rather than wondering how many other routines might modify it before we can tell what it might be.  Same thing with memory used for parameters.  There is limited stack space though, so that could be part of it.  I also wonder if those instructions were not actually available on the SNES, but that's just speculation.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #57 on: January 04, 2015, 06:43:48 PM »
Well, it looks like the stack pointer can index parameters of an operation, but I don't really understand the practical use of that... But I don't have any programming experience, really, so that may just be my lack of experience.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #58 on: January 05, 2015, 05:08:00 PM »
Well, it looks like the stack pointer can index parameters of an operation, but I don't really understand the practical use of that... But I don't have any programming experience, really, so that may just be my lack of experience.

 :blits: I've got plenty of "experience" - but as I'm going along I'm realizing that most of the work I ended up doing on my own was in C++...back in the C days I had help ... bottom line I haven't worked in the stack either...other than on paper  :wink:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Final Fantasy IV: Side Project (Random AI Routine complete!)
« Reply #59 on: January 05, 2015, 09:22:18 PM »
Uh, this concerns your Party Changing hack...

How do you handle the final scene? Do we just fade from Zeromus back to Cecil and start the Bridge Theme? Because that seems like a rather sharp edit to the story. Cecil doesn't die because of reasons? And the victory fanfare comes out of nowhere?

What did you do?

This is a concern I see a lot when people theorize about a hack like this. I don't see it as much of an issue to figure out. The battle sequence (in which the non present characters appear to heal the heroes) can easily be edited, to, say, only show the deceased characters. It's probably also entirely possible to alter which characters appear, though I haven't seen research on this yet (I'm sure we can figure that out if we put our minds to it).
As for the "map view" portion of the ending events: simple alterations would suffice - make the rest of the party not appear at all is an easy solution. For more complicated fixes, I've had success hacking in variable NPCs, so that can be done, too, using event flags (of which there are over 100 unused) that are set differently based on which characters are in the party.

That's basically the answer I was looking for, thank you for the comment Spooniest but this patch is not meant to be a story patch by any means other than adding characters back, for your specific scenario since you can't have Golbez or FuSoYa in your party at this point even their little blurb would be enough to heal everyone back to full HP. It's more of an experiment really and so far the experiment is going well with some hiccups that I'll address.

It seems as if the Level-Up Patch is still affecting bosses and making the Mist Dragon into a fair joke, with nearly 4-6 turns for the party for every turn of the Mist Dragon the Mist Dragon goes down without even transforming.

There's no change I've made to my knowledge that could be causing that, do you have any thoughts on why that might be Chillyfeez?

 :edit: I can show you what I mean a little...

The Relative Speed of the unaltered Mist Dragon is supposed to be 0A.

The Relative Speed of the LevelUp Mod Mist Dragon (though bosses shouldn't be effected?) is 19 which is 2 1/2x slower than the Mist Dragon is normally, and they are using the same Speed Index, 5.
« Last Edit: January 05, 2015, 10:07:55 PM by Grimoire LD »