How did Final Fantasy VI do a non-fixed-width font?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
mcmillen
Posts: 11
Joined: Fri May 22, 2015 5:41 am
Location: Boston, MA

How did Final Fantasy VI do a non-fixed-width font?

Post by mcmillen »

If you look closely at the text in FF6 (FF3 US), you can see they don't use a fixed-width "font" like many games do. Most letters fit in 8-pixel-wide boxes, but narrow ones like "I", "i" and lowercase "l" only take up 4 pixels, lowercase "t" takes up 6, and there are also wider characters, like "w" at 12 pixels. See the attached (cropped & magnified) image.

How did they get this effect? The text is rendered as part of BG #3, but since usually backgrounds are tiled at a minimum resolution of 8x8, I don't understand how you'd get individual characters to be only 4, 6, or 12 pixels apart.

My best guess: perhaps they generated the background tiles dynamically at runtime? For example, given the string "wi", you could make one tile that's the first 2/3 of the "w" (8 out of the 12 pixels), and then a second tile that's the rest of the "w" (4 pixels) plus the "i" (4 more pixels). Given a line of text to display, you could render tiles in RAM as you scan the string from left-to-right, and upload the resulting 8x8 tiledata.

That seems like a an awful lot of work just to render text on the screen :) ... but I guess it might be feasible, since you only have to compute it every time the text *changes*, which is relatively infrequent since it's an RPG.

Anyways, anyone have other ideas (or facts?) I haven't yet had time to play around with a debugger and dig deeper :)
Attachments
FF6 intro text.
FF6 intro text.
Final Fantasy III000.png (9.06 KiB) Viewed 8021 times
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by tokumaru »

I didn't check this particular game, but your description of dynamically rendered tiles is indeed how it usually works. These are called "variable width fonts", and tepples is a big fan of them, so I'm sure he'll join the discussion soon.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by rainwarrior »

mcmillen wrote:That seems like a an awful lot of work just to render text on the screen :)
If you write the code once, you can use it 10,000 times in your game. It's probably worth spending a little extra time on, especially if it's one of the most important tech features of your game.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by tokumaru »

rainwarrior wrote:It's probably worth spending a little extra time on, especially if it's one of the most important tech features of your game.
Is this something that kids in the 80's and 90's would care about, though? Sometimes people here tell me that bugs like glitchy scroll splits aren't bad enough to justify the time/money necessary to fix them, but a slight aesthetic improvement is worth the time/money? Gamers hardly cared about all the engrish present in old games, I doubt they'd care about something as minor as letter spacing.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by tepples »

tokumaru wrote:Is [a proportional font] something that kids in the 80's and 90's would care about, though? Sometimes people here tell me that bugs like glitchy scroll splits aren't bad enough to justify the time/money necessary to fix them, but a slight aesthetic improvement is worth the time/money?
If it lets you fit more text in the same box, it might be effort-worthy.

Image
Proportional fonts can be more compact...

Image
...whether or not the individual glyphs are made thinner. (Right side is from a simulated TV.)

Image
This leaves more space for dialogue in Super NES versions of Mario Is Missing and Mario's Time Machine.

Image
In this screenshot of the first volume of Action 53 (which was made available on cartridge), more compact text leaves room for a screenshot or other graphics. And it looks great on a TV.

Image
Smaller text makes interactive fiction more comfortable.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by Sik »

The SNES only has 32 tiles across the screen width, and once you account for the unsafe margin, that becomes 28. That heavily restricts how long your text lines can be. Using variable width can let you extend the amount of characters to something like 30-40 characters which is more manageable. This isn't an issue for most games, but for text-heavy ones like RPGs it's a big deal, especially since the original script was usually in Japanese and the English counterpart would most likely expand to take up more space.

Of course nothing beats the Phantasy Star II Text Adventures which not only does variable width fonts, it even does kerning (to the point that sometimes characters can overlap if the spacing is right). And yes I checked, it isn't something from the English fantranslation, it happens in the original Japanese text as well.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by tepples »

Rendering text in a proportional font involves bit shifting each line of pixels in a glyph, ORing each shifted line into a buffer, and copying the buffer to CHR RAM. My VWF engine does this at a rate of roughly one line of text per frame on the NES. It'd probably be slightly faster if ported to the Super NES, which has a faster CPU, instructions that read 16 bits at a time, and a multiplier that can be (ab)used as a shifter to move each glyph into position.

Image
Each player's menu in RHDE: Furniture Fight takes three frames to refresh

But even if your text engine can't render VWF, you can still make a ligature that stuffs two thin letters into one tile. Earthbound Beginnings (the English version of Mother, not officially released until the Wii U era) has quite a few ligatures, seen at the top of its entry in this 8x8 font collection. My own game Thwaite has only one ligature, but it flaunts it in words like "rebuilt missile silo", "still", "Tilda", and "Milo".
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by rainwarrior »

tokumaru wrote:Is this something that kids in the 80's and 90's would care about, though? Sometimes people here tell me that bugs like glitchy scroll splits aren't bad enough to justify the time/money necessary to fix them, but a slight aesthetic improvement is worth the time/money? Gamers hardly cared about all the engrish present in old games, I doubt they'd care about something as minor as letter spacing.
People care whether things look a little nicer, just not to the same extent they care whether Relm's sketch ability might wreck their saved game. Things that are a subtle improvement are still appreciated, but they're subtly appreciated.

There are about 1000 subtle ways that Final Fantasy III (6) looked better then II (4). You could have cut each of them one by one with the justificiation that "nobody's going to care if you miss this one" and be back right where you started. The graphical arms race is finally dying out, I think, but in the early 90s nice screenshots were one of your primary marketing tools. I'm sure many people at Squaresoft thought this feature mattered. An RPG like this so much of the game content is text, so why not make it look nice? In a game with only 2 cutscenes, you don't see it much, but this game has text constantly.

For the record, I did notice the variable-width text at the time, and I thought it was great, but I was also a kid trying to make my own JRPG in my basement, so text rendering was a feature I had reason to be thinking about.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by koitsu »

The "shadowing" effect on the font, by the way, is also done with software (and done very efficiently/quickly). When working on Otogirisou I had to go digging into how they did their font compression routine and found it to be a 1bpp (1-bit-per-pixel) font, i.e. black and white only, yet the on-screen font was 2bpp (due to the shadowing and what the actual SNES mode mandated). I tend to use a combination of computer and paper/pencil when reverse-engineering something. I was going to paste a link to Dropbox with my work, but it appears their shit is really messed up/broken right now for me in some very weird way. Edit: It seems Palemoon has a massive problem with Dropbox and CSP, so I got it to work via the workaround posted there. Here's the link: https://www.dropbox.com/sh/80t8zwzoxg7z ... 34BQsntcOa

All rephrased: when you have a VFW font, everything has to be done in software. You "render" your text to a piece of memory/buffer, then blit (copy) that into PPU RAM whenever you need, just like you described. Because everything is done in software, you can do things like manipulate the font or add effects or do whatever you want with it. The downside is that you have less CPU time to do other things than had you stuck with a static-width font.

VWF stuff tends to often be a real bitch to reverse-engineer, so if you're working on a romhacking project, you'll find that you're going to be spending a *lot* of time in a debugger + staring at disassembled code. Expect to spend several days (possibly a couple weeks) on this part.
User avatar
whicker
Posts: 228
Joined: Sun Dec 13, 2009 11:37 am
Location: Wisconsin

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by whicker »

The Secret of Mana VWF project is a gold standard for how much it can improve a game. With the added room in text boxes, the script was able to be expanded out with more personality and better explanations.

some screenshots


also props to tepples for Furniture Fight.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by Sik »

For that matter, Phantasy Star II vs Phantasy Star IV, although honestly I think the butchering in the localization of the former had more to do with having to stick to the same ROM size since it could easily handle an arbitrary amount of lines. (the original Japanese script lacked kanji so every character was one byte, but the corresponding English text would take up twice as much, so yeah...) Phantasy Star IV works around the issue by outright compressing the text (and English should compress better than Japanese).

I wonder if changing the percussion in the localization of Phantasy Star II is also to make room in memory.

EDIT: in fact, looking at those screenshots, variable width isn't helping much there since most characters (even spaces) still seem to be 8 pixels wide. So it may be a case of running out of ROM space there as well (a fantranslation doesn't have to cope with larger ROMs being more expensive).
Asaki
Posts: 81
Joined: Sat Jun 16, 2007 11:55 pm

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by Asaki »

whicker wrote:The Secret of Mana VWF project is a gold standard for how much it can improve a game.
Is that actually a retranslation? Or did they invent the extra dialogue themselves?
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by koitsu »

Asaki wrote:Is that actually a retranslation? Or did they invent the extra dialogue themselves?
http://www.romhacking.net/hacks/18/
http://www.romhacking.net/hacks/snes/pa ... readme.txt

You can decide for yourself...
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by tepples »

403 Forbidden
You don't have permission to access /hacks/snes/patches/18readme.txt on this server.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: How did Final Fantasy VI do a non-fixed-width font?

Post by Near »

VWF is fine for dialogue, but it gets to be a nightmare for 8x8 item text. There, you run into extreme issues with tile data space, the speed of rendering entire screens of information, double buffering if you don't want to cause screen flickering during refresh, etc.

It is so entirely worth the effort, but sadly nobody does it. Not even ROM hackers that are fully capable of it. The only two major examples I can think of are Der Langrisser and Bahamut Lagoon, and the latter by Dejap completely botched the implementation to the point where it's unplayably bad unless you use the "ZSNES lolwhatvblank?" patch, and even then is quite hideous with seeing garbled tiles as you scroll through lists of data.

Anyway, the one thing that stands out in my mind is that Lunar: Silver Star (the good one, not the shitty remakes) was all 8x16 fixed-width all-caps. Yeah, all-caps. And to tell you the truth, I never noticed that as being an issue until after I started ROM hacking. But today, it's a really big negative to me to play games with fixed-width fonts and heavily abbreviated item names. I guess we all get pickier with age. Exposure to so many games competing for our attention gives us the luxury of seeking out and appreciating those with extra attention to detail put into them.

> You don't have permission to access /hacks/snes/patches/18readme.txt on this server.

Come on, you of all people should know how to bypass an anti-leech script.
Last edited by Near on Thu Jun 04, 2015 7:31 pm, edited 1 time in total.
Post Reply