øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1873.msg21133e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3e33.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1940.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3e33.html.zx}g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ,/wDOKtext/htmlISO-8859-1gzip8:ÖwDÿÿÿÿÿÿÿÿTue, 10 Mar 2020 03:41:08 GMT0ó°° ®0®P®€§²ð®}g^ÿÿÿÿÿÿÿÿØ6wD Keeping everyone in shadow party

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

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #45 on: August 01, 2014, 04:29:32 AM »
now that I think about it, this makes perfect sense - it allows the game to use the same formula to find the level data for a specific level regardless of character:
(Current level - 1) * 5 + Character's Pointer + 0F/0000 = Level Data Offset

Nice work! Now I'm sorry I went to be so early - I missed all the action.  :lame:

In any event, these initial pointers do something with the TNL, even though in Dark Knight Cecil's case for instance they should start B528 if you null the first row of B4FB the game will assume that he has a much higher length to go to reach Level 11. Sorry, afraid that really wasn't much help.

It's still very interesting. I'm not exactly sure what's going on there, so now I want to look into it. The first value stored in the ROM for Dk.C is 931 which when subtracted from the in-game TNL of (3334) yields 2403. It would seem then that that initial value of 2403 is loaded at some point and then to it is added 931 to get 3334 as seen in-game.

I can see the sense in that - just like the level formula being offset to allow it to work for Lv 1 characters I'd think similarly this would be done so that TNL in-game can always be calculated by adding your last in-game TNL and the difference (in this case 931) which are stored in the ROM

That may be way more confusing than I thought it was coming out as. I'll come back to that. One question: Pinkpuff's editor seems consistent with what I just worked out in that in addition to the in-ROM TNL table starting at 931 she has values listed for Dk. C of:  Experience = 3000, and TNL = 2403  -- My question then would be when are those values called and where are they stored...

It came to me as I typed that:  http://rb.thundaga.com/tob/starting.txt   :tongue:  -- OK; I'm going after a formula for HP!


"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 #46 on: August 01, 2014, 11:21:13 AM »
Sorry, folks, more unexpected delays. Nothing major, but I've run out of time for today.

I'm this close, but the job I get paid for has to take precedence.
 :lame:

Sorry, I barely even gave myself enough time to write that message earlier. Just so everyone knows where I'm at - I've got the TNLs working properly (totally awesome), but as I was playtesting each character, I discovered that Edge doesn't follow the initial stats pattern that everyone else does. It's probably got something to do with Teen Rydia, and it's probably that I'm using the wrong character identifier to determine his initial stats location (like I should use actor instead of character, or vice versa, or whatever). Anyway I'm going to follow through initial stats loading to see what the game does by default, and probably just copy those steps, but if that proves to be unnecessarily complex, I can think of various other quick fixes for the problem...
« Last Edit: August 01, 2014, 05:31:39 PM by chillyfeez »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Keeping everyone in shadow party
« Reply #47 on: August 02, 2014, 10:33:36 AM »
Something to do with Teen Rydia? That would be strange, in any case. looks like we're nearly there, eh? I'll be gone for the next two days, but I'm looking forward to seeing the applications for this!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #48 on: August 02, 2014, 01:13:57 PM »
Teen Rydia - I've seen stranger things; I can sort of see that one - but I could be way-way off. I'd have thought she wouldn't have to mess with initial stat loading because of the her data already being shadowed. Could it be that Edge is designed to first appear mid fight - I know I first noticed that because he always joined at Lv 25 with 790 HP no matter where I was at. - Just a thought. That could also mess with Rydia since she comes in mid fight - but I guess so does Edward - idk

:hmm:  I'll keep that in mind as I'm pushing these numbers around

Also as a quick update I am expecting to settle on a formula for HP at some point today. I've dissectted it many way and I think I've settled on an approach. One thing that threw me for a while was the idea that maybe Cecil's HP as a Paladin isn't so high just because - but the fudged it so he wouldn't die facing himself in the mirror.

I'll note that Edge is a bit weird with HP anyway - his ranges aren't as routinely divisible as most others; and neither are Edward nor DkC - all introduced via combat...hmm more for me to keep in mind - but I'll be back with I've formula in hand.

in any case. looks like we're nearly there, eh?

It sure does! chilly is about about to blow this game wide open - I can't wait!  :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 #49 on: August 02, 2014, 02:35:15 PM »
Yeah, Teen Rydia.
Long story short, because most characters' initial stats are loaded using some index number that is rendered invalid by the way I've redistributed actors, I was using actor value  - 1 to index initial stats, but Teen Rydia's value is wedged between Edge and FuSoYa and everyone else.

New thing to fix, though: my workaround to skip overwriting stored equipment also skipped loading equipment for the initial load, so I have to rewrite that now... I don't wanna say it'll be done then, because how many times have I said that so far? But I'm gettin' there...

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #50 on: August 03, 2014, 09:21:24 PM »
*sigh*

New bug to fix...
For some reason, moving a character in and out of the party multiple times can cause unwarranted level-ups.
I think I know what's going on, but the fix will take some more time.
God, this is a helluva lot more complicated than I even expected originally. But I don't want to release anything buggy, or else what was the point in remaking the patch?
 :bah:

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #51 on: August 08, 2014, 03:26:58 PM »
OK, I'm still trying to get this to work.
I finally know why it's not working, and it's because I'm still not figuring TNL right.
Does anybody know exactly how the game interprets TNL data?
I know it uses the two bytes in the Level-up table, and adds them to the previous (3-byte) TNL for the character in question, but... it looks like it somehow determines (at a different point for each character?) to add an extra 01 to the highest TNL byte (that is, when 2 bytes becomes too small to represent the amount to add to the previous value, aka when adding more than 0xFFFF), then at level 70, it adds the two bytes to the upper two bytes instead of adding them to the lower two bytes. That's easy enough, but it's that middle step that I can't figure out.  How does the game know that it should start adding the extra 01 to the upper byte?
Anybody have any insight on this?
 :shadow:  :yabin:

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,285
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Keeping everyone in shadow party
« Reply #52 on: August 08, 2014, 05:38:37 PM »
Well, I think I figured out a way to account for this, though I'm SURE it's not how they intended, but I've watched the level up routine step-by-step, and I cannot for the life of me understand how it's making the determination.
If you look at level-up data - specifically the TNL bytes - you can see the places where the game would be adding an extra 01 to the upper byte, because the values look like:
DD86
EC8B
FC3A
0C97
So, I'll just tell the code to compare the current TNL value with the previous one, and if the current one is lower, I'll increase some place-holding RAM byte by 01, then add the value of that byte to the upper byte of TNL. Total pain in the ass, but it should work. And I'm operating under the assumption that once I get this fixed, I should be all done with this patch, though I won't rule out the possibility that I'm wrong about that.
This all would be so much easier if they had just figured out some workable formulas like LordGarmonde's trying to do.
Oh well, onward.

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Keeping everyone in shadow party
« Reply #53 on: August 08, 2014, 05:58:43 PM »
Ah good, you found a fix, I went searching a little but came up empty. Glad to see you've thought of a work around though.

Out of curiosity how Does the TNL work? Does it look at your current Exp. and see if it matches or is above it then loads the next TNL? Or does it look at things in a more dynamic fashion and go down as it tries to reach less than 000000 to reach the next level?

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #54 on: August 08, 2014, 06:12:42 PM »
Anybody have any insight on this?

Nothing at the moment more than a restatement of "You suck TNL routine!"

Also, Happy Birthday chillyfeez!  :happy:
"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 #55 on: August 08, 2014, 08:50:20 PM »
Also, Happy Birthday chillyfeez!  :happy:

Thanks! I was hoping, with a day off today, my birthday present to myself could be finally finishing this patch, but alas, alas...

Out of curiosity how Does the TNL work? Does it look at your current Exp. and see if it matches or is above it then loads the next TNL? Or does it look at things in a more dynamic fashion and go down as it tries to reach less than 000000 to reach the next level?

Well, more like the first choice there, but it's much more stupid than that. I don't know exactly how the game interprets the data, but this is how it all looks:
The TNL that appears in the character's current record is the value that current experience needed to be to achieve current level.
Upon level up, the TNL value from that level's data is added to the value currently in the TNL portion of the character's record.

SO... in order to determine if a character is supposed to level up, the game must look at the current TNL data, add the next level's TNL data to that, then compare the result to current exp. If current exp is equal or higher, the level and stats are increased.

For (a simple) example:
Rydia starts at level 1, at which point her exp and TNL are both 000000.
After acquiring 44 (2C) exp, she levels up to level 2, at which point her TNL reads 00002C.
Her TNL value for level 3 is 004C, so, add that to 00002C to get 000078 (120). That's how much exp she needs to get to level 3, and when she does, her TNL will read 000078.
I can easily, off the top of my head, devise a handful of less stupid ways they could have made this work, but whattaya gonna do?

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #56 on: August 08, 2014, 09:13:02 PM »
Thanks! I was hoping, with a day off today, my birthday present to myself could be finally finishing this patch, but alas, alas...

You figured it out!   :childish:   Way to go!  :cookie:   

I'm finishing up with attributes to which I think I'll include MP instead to do-away with individual checks. I would think I can take a similar approach to HP to likewise ditch the current Case-Select. So with your victory over TNL and the above we should be in good shape. As a bonus I can see using all of these as the basis for which new characters can be defined. But one thing at a time.
"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 #57 on: August 10, 2014, 03:00:15 PM »
It's alive!



IT'S ALIIIIIIVE!

*whew*
Ok, at long last, here it is!
Is it perfect?
No... there are a few oddities that will be discussed below.
Is it really cool?
Well, I think so, but judge for yourself.

First of all, what's attached:
-ShadowMod.ips - This is the Mod, and nothing else
-ShadowTest.ips - This is the same thing, except the town of Baron has Cid standing right at the entrance. Talk to him, and you will hear the "cure" sound, then open your menu and you will see Edge has been added to your party. Talk to Cid again and you'll here the "Thunder" sound, and Edge is gone - added to the shadow.
You can change which character is added/deleted from the party by editing the events in Ff4kster (the events changed here are "Behemoth Battle 51" and "Behemoth Battle 52"). The Mod is, for the most part, compatible with Ff4kster, but, beware that there are not as many Actors as there used to be, since adding and removing always adds and removes the same actor. This leads me to...
-actors.dat - replace the actors.dat config file in Ff4kster with this one in order to make sure you're adding/removing the right actors. Only the valid choices will appear as character's names, all other choices are marked "empty" and should be left alone.
Also, I say this is "compatible with Ff4kster," but this assertion is not fully tested. If I were you, I would avoid editing "Characters" or "Actors," as this mod does make specific references to those sets of data, and I don't know how changing them would affect how it all works (changing initial equipment should be safe, though).

Now, what else is important to say?

Ah, yes - This mod only implements the ability to smoothly add and remove all characters to and from the Shadow. I did NOT go through every event in the game and correct all instances of adding and removing characters. You'll have to do that yourself.

Once a character is first added to the party, s/he will continue to divide and receive experience thereafter. So, by the end of the game, all experience will be divided by 13 and every character will receive this amount, whether in the main party or not. Making a patch to undo this division among the shadow would be easy enough, making a patch to avoid awarding experience to the shadow party, not so much.

As mentioned previously, Child Rydia and Adult Rydia share the same shadow data. Adult Rydia will not load correctly unless Child Rydia has been added and removed at least once. Adding both to the party at the same time will cause confusion and/or glitches and is therefore not advisable.

Equipment is saved and loaded. So, when Adult Rydia comes back, for instance, she will be equipped with whatever Child Rydia had equipped when she was removed (instead of the whip and whatever else she normally comes with). The same goes for Kain, Rosa, &c... any character who normally did use the shadow and came back with new equipment, now will not.

Finally, and this is the least happy part of this story, while I did finally get TNLs to calculate correctly, the leveling up system is not perfect. A couple of characters - as I recall, P. Cecil and FuSoYa - will have trouble leveling up completely if they gain a ton of experience in the shadow. For example, if you get P. Cecil enough experience to level up to 99 while he's in the shadow, then add him back to the party, he may only level up to 32 or so. If you remove and add him again, he will level up further, but it usually takes about for or five adds and removes before he comes out right. I don't know why this happens, but it has something to do with the game's regularly programmed level up routine, so I can't really fix it.
A few other characters similarly will only level up to 98 instead of 99 (I think DK Cecil, Tellah, possibly one or two more). Those characters will, however, reach 99 after one battle (even with 3 Imps).

I think that's all there is to say here. If you discover any weirdness that I may have missed, feel free to let me know. I promised myself that I'd take a break from the Shadow hack for a while by the time I got to this point, but I'm not against the idea of making big corrections down the road if there is a need.

Have fun!

 :edit:
It's come to my attention that this mod and User Options are not compatible. While I don't plan on going back and checking for the compatibility of all of my mods, I do acknowledge that these two may be those of most value and interest to ROM hackers with larger projects in mind. In light of that, I've developed a patch that will ensure compatibility between the two. Bear in mind that I can only guarantee this will work on a ROM that has no other custom code inserted (edited with FF4kster should be fine, though) beforehand.

Follow the steps in this order:
1) Apply User Options (this will work with versions 2.2 and later)
2) Apply the Shadow Mod
3) Download and apply the patch below, "UO-Shadow Fix.ips"
« Last Edit: February 19, 2015, 09:33:50 AM by chillyfeez »

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Keeping everyone in shadow party
« Reply #58 on: August 10, 2014, 03:26:40 PM »
IT'S ALIIIIIIVE!

*whew*
Ok, at long last, here it is!
Is it perfect?
No... there are a few oddities that will be discussed below.
Is it really cool?
Well, I think so, but judge for yourself.

WAY TO GO chilly!!  :childish:    :cookie: -> for Sir!

I'm happy to say that I finished my arduous trek through Stat-Land and after a short sanity break (LOL) and some real work (BOO) I will write it up. Going in sets of 6 levels over 5 definitely made the difference there - but more on that later.
I can't think of a better way to relax then to watch the limits stripped away from my favorite game!  :banonsmash:

Have fun!

I'm sure that I will - my thanks to you, and my compliments! I'd love to take a look at you code sometime I'm sure that's quite an impressive sight.
"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 #59 on: August 10, 2014, 03:46:02 PM »
Oh, yeah, I did forget to include disassembles.
Well, I'll have to compile.
All of the purely custom code is in the 4/B000s (LoROM, that's the 2/3000s in ROM), but there are also some modifications made to some already a existing routines, such as exp awarding.