Author Topic: Keeping everyone in shadow party  (Read 9185 times)

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #15 on: July 23, 2014, 05:13:19 PM »
So I've got shadow storage complete. That's the easy part. I'm sort of tackling things in order, so next up is awarding experience to shadowed party members. This will be a two-part process - rewriting the experience awarding routine to store experience awards in the right places, as well as rewriting the level-up routine to ignore shadow data (TNL is not stored, and leveling up will instead occur when a character is loaded FROM the shadow). I expect this to be a relatively quick process, but the character loading sequence (from the shadow) will be a massive rewrite.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Keeping everyone in shadow party
« Reply #16 on: July 23, 2014, 08:38:32 PM »
Yes, quite so. But you've worked this part out quite quickly on its own! Keep up the fantastic work!

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #17 on: July 24, 2014, 04:58:35 AM »
Great work! This is so exciting!

Since we're at it, I always thought it was a little cheezy that everyone in the shadow party gets the full EXP, allowing a solo character to basically turbo-level everyone at once, as well as being a little silly to think that the people out fighting are levelling up just as quickly as the people in reserve. Maybe it could be divided by something? Or maybe make it customizable... multiply by X and divide by Y where X and Y default to 1 but you can give the addresses so that the person applying the patch can customize the ratio as he or she sees fit? Anyway I don't mean to add unnecessary complication, just indulging in a little wishful thinking since that part of the code is being rewritten anyway.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #18 on: July 24, 2014, 07:29:58 AM »
That occurred to me too, Pinkpuff, but I had intended on ignoring it and hoping nobody else noticed  :blush:
The part of the code I need to change might not be anywhere near the part that assesses the total exp and divides it by active party members, so I don't know how easy or difficult that may be to find. Once found, I don't know how easy it will be to manipulate.
My guess is, the original program probably looks at the data at 7E:405F in RAM - this is a series of 01s and 00s, one per character slot including shadow, that the game looks at in order to determine who GETS experience. Trouble is, I don't know how feasible it is to extend this by eleven bytes to begin with, then once expanded if possible, how feasible it is to make this edited range the new EXP divisor.
Obviously now that you've mentioned it I'll be looking into it, but I just don't wanna make any promises yet that I can do anything about it.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #19 on: July 24, 2014, 09:59:45 AM »
Well, long story short, this is where the EXP divisor comes from:
Code: [Select]
$13/FF5F A6 AB       LDX $AB    [$00:00AB]   A:0082 X:0000 ;load # active party into X
$13/FF61 DA          PHX                     A:0082 X:0002 ;store for use as EXP divisor
I don't know how 00AB becomes the counter for active party members, but it doesn't really matter.
Here's what I'm gonna do:
After this value is loaded into X, I'm going to have the game look into each shadow party slot. If it shows there is a character being stored there, it will increase X by one.
So, EXP will be divided by all active (living and not stone) party members plus all characters stored in the shadow, then awarded to each of those characters.
I don't want to skip the exp award for the shadow party entirely, because think about when Rydia rejoins. If she's level 15 and she comes in to save a near death Cecil and crew, she'll do little good. She of all characters needs to be gaining experience while in the shadow.
So, anyway, that's the plan.

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #20 on: July 24, 2014, 10:10:28 AM »
Sorry, it didn't even occur to me that it would be in an entirely different part of the code (not sure why though, that does make sense).

So wait... does this mean the people in the normal party will also get less EXP the more people are in shadow? If so, maybe it should be a separate (but compatible) patch? After all, that would still mean that people in shadow progress at the same rate as those in the acutal party, but the rate itself is slower.
Let's dance!

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #21 on: July 24, 2014, 10:44:06 AM »
Right.

I can't really think of a better way to go about it. The way I see it, the options are:
1) Divide by active party, award to all of active party and shadow
2) Divide by active party, award to active party only
3) Divide by active party plus shadow, award to active party and shadow

It's simply not a reasonable expectation to divide by active party, then award to active party, then divide again by shadow, then award to shadow. That's too much of a deviation from how the game normally awards EXP.

Anyway, it's in there now (option 3), and it's working as intended. The whole divisor change is a jump to a separate, entirely custom line of code. To avoid it would only require changing three bytes (13/FF5F-13/FF61). Once the whole patch is done, I can release a patch in tandem that allows the user to bypass that entirely, effectively giving you the choice of divisor accounting for shadow party or not.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Keeping everyone in shadow party
« Reply #22 on: July 24, 2014, 12:47:54 PM »
Terrific! This was a clever way to go about it. Balancing Exp. for the foes to compensate 10... oh wait... would it eventually compensate 21 characters? That... could be a little bit of trouble balancing accordingly, eh heh.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #23 on: July 24, 2014, 02:57:16 PM »
Well... 13, with a maximum of 15 if someone ever successfully got both Golbez and Anna working. A character will either be counted in the shadow or in the main party, or not at all (if they haven't joined yet). Never in both places. Also this hack will assume child Rydia and Teen Rydia ARE the same person, so they share shadow data (though you will be able to go back to child Rydia but keep her stats).

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #24 on: July 24, 2014, 07:00:20 PM »
(though you will be able to go back to child Rydia but keep her stats).

Forgive the tangent, but this reminded me of an experience I had back in the early days, before rom hacking was a thing (or at least, if it was, then it was nothing like what it is now) and people were messing around with the game genie to get different effects similar to what we're doing now with the editor (changing people's battle commands, accessing all the "dummy"/hidden items etc). Anyway there was this one code someone found that completely reset all the plot flags, but left everything else the way it was. So for example, lets say you get to near the end of the game and save. You apply this code and then load up your save. Now you go to Mist. Boom, package opens, Mist re-burns-down, Kain leaves, and now you have a second Rydia, child version, who mysteriously now has Cure 2 in her white magic list (I know why that is now but at the time it was very mysterious and intriguing). She even has all the advanced summons (kind of amusing seeing little girl summon big ol' Bahamut and Odin). I can't remember off hand if she had all the advanced levels and stats of the older version or if they reset but anyway it was an incredibly fun code and messing with it and others like it was part of what drew me to hacking this game.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Keeping everyone in shadow party
« Reply #25 on: July 24, 2014, 09:44:06 PM »
The only difference between Child Rydia and Teen Rydia is the sprite, everything else about them (except for White Magic) is the same.

What got me into hacking FFIV was trying to get W. Meteo to trigger in that it was using the "change character" codes until eventually you were able to get FuSoYa with the Twin command and then you were able to use W. Meteo as you pleased. I always loved the idea of W. Meteo (because as a kid I thought it meant White Meteo, a combination of the most powerful White Magic and Black Magic, I'm still disillusioned that it means Double Meteo, heh). What drew me to here was just the basic knowledge of wanting to learn more about FFIV, I never dreamed at the start that I'd be fully understanding the innards of much of the game's system and being able to alter them as I willed.

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #26 on: July 24, 2014, 10:27:56 PM »
I'm guessing that child Rydia #2 started from original stats, since the original programming of the game only has a "child Rydia" who loads initial stats (and likewise only has a "teen Rydia" who loads shadow stats), but of course they use the same spell sets.

For me, FFIIUS was the first game I ever *loved*. Back in the early days of console gaming, my favorite games were always the ones that encouraged me to play for hours, days, weeks, &c. I guess Zelda and Zelda II were always my favorite, though I spent quite a while on Dragon Warrior, too. But when I played FFII (I never even had FFI as a kid), it was like a revolution and I was instantly hooked.
In the late 90s I played quite a bit of FFVI with Game Genie - loved giving Celes Shock instead of crappy Runic - but was always disappointed with how much fewer codes like that were available for FFIV. I dabbled in cosmetic hacks for NES ROMs, but doing that kind of stuff with SNES seemed out of reach. I didn't discover that it had become possible until about 2011, with Euclid's Link to the Past hack, at which point I almost instantly decided that this was something I NEEDED to learn how to do with FFVI.

Anyway, yeah, that was a tangent... I've planned out what needs to change in the EXP awarding and level-up routines. About to implement the changes and then test it out. Barring any unforeseen disasters, that will leave only the character loading processes (again, the biggest part of all of this, with the most things that might go wrong)!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #27 on: July 25, 2014, 10:31:45 PM »
Oh how quickly days become weeks and then months... :isuck:

To not go on-and-on I will cut to the chase. I recently picked up (and finished!!) my revised TNL Experience formula. The goal there was to calculate the TNL values based on as few stored values as possible and without having to square or cube numbers.  I just posted what I came up:

http://slickproductions.org/forum/index.php?topic=1911.msg21000#msg21000

I'm sorry I was away so long; but let me say going through all the posts here and seeing the three of you still banded and kicking ass - it brings quite the smile to my face. Keep up the good work, everyone!  :childish:
"Now I know; and knowing makes it even more confusing..."

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #28 on: July 26, 2014, 05:17:24 PM »
So I'm getting close to where I can start planning how the loading routine will work - after how quickly all the rest of this went, that's kind of disappointing to say, but what can ya do?

The way it's going to work is this:
There will only be 14 actors - DkC, Kain, CRy, Tellah, Ed, Rosa, Yang, Pal, Por, PC, Cid, TRy, Edge, FuSoYa - but there will be room for Golbez and Anna if anyone ever figures out how to make them fully functional. That is to say, there is no Kain 2, Tellah 2, etc.
When an event instructs the game to load an actor, the game will first look into the Shadow to see if the character is being stored there (every character has his or her own slot). If there is no shadow data for that actor, then the game will run the initial stat loading routine (which will be essentially unchanged).
If there IS relevant Shadow data, then the game will load that, then will load the five character-dependent stat bytes (ID, job, crit%, crit bonus, steal evade) from a custom table. Then the game will run the level-up routine, since exp is stored in the shadow but level gains are not performed there.
 :edit: Rydia will be the exception to the process. Teen Rydia will load only from the Shadow (has no initial stats), but will have a unique entry in the five-byte table. Child Rydia will load either from intial stats or the shadow, like any other character would, but it would only be wise to load one or the other at a time. If Teen Rydia is in the party, and Child Rydia is added, then Child Rydia will load from initial stats (because Teen's load would have cleared the shadow). In that case, if Teen is removed from the party, her stats wouldbe stored in teh shadow. If Child was removed from the party after that (but before Teen was loaded back in), then Child's (presumably lower) stats would overwrite Teen's shadowed stats... does that make sense?
That should work. Although TNLs don't work exactly as I thought, I don't think, so I might have to throw in some extra calculations. I keep saying I'll cross that bridge when I come to it...
« Last Edit: July 26, 2014, 05:57:46 PM by chillyfeez »

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #29 on: July 26, 2014, 08:12:18 PM »
Although TNLs don't work exactly as I thought, I don't think, so I might have to throw in some extra calculations. I keep saying I'll cross that bridge when I come to it...

Yeah - the native TNL coding certainly isn't doing anyone any favors; on that I think we can all agree.  :wink:

But what you have sketched out sounds great; the freedom to add/drop any character any time would be a dream come true. I too got started with the character change codes via game genie: good memories.  :happy: - I'd never have thought there were others in the world just as curious and passionate about FF4. My only problem was the overuse of hypnosis... if you are going to reuse plot elements you have to hide it better; but maybe someday I'll put my money where my mouth is  :wink:
"Now I know; and knowing makes it even more confusing..."