Final Fantasy Hacktics

Modding => Help! => Topic started by: Asakawa on June 13, 2015, 02:16:36 pm

Title: Question on programing FFT
Post by: Asakawa on June 13, 2015, 02:16:36 pm
Hi Guys,

I've been wondering what kind of computer programing languages you would need to learn to program/edit fft? This would exclude working with AI since from what I have been told it is the most difficult part of programming. Strictly speaking more of a PvP approach unless AI would still be necessary? Since you guys work with FFT doing edits and modifications what programing languages do you feel are required to be able to do this?
Title: Re: Question on programing FFT
Post by: Choto on June 13, 2015, 04:48:44 pm
the only programming language you need to learn is MIPS IV Assembly. It's a low-level language that is used in the psx processor. As far as assembly languages go, it's absolutely the easiest to use that I've seen. In addition to that you have a metric shit-ton of resources on our wiki and in tutorials and in IRC/Help forum.

Most edits we make are small... especially when learning ASM. The more you learn though, the more you can accomplish. Xifanie and Pokeytax have made monstrous hacks that are more custom-programming... but most of the time you're just adding little snippets of code to modify the original code. That kind of stuff is much easier.
Title: Re: Question on programing FFT
Post by: Asakawa on June 13, 2015, 04:53:25 pm
Hi Choto,

Thank you for replying. So with MIPS IV Assembly you can pretty much do anything you want within the FFT code? Was this the language that was used back then to create the game itself? I am sorry but I am so naive when it comes down to code and programming. I always thought the creators used more than a single language code to create the game. Was is that back then only MIPS IV Assembly was available? Sorry again for my lack of knowledge on the subject.... I think the game was produced around 1996?
Title: Re: Question on programing FFT
Post by: Pride on June 13, 2015, 06:31:15 pm
FFT was not written in an assembly language, no one knows what language it was originally written in (since we don't have the source code, on the dev team, etc) but yes, you could do whatever you want in fft with time and effort.
Title: Re: Question on programing FFT
Post by: Asakawa on June 13, 2015, 06:41:28 pm
Hi Pride,

Thank you for dropping by :). I see, then would you say that it is considerably more difficult to 'edit' the game by using MIPS IV Assembly than if we could, for example, use the source code and coding language the developers used?

Even if we did know the coding language it was used it would not be much help since we do not have the source code? Is that right? I just want to understand this clearly sorry!
Title: Re: Question on programing FFT
Post by: Choto on June 16, 2015, 09:53:35 pm
What Pride means is that it was written in something like C, and then (as with any high level language) it was compiled into ASM commands. Machines don't recognize high level languages, so eventually all high level language code is converted into ASM to communicate with the machines it's programming.

Ya, getting the original high-level code is pretty much out of the question, so we're relegated to ASM anyway. But it's not so bad. It's easy enough to work with. Just takes alot of time and effort as Pride mentioned
Title: Re: Question on programing FFT
Post by: Xifanie on June 16, 2015, 10:47:05 pm
Just saying but:

- FFT was written in C.
- Doesn't matter because the source code is permanently gone (otherwise Square's ports wouldn't be so bad).

They just destroy the source code after releasing any of their games, and no one knows why. :/
Although that's probably more a thing of the past since they released FFXIII/FFXIII-2 on PC.
Title: Re: Question on programing FFT
Post by: Asakawa on June 17, 2015, 12:00:29 am
Thanks so much :)

Just to be sure: It would be easier to work with the code if it was in C, am I right? ASM is harder to work with than C? Would that be accurate? Also, I guess reverse engineering is out of the question? ASM into C? :P
Title: Re: Question on programing FFT
Post by: Xifanie on June 17, 2015, 03:59:44 pm
Some people prefer C. Nobody here does though. At least with ASM you will know immediately if your hack is going to fit in your limited amount of space of not.

Go ahead and do it if you want to reverse-engineer the game. Nobody here has done that because of all the work it involves, and well, most of us are not all that familiar with C.
Title: Re: Question on programing FFT
Post by: Asakawa on June 17, 2015, 07:24:35 pm
One  last question. Since square used to destroy all of their code after releasing the game does this mean they had to re-write the whole thing for the War of the Lions Release????
Title: Re: Question on programing FFT
Post by: Xifanie on June 17, 2015, 07:38:02 pm
No. No. No. No, they hacked around to implement the new things and pretty much buildt an emulator around the game.
Title: Re: Question on programing FFT
Post by: Asakawa on June 17, 2015, 08:35:33 pm
Wow! So they basically used ASM? to do the hacking? I always wondered why the animations were so slow in combat. Was that supposed to be part of the game play? Or perhaps a bug?
Title: Re: Question on programing FFT
Post by: 3lric on June 17, 2015, 10:03:21 pm
The slowdown? No, that was not intentional, they just weren't smart enough to fix it like Archaemic did.
Title: Re: Question on programing FFT
Post by: Asakawa on June 18, 2015, 01:04:18 pm
I see, strange that they would not fix it having so much staff on their side and what not lol. So do you think they used ASM to create the War of the LIons since the source code was no longer available for use?
Title: Re: Question on programing FFT
Post by: Xifanie on June 18, 2015, 02:10:18 pm
Maybe you should ask squareenix directly

And they kinda created the bug to start with. It looks like they accidentally overwrote some bytes (possibly while looking at the hex data of the game), started typing, oops wrong window. Didn't notice they typed something into the game's hex, went to edit other stuff, and saved. They didn't know wtf was going on, and created a patch to try to compensate for the speed drop, but IMO, failed horribly.
Title: Re: Question on programing FFT
Post by: Asakawa on June 18, 2015, 02:24:04 pm
Thank you Xefani :),

Do you think it would be possible to add a whole set of stats, like in tactics Ogre for PSX (STR, DEX, AGI, LUCK, ETC), and have them work in a similar fashion to the stats in Tactics Ogre? Could this be done by using ASM? I see your quote on what is possible in ASM "Anything is possible as long as it is within the hardware's limits. (ie. disc space, RAM, Video RAM, processor, etc.)" do you think something like that is possible taking into consideration the hardware limits? (Because I honestly don't know what the limits would be). I just want to get an idea of what could be possible... (Meaning to what degree the game could be altered).

-Edit- Sorry for asking so many questions :(
Title: Re: Question on programing FFT
Post by: Glain on June 20, 2015, 06:48:19 pm
I believe the PSX processor (R3000A) actually is MIPS I, whereas the PSP's (Allegrex) is MIPS32R2.

Trying to get C that works out of ASM isn't an easy task. I'd looked into it a bit way back when, but even if you could get some kind of decompilation going, you end up with names like func_84bc2 and var_3940, and getting anything readable out of that mess is pretty ridiculous. The fact that the code is split into multiple files here makes it even more complicated.

The PSP code certainly seems to have been recompiled from something. IIRC, the code for both battles and the world map in the PSP version is all inside boot.bin. That code uses a bunch of ASM instructions that didn't exist in MIPS I, makes use of the FPU in a few places, and has some different compiler conventions than the PSX code. The PSP has enough RAM to load all the code at once so it doesn't need to be split into multiple files like battle.bin/world.bin.

I believe it keeps around some of the PSX-version binaries and loads data from a few of them, but I'm not sure how much code it actually references in them. I'd think the PSX code could be run on the PSP natively except for the GTE commands.
Title: Re: Question on programing FFT
Post by: Asakawa on June 20, 2015, 09:40:36 pm
Ah, I see. That sounds interesting. Would it be easier to work with the original C code instead of trying to do things through ASM? Do you think it would be possible to edit things like the stats in Tactics Ogre (STR, DEX, LUK, ETC) into FFT through ASM? It makes me wonder just how much can be edit?
Title: Re: Question on programing FFT
Post by: 3lric on June 20, 2015, 10:09:17 pm
Quote from: Asakawa on June 20, 2015, 09:40:36 pm
Ah, I see. That sounds interesting. Would it be easier to work with the original C code instead of trying to do things through ASM?


You already asked this up above...  no more going in circles.

What you intend to do with all the answers you are getting for these questions???
Title: Re: Question on programing FFT
Post by: Asakawa on June 21, 2015, 01:44:40 am
I asked but have not received the answer so I wanted to ask you :(. I want to know to get an idea of what can be done with the ASM in the game. I don't know of the  limits so I wondered if you guys new if it was possible. All the answers just let me get an idea of where to go.
Title: Re: Question on programing FFT
Post by: 3lric on June 21, 2015, 02:01:56 am
Understood, however I think what Xif said here:

Quote
Some people prefer C. Nobody here does though. At least with ASM you will know immediately if your hack is going to fit in your limited amount of space of not.


Is the best answer you are going to get since when it comes to FFT hacking/modding she has a better understanding of how it works than anyone else on the forum.

Fact of the matter is that if you intended to reverse engineer the game, you would more than likely be alone in doing so, as the amount of work wouldn't simply be taxing, but closer to insane. Our intent is not to discourage you, but to provide the facts. I would honestly hate for you to start such an endeavour under the impression that we are a larger community than we are. You clearly are interested in what we do here and so the best way to proceed would be to start jumping in and learning some of this stuff and what it would take to do, which in turn would give you a better understanding and likely answer a lot of your questions in a way that's easier to understand.
Title: Re: Question on programing FFT
Post by: Darkholme on June 21, 2015, 08:12:20 pm
Quote from: Asakawa on June 21, 2015, 01:44:40 am
I asked but have not received the answer so I wanted to ask you :(. I want to know to get an idea of what can be done with the ASM in the game. I don't know of the  limits so I wondered if you guys new if it was possible. All the answers just let me get an idea of where to go.


I also looked into this idea several years back. I'm not one of the regulars here, but I'm around from time to time, and have been around from time to time for quite a while, and here is what I have to say about reverse-engineering the game (as someone with a BSc in Computer Science and work experience developing software for a living):

It would be significantly easier to use the data you can see in the editors that exist (probably by copy-pasting and manual data entry, but you could also write a fairly simple tool to extract it automatically), the game sprites & textures, and the information in the battle mechanics handbook (slightly inaccurate in a few places though it may be) and make a new game engine using modern software development tools, than it would ever be to reverse-engineer the game and work with that.

Even if you could get a functional decompilation of FFT, which will recompile appropriately and work the same (not a small task), the code resulting from such an automatic decompilation would be an unreadable mess, which would take a great deal of time to interpret, document, and organize.

The only reason I can possibly think of to do this is if you need it to run on an actual PSX - and I can't imagine why you would want to do that.

If you're thinking of making a game from scratch, I'd suggest you learn to work in Unity. You can write software in that that you can port to basically every major system right now (IIRC including some of the consoles, but definitely Mac, Windows, Linux, Android, and iOS).
Title: Re: Question on programing FFT
Post by: Asakawa on June 23, 2015, 06:40:01 pm
Sorry guys! It looks like the question got a little more complex than I thought it would get. Thank you all for that generous input :). I only wondered how hard it would be to reverse engineer the game to see if we could get something readable in C, but after surfing around the web I got similar answers like the ones that were presented here. You guys have done a great job at providing me with information :). I think the thread should be finished here. I did not quite get the answer I wanted regarding the possibility  of adding a group of stats like in Tactics Ogre for PSX (Would the space allow for that? Would it conflict with the current FFT design?), but that is fine! The question might be too complex to ask :(. Anyway, I will mark this as solved and thank you all for the wonderful replies :).