øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1905.msg20119e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0eaf.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=1905.45e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index0eaf.html.zxÏ.g^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0P.šƒOKtext/htmlISO-8859-1gzip8:ÖšƒÿÿÿÿÿÿÿÿTue, 10 Mar 2020 06:24:38 GMT0ó°° ®0®P®€§²ð®Î.g^ÿÿÿÿÿÿÿÿŽ<šƒ Apropos of nothing (except of course FFIV)

Author Topic: Apropos of nothing (except of course FFIV)  (Read 17057 times)

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #45 on: January 14, 2014, 01:17:00 PM »
It's been so long since I worked on that part of it so I have no idea what my sources were, but FF4kster does seem to handle TNL correctly. In fact I think that 31 MP limit is indeed correct as well and that the TNL requirement actually bleeds 3 bits into the MP byte, not two.

I can post my code if you like but it's in FreeBASIC so I have no idea if you'll be able to make any sense of it.
Let's dance!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #46 on: January 14, 2014, 01:37:53 PM »
It's been so long since I worked on that part of it so I have no idea what my sources were, but FF4kster does seem to handle TNL correctly. In fact I think that 31 MP limit is indeed correct as well and that the TNL requirement actually bleeds 3 bits into the MP byte, not two...

That sounds right on the money to me. The good thing is with the calculation approach the answer is to just set aside 3 bytes for the value from the get-go and that should do it.

As for your code - go for it! The worst that could happen is that I look at it and see the face of Black Mage:

http://www.nuklearpower.com/2001/06/11/episode-041-it-just-got-weird-in-survivor-8-bit-style-part-6/

I'll post again within the hour about Grimoire's last post - I just have to double check my numbers  :wink:
"Now I know; and knowing makes it even more confusing..."

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #47 on: January 14, 2014, 02:17:09 PM »


Turns out I wasn't scheduled for work today, so maybe i can get to this.

- That makes for a nice surprise.  :happy:  As for Exp, hopefully this helps:

DkC - TNL Data: Values Shown as:       Dec. (Hex)
Level            RAM             ROM
--------------------------------------------------------------------
10      2403  (0963)        931 (03A3)
11      3334  (0D06)      1186 (04A2)   
12      4520  (11A8)      1486 (05CE)

- What is stored in the ROM are the differences of what is carried around in the RAM. Looking back upon when I was working this out initially - in what would now be 'drawing board' teritory :) - The difference table for DkC would read:

Lv   RAM       ROM             (255 Not stored anywhere, FF4 doesn't need it)
--------------------------------------------------------------------
10)     2403
                   931  <-------------   931 = 3334 - 2403 (Lv. 10 --> Lv. 11)
11)     3334             255   <-------------  (That's where I got my 'A' Parameter - see previous post)
                  1186 <------------- 1186 = 4520 - 3334 (Lv. 11 --> Lv. 12)
12)     4520                 

So @ Lv 10 the game is carrying around in the RAM the 1st value: 2403 and then the TNL for Lv 10 --> Lv 11 is calculated as:   TNL = 3334 = 2403 + 931 which then replaces 2403 in the RAM. The game then adds the next difference to get what you actually need to get to Lv. 12:

(Lv. 11 --> Lv. 12)   4520 = 3334 + 1186

Or recursively as:    (for Lv. X --> Lv. X+1)   New TNL = Old TNL + Difference (as stored in the ROM)

That's it - I hope it helps and if not please tell me. I know that given the party I was fortunate enough to join on this Forum that you can all understand anything I'm trying to get across - just need put into your own terms instead of mine. :)

Had I only realized this some time ago I might have solved my level up problem I was having, now I suspect that the game puts in Level 69's TNL by default once those levels are reached...

You got it! In fact, I think to play it safe I'll probably just flat out store everyone's Lv 69 TNL; so one more stored parameter per character, but I think the peace of mind is worth it.


"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #48 on: January 14, 2014, 02:57:12 PM »
I can make out a little freebasic, so that shouldn't be too much of a problem. (or at least I could five to six years ago) I am still wondering why they didn't have a basic "this much exp. to next level" instead of this weird TNL + numbers that the game itself uses. I don't see the benefit other than Maybe Slight byte saving, and I mean maybe four or five

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #49 on: January 14, 2014, 03:27:41 PM »
Well at the very least I can say this specifically is what allowed me to transition from being surprised and baffled by the coding in this game to just being baffled. I remember in reading some of your code-breakdown things that didn't make sense - didn't work right - weren't even conceived right, so stuff like this is only the beginning.

Giving them the benefit of the doubt (haha) there is some logic in it: addition is higher precision operation than subtraction: so you can take as a rule that if you need all three numbers in this kind of set, but can only store two of them, store the smaller ones and generate the 3rd.

Too bad that logic doesn't apply here. My example can be applied to something like 99818.5488893 + 2564.984984 = 102383.5338733 - very easy to lose digits in subtraction trying to go the other way - but it's all integers in this calculation so that's out. :P Also, since you don't actually use all three numbers, that's out too. I have the difference in my calculation just to build the TNL values, but from the game's perspective the differences don't matter they only utilize the TNL values themselves.

Admittedly, my formula was a pain in the ass to derive and remain accurate without using decimal multiplication or division. So I'm going to assume that they simply went with the path of least resistance - I can't claim I wouldn't have done the same back then but still  :sad:

« Last Edit: January 14, 2014, 04:00:37 PM by LordGarmonde »
"Now I know; and knowing makes it even more confusing..."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #50 on: January 14, 2014, 04:51:26 PM »
Ok, well there's documentation over at FreeBASIC.net for the syntax/keywords, and I will be happy to answer any questions to the best of my ability.

(The "&h" prefix is what FreeBASIC uses to indicate a hex number, much like "0x")

Code: [Select]
sub Character.ReadFromROM(index as UByte)

 dim start as UInteger
 dim temp as UByte
 dim actor_index as UByte
 dim level_ptr as UInteger
 
 start = &h7AB00 + (index - 1) * &h20
 
 temp = ByteAt(start)
 character_id = temp mod 2^5
 if temp and 2^6 then left_handed = true else left_handed = false
 if temp and 2^7 then right_handed = true else right_handed = false
 
 temp = ByteAt(start + 1)
 sprite = temp mod 2^4
 
 level = ByteAt(start + 2)
 max_hp = ByteAt(start + 9) + ByteAt(start + 10) * &h100
 max_mp = ByteAt(start + 13) + ByteAt(start + 14) * &h100
 
 for i as Integer = 1 to 5
  stat(i) = ByteAt(start + 14 + i)
 next
 
 xp = ByteAt(start + &h17) + ByteAt(start + &h18) * &h100 + ByteAt(start + &h19) * &h10000
 tnl = ByteAt(start + &h1D) + ByteAt(start + &h1E) * &h100 + ByteAt(start + &h1F) * &h10000
 
 actor_index = character_id

 start = &h7B700 + (actor_index - 1) * 2
 level_ptr = ByteAt(start) + ByteAt(start + 1) * &h100 + &h70200 + 5 * (level - 1)
 
 for i as Integer = level to 69
  levelup(i).stat_bonus.amount = ByteAt(level_ptr) mod 2^3
  for j as Integer = 1 to 5
   if ByteAt(level_ptr) and 2^(2 + j) then levelup(i).stat_bonus.stat(6-j) = true else levelup(i).stat_bonus.stat(6-j) = false
  next
  levelup(i).hp_bonus = ByteAt(level_ptr + 1)
  levelup(i).mp_bonus = ByteAt(level_ptr + 2) mod 2^5
  levelup(i).tnl = ByteAt(level_ptr + 3) + ByteAt(level_ptr + 4) * &h100 + (ByteAt(level_ptr + 2) \ 2^5) * &h10000
  level_ptr += 5
 next
 
 for i as Integer = 1 to 8
  after70(i).amount = ByteAt(level_ptr) mod 2^3
  for j as Integer = 1 to 5
   if ByteAt(level_ptr) and 2^(j + 2) then after70(i).stat(6 - j) = true else after70(i).stat(6 - j) = false
  next
  level_ptr += 1
 next
 
end sub
Let's dance!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #51 on: January 14, 2014, 09:33:52 PM »
FreeBASIC eh... I say: pretty rad!
I'm actually a little bummed to have only just heard of it now.  :sad:
I also think the amazing results you've had with it make it all the more impressive - but I will freely admit that in the scope of my limited programming abilities I've got a soft spot (or hard ... yeah) for C - always put it up on a pedestal - right, wrong, or indifferent <-- which logically must be wrong: it would be literally impossible for C to actually be the answer for everything - in fact even in my personally history I know where it falls short...
but I love it anyway!  :childish:


Regarding your code, it really wasn't that difficult to follow (in the how anyway - I'm still working on the 'why's for the last set of steps - I may need help from the teacher on that one :wink: I do like what you sent over - I wouldn't mind reading some more. Even Square get's some credit: +64 for left, +128 for right, +192 for both: makes sense to me!


As for FreeBASIC - it's not just what you've been able to do with it - it's a nice package - it certainly ain't BASIC as I learned it back a thousand years ago  :tongue: In fact in front of me currently is a book which reads:


"The QBasic program provides a complete environment for programming in the BASIC language, including extensive online Help."

- Source "Microsoft MS-DOS: User's Guide & Reference (for the MS-DOS Operating System Version 5.0) - (C) Packard Bell 1991

                  - "online" - LOL - I remember when that word only had the single meaning: at least there's the splif of 'o' vs 'O'
"Now I know; and knowing makes it even more confusing..."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #52 on: January 15, 2014, 03:42:56 AM »
FreeBASIC eh... I say: pretty rad!
I'm actually a little bummed to have only just heard of it now.  :sad:
I also think the amazing results you've had with it make it all the more impressive - but I will freely admit that in the scope of my limited programming abilities I've got a soft spot (or hard ... yeah) for C - always put it up on a pedestal - right, wrong, or indifferent <-- which logically must be wrong: it would be literally impossible for C to actually be the answer for everything - in fact even in my personally history I know where it falls short...
but I love it anyway!  :childish:

I tried several times to learn C but had a lot of trouble just getting simple things working. In FreeBASIC I could just go "print 'hello world'" and hit compile and run and there it is, no problem. If I want to have a multi-file project, I don't have to go worrying about header files and makefiles and all that jazz, I just put "#include 'whatever.bas'" at the top and good to go. Also I used MS-DOS as my main operating system for a very long time (I changed over to Linux as my main somewhere around 2009), and FreeBASIC was actively supporting that platform so it also made sense from that perspective. So after getting used to it I pretty much stuck with it. You have to understand, I am a very lazy puff.

That said, I can usually read C code more or less; my issues with it are more practical than theoretical.

As for FreeBASIC - it's not just what you've been able to do with it - it's a nice package - it certainly ain't BASIC as I learned it back a thousand years ago  :tongue: In fact in front of me currently is a book which reads:

"The QBasic program provides a complete environment for programming in the BASIC language, including extensive online Help."

- Source "Microsoft MS-DOS: User's Guide & Reference (for the MS-DOS Operating System Version 5.0) - (C) Packard Bell 1991

                  - "online" - LOL - I remember when that word only had the single meaning: at least there's the splif of 'o' vs 'O'

Turns out FreeBASIC is actually something like 98% backwards-compatible with the old QBASIC. Though that's mostly for the benefit of being able to compile old legacy programs written decades ago than for writing something in that style now; especially now that it can handle all the amenities one expects of a modern language (pointers, objects, etc).

Regarding your code, it really wasn't that difficult to follow (in the how anyway - I'm still working on the 'why's for the last set of steps - I may need help from the teacher on that one :wink: I do like what you sent over - I wouldn't mind reading some more. Even Square get's some credit: +64 for left, +128 for right, +192 for both: makes sense to me!

I'd be glad to explain anything there. What "last few steps" are you referring to? That last loop there is for parsing the "after level 70" stat ups. The lowest three bits are the amount and the upper five each refer to one of the stats, true if it gets the bonus, false otherwise.
Let's dance!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #53 on: January 15, 2014, 05:32:26 AM »
Oh yeah - I know what you mean about C. I learned BASIC first - I messed around on my own and it was my first programming class 2nd half of freshman year in high school - I liked it a lot, but C/C++ was the whole next year (with a frankly a better teacher) - and then same teacher for AP C++ the following year, and then senior year I was kind of a TA because the teacher retired and the guy that filled in for the year from the temp agency really didn't know anything - you could say "Fate made us train together..." - lol

You have to understand, I am a very lazy puff.

 - You and Grimoire: if you both weren't so humble you'd be competing for the Humble Award  :tongue:

I read that and thought "Yep - I know...it's like the time you just gave up and stopped building the greatest editor - yeah, ever"

Turns out FreeBASIC is actually something like 98% backwards-compatible with the old QBASIC.

I wondered that - I figured it would have been - but I wrote my post right after looking through the list of available operators; which was after looking at a bunch of other lists on the wiki - I may be flawed in my memory but I just don't remember nearly that many choices.

I'd be glad to explain anything there. What "last few steps" are you referring to? That last loop there is for parsing the "after level 70" stat ups. The lowest three bits are the amount and the upper five each refer to one of the stats, true if it gets the bonus, false otherwise.

There you go again - thinking logically - when you're dealing with me "you must unlearn what you have learned"  :tongue:

The code is very concise; I don't have time to get lost - and looking at it vs the inside information from my work with leveling up and seeing the result directly in you editor I was able to put it together - my hang up is far more asinine:  "2^(j + 2) then after70(i).stat(6 - j)" to which I think: "Hmm...I know it works - so definitely right - so I don't need to think about it from that angle...so then why those numbers...2^(j + 2) = (2^2)x(2^j) = 4 x (2^j)...ok 4...why 4..." and so on...yeah I just have to chuckle about that - of all the things to go chasing down

Though a legit question: Other than FreeBASIC with what other languages are you familiar? I love that this conversation has come up - I have been thinking about such pros & cons and in my head replaying my programming history...I think I'll post some of it over on The Drawing Board - I want to know what programmers think with the hopes that I'll be able to understand (and advance past) some of my hangups with Assembly - we'll see
« Last Edit: January 15, 2014, 08:32:29 AM by LordGarmonde »
"Now I know; and knowing makes it even more confusing..."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #54 on: January 15, 2014, 05:56:29 AM »
Oh yeah - I know what you mean about C. I learned BASIC first - I messed around on my own and it was my first programming class 2nd half of freshman year in high school - I liked it a lot, but C/C++ was the whole next year (with a frankly a better teacher) - and then same teacher for AP C++ the following year, and then senior year I was kind of a TA because the teacher retired and the guy that filled in for the year from the temp agency really didn't know anything - you could say "Fate made us train together..." - lol

I remember TA-ing; wasn't the worst job in the world by any stretch of the imagination, but I don't miss the marking. Actually I learned almost as much through helping teach as I did through actually taking courses, as I was TAing courses I hadn't taken and didn't know the material already ^_^;

I read that and thought "Yep - I know...it's like the time you just gave and stopped building the greatest editor - yeah, ever"

Oh stop  :blush:
... Though it has broken 1000+ downloads on RHDN! I never thought it would be so popular.

Turns out FreeBASIC is actually something like 98% backwards-compatible with the old QBASIC.

I wondered that - I figured it would have been - but I wrote my post right after looking through the list of available operators; which was after looking at a bunch of other lists on the wiki - I may be flawed in my memory but I just don't remember nearly that many choices.

I think you have to use a special compiler switch or something for the legacy code. "-lang qb" if memory serves.

The code is very concise; I don't have time to get lost - and looking at it vs the inside information from my work with leveling up and seeing the result directly in you editor I was able to put it together - my hang up is far more asinine:  "2^(j + 2) then after70(i).stat(6 - j)" to which I think: "Hmm...I know it works - so definitely right - so I don't need to think about it from that angle...so then why those numbers...2^(j + 2) = (2^2)x(2^j) = 4 x (2^j)...ok 4...why 4..." and so on...yeah I just have to chuckle about that - of all the things to go chasing down

But you get it now, yes? We need bits 3-7, so we have j ranging from 1 to 5, so we need j+2 to get (1+2 = 3) to (5+2 = 7).

Though a legit question: Other than FreeBASIC with what other languages are you familiar? I love that this conversation has come up - I have been thinking about such pros & cons and in my head replaying my programming history...I think I'll post some of it over on The Drawing Board - I want to know what programmers think with the hopes that I'll be able to understand (and advance past) some of my hangups with Assembly - we'll see

Hm, depends on your definition of familiar. I find that the structures of programming are pretty universal, so I'm confident I can pick up pretty much any modern language fairly quickly. But I have had some exposure to:

* C/C++, as we discussed
* Java
* Python
* BASIC of various dialects, FB is my favorite
* Some functional languages (I did a course on this but remember little from it; I think we did Miranda?)
* ASM of course

There might be others I'm forgetting, I'm just writing this post quickly while waiting for class to start ^_^;
Let's dance!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #55 on: January 15, 2014, 09:11:47 AM »
I remember TA-ing; wasn't the worst job in the world by any stretch of the imagination, but I don't miss the marking. Actually I learned almost as much through helping teach as I did through actually taking courses, as I was TAing courses I hadn't taken and didn't know the material already ^_^;

That's another thing I love about teaching - you really get to know the material - even if you hadn't seen it  :wink:
I will say I read that as pretty impressive - and having ended up in too many situations of similar circumstance I would really love to hear the details of that adventure - because as similar as components of the setup seem that they might be - I've never actually been in that situation :finger:

But you get it now, yes?

I do; thank you kindly :happy: - Also, I do anticipate more conceptual questions in the future - but tomorrow is tomorrow

I find that the structures of programming are pretty universal

My teacher often said similar: "when you know how to program you can get dropped in any language and you'll come out just fine." That's also quite the list mine is just the two I mentioned and FORTRAN 77 - MATLAB is not a language - I don't care what they say. Also you needn't blush at compliments or praise (btw: 1000+ way to go!) I'm just calling it as I see it...which reminds me:

Oh stop  :blush:

I did think it over carefully and uh, well...no  :tongue:

I hope class is going well (anything good?) - I have one that sucks so bad I have to swap it for something else :lame:
"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: Apropos of nothing (except of course FFIV)
« Reply #56 on: February 24, 2014, 12:42:31 PM »
Here's my spriting process:

1) Open ROM file in Tile Layer - This may work with other programs, but I know it works with Tile Layer
Jump to the offset of the image you're editing, and highlight it by right clicking on the first sprite and dragging to the last sprite


2) Export the image to a bmp file


3) Open the bmp in MS Paint. Don't waste your time and effort on a fancy image editing program. Remember, you're editing an image that is, at most, 16 colors, and probably no bigger than 32x32 (unless you're making monsters, but still...). Paint has all the tools you'll need for this process, and won't muddy it up with too many tools you won't need


4) Zoom in as large as possible - 800% for my version of Paint


5)In the Zoom menu, select "Show Grid"




6) Expand your image workspace by clicking on the dot in the center of the lower edge of the image and dragging down. Give yourself lots of room.


7) Arrange the image - by selecting, copying and pasting - into this newly created space.


8) Helpful tip: Create Gridlines around your arranged image so you know the limits of each individual sprite.
Also, create a working palette of all of the colors. DON'T use any other color, or Tile Layer will not properly interpret it when you're done.


9) Create your new image


10) When you're done, drag the newly created image sprites back into the space from which they originated




11) Then, reduce the image back to it's original size (ckick and drag that same dot)


12) Save your image (no need to "Save As")


13) Back in Tile Layer, import your image




14) Drag the imported image to its desired location


15) Click in the data area, somewhere other than the imported image, to make the grid reappear over it. this is a necessary step to complete the import.


16) Save your ROM, and voila!



Sounds so easy, doesn't it?
It's not. I'm dreading any and all of this that I'll have to do in the future for my hack, but, well, it's a necessary evil.

Hope that helps!

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #57 on: February 24, 2014, 02:42:18 PM »
Here's my spriting process:
...
Sounds so easy, doesn't it?
It's not. I'm dreading any and all of this that I'll have to do in the future for my hack, but, well, it's a necessary evil.

Hope that helps!


 - Yes - it helps immensely! My thanks and compliments good sir.  :yabin:
"Now I know; and knowing makes it even more confusing..."

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,684
    • View Profile
Re: Apropos of nothing (except of course FFIV)
« Reply #58 on: February 24, 2014, 10:14:46 PM »
It is honestly easier than I thought, but oh how tedious it must be... this would be a point where an editor akin to FFVI's graphics editor would be wonderful. Maybe one day that will be added to FF4kster? Who can say.

Thank you for showing me the method though Chillyfeez.

Dragonsbrethren

  • Forum Overlord
  • *
  • Posts: 1,820
    • View Profile
    • Dragonsbrethren Industries
Re: Apropos of nothing (except of course FFIV)
« Reply #59 on: March 04, 2014, 03:05:21 PM »
YY-CHR has a 32x32 mode that should work with those portraits and can export a bmp if you'd rather work in an actual image editing program (but for pixel are its tools are fine). It's not tedious at all, really.