Author Topic: How did they program final fantasy?  (Read 10049 times)

alternate

  • *
  • Posts: 11
    • View Profile
How did they program final fantasy?
« on: 2006-11-28 13:15:25 »
Hey guys,

Ive been reading up on whats going on in here, some of the patches that you have released are very well done and make the game play and look amazing, better than the lousy conversion that they did on ff7. But anyway I know this is the best place to ask this kinda question... Does anyone know how they programmed final fantasy, what languages were used, or what ai algorithms they were using? If anyone could point me in the direction of some resources for this it would be really appreciated.

The reason I ask this question is because I believe that you learn a lot while playing games like final fantasy, unfortunately these skills don't have any relevance to the real world. However, the strategy and tactics used require a lot of brainpower, (e.g. what spells to use on which enemy, which ally to revive (to bring in a much needed magic spell, or special attack)). I would even go so far as to say final fantasy develops you as a person, (i.e. knowing what friendship is about, dealing with that love triangle!! ) All of this, requires brainpower and we all have learned through playing final fantasy, and if we learned it well we finished the game. But if you could apply this engaging environment to an academic subject, you would have learned something real and practical.

I am currently researching learning techniques and how your brain likes to learn, and surprise surprise, traditional teaching methods suck. However games seem to have a positive impact, while getting the educational content across. Im thinking of developing a mini rpg game that will teach school children......... french!! Yeah I dont like french too much, but if i can show that this works then ill get my masters. I have no idea how much work goes into a game like final fantasy, im thinking its way way too much for one person to do, but if was a small mini game it might just be do-able.

What i would like to know specifically would be:

The programming language used for the AI, both in battle and NPC's walking about
How they created the dialogs for the characters (dialogs would change depending on what you did during the game, i would like to know how this was done)
The battle system (if you got stronger, the enemies got stronger)
And any other ideas that you may find useful.

 

Synergy Blades

  • Guest
Re: How did they program final fantasy?
« Reply #1 on: 2006-11-28 16:38:56 »
Some quite wide-ranging questions there. There's plenty to read about the internal workings on this forum, specifically the Tech-Related area may help, and possibly the Wiki. You also don't state whether you're coming from a technical background or not, so I'll just pitch what I've got to say fairly generally.

Dialogs for characters changing is fairly simple, but it requires a brief discussion of the scripting language in FF7. This scripting language allows a field script programmer to code in all the actions you'll find on a field (by field, we mean each individual screen you can walk into and explore) - be it character interactions, windows, dialogs, animations, and so on - that you'll find in the game. This is a fairly broad subject in itself, but there are some basics in Qhimm's doc and some important information on how the memory banks and addresses work in halkun's doc (the actual codes, we know more about; check the Opcode list). More importantly for your case it allows you to check parts of memory that might correspond to certain events (more later).

To display a dialog you'll first create a window, then either display it with a particular dialog from the field's list, just as a regular message, or you might want it to be a list of several choices the user can select. For this, the result of the user's selection is stored in memory (see halkun's doc).

If you want to display a dialog depending on what's happened in the game, you'll need to check an area of memory using the if statements which operate just like you'll find in many programming languages. This area of memory will be set by the game when the player makes the aforementioned choice. Let's say the player completes a certain side-quest; subsequently, the area of memory corresponding to that side-quest is set (or perhaps a particular bit is set to 1). We might want the NPCs to talk about the outcome of that side-quest, so we display the dialog relating to it if the user has completed it - that is, that quest's memory location is set to 1. Otherwise, the if-check fails, and the NPCs won't talk about it.

There's one more important thing to note here in relation to checking memory, and that's the Plot Progression Variable (PPV). To be specific (and as far as I know), this is stored in bank 2, address 0. This variable is adjusted throughout the game and is checked over the course of many fields to see how far the player has progressed through the game and again may cause different things to happen. In FF7's case, this is most obvious during the later part of the game when Meteor is hovering above the planet; characters talk about the end of the world coming, for example. This is accomplished, as explained above, by checking a variable, and in this case it's the specific address for the PPV (rather than some other location for a side-quest) and seeing if it's greater than a certain amount. Here's an example taken straight from Wutai when you talk to the man walking around on the left near the shop:

Code: [Select]
if(<2>[0] >= 3F0)                      // Check PPV to see if Meteor event has occured
{
  CreateWindow(2,78,87,D0,39)
  Dialog(2,E)                          // Talk about end of the world (dialog 0xE)
}
else
{
  if(<3>[BD] & 40)                     // Check if we're on the Yuffie sidequest
  {
    CreateWindow(2,78,87,D2,39)
    Dialog(2,B)                        // Talk about Yuffie (dialog 0xB)
  }
  else                                 // It's neither Meteor time, nor are we on the sidequest, and so....
  {
    CreateWindow(2,78,87,D9,29)
    Dialog(2,6)                        // ...just general chatter, this one is about Lord Godo in his house (dialog 6)
  }
  ...
}


NPCs walking about is also handled by the scripting system. Each NPC is represented by an entity that contains a set of scripts relating to that NPC, and each script has a particular function; for example, the first one is an initialisation script, the second is run if a button is pushed while standing near the entity, and so on. Here we might set up the starting location of said character, its orientation, and so on (but again, thanks to the script, characters may start in different locations depending on the events the player has triggered in the past). We also might set up animation for that entity, such as move them to a particular point, wait there, then move again. Chaining these moves obviously allows the appearance of following a predefined path and you can loop a walk path indefinitely by jumping back to the beginning of the script. Again, from the same Wutai man:

Code: [Select]
Wait(5A)
Move(0,53,F6,2,5)
Move(0,47,F7,C2,5)
Move(0,A9,F8,8F,5)
Wait(78)
Move(0,11,F7,8F,5)
Move(0,E,F7,7C,4)
Move(0,7F,F5,EE,4)
Wait(46)
Move(0,45,F4,5C,6)
Move(0,82,F5,F8,5)

There are, perhaps not surprisingly, a large number of commands for animation and moving, with many different variants involving animations/no animations while moving, animations stopping or looping, animation speeds, movement speeds, and so on.

Hope that helps a little. For further reading in this area if you're interested, check the Wiki, search the forums, and if you have FF7 for the PC grab my app here, which I used to pull out the scripts above (not a shameless plug, honest, just think it might help).

Whilst I can't help much with the battle system, since I've barely looked into it, you may want to check out this (very large) guide to the Battle Mechanics by Terrence Fergusson. You can find it here: http://db.gamefaqs.com/console/psx/file/final_fantasy_vii_enemy_mech.txt - but you will need to visit once then copy and paste the link into the address bar again as it doesn't like hotlinking. A more knowledgeable soul from the board may also want to help you out with that area.
« Last Edit: 2006-11-28 16:49:30 by Synergy Blades »

alternate

  • *
  • Posts: 11
    • View Profile
Re: How did they program final fantasy?
« Reply #2 on: 2006-11-29 10:53:06 »
Thanks synergy blades,

It looks like I have a lot of reading to do! I have moderate programming skills, but I am no means a brilliant programmer. It seems very interesting tho, I thought the whole NPC's remembering what you did/said was just an if statement, its great to see that they kept it that simple. Im more used to java and not having to deal with allocating memory that much, but im sure I can understand the code, given some time! Im sure there is a huge amount of if statements in this game, so i think for now i would need to write down a plot and take it from there.

Thanks so much for taking the time to give me some advice on this!

Micky

  • *
  • Posts: 300
    • View Profile
Re: How did they program final fantasy?
« Reply #3 on: 2006-11-29 22:19:39 »
The battle system (if you got stronger, the enemies got stronger)
Get a rulebook for a paper-RPG, either get one of the free ones or find a friend who has an actual book. That should give you the basic idea about calculating damage for a strike, levelling up, calculating strength for a monster, etc.
The implementation of these rules in a computer program is relatively simple, the problem is making rules that are fun and balanced, and you'll have to spend a long time testing and tweaking them.
« Last Edit: 2006-11-30 00:12:21 by Micky »