News:

11 March 2016 - Forum Rules

Main Menu

Variable Width Font (VWF)

Started by wyndcrosser, March 12, 2013, 05:44:02 PM

Previous topic - Next topic

wyndcrosser

Hello,

I'm looking to incorporate this into my neo geo pocket color rom translations. However, I'm a little lost. I've read through examples like below, but I think I need something of an over-all clarification of what VWF does, if anyone would like to break it down for me. I'll continue doing my own research, but any assistance would be great.

http://www.romhacking.net/documents/245/

thanks

Wynd

Gideon Zhi

To understand what exactly a VWF does, you need to understand how bitplane graphics work. At the most basic 1bpp (monochrome) level, take a byte and think about it as binary. A 1 denotes a pixel displayed, a 0 denotes a pixel transparent. As such, you can get eight pixels per byte (eight bits per pixel.) Stack eight of 'em together, and you get an 8x8 tile. So something like...


00000000
00011000
00100100
00111100
00100100
00100100
00100100
00000000


... voila! A crudely-drawn A.

Of course, when you think of tiles, you're generally stuck with a rigid 8x8, 8x16, 16x16 structure. As such, we need an actual picture or bitmap of our text in RAM. So instead of storing the entire alphabet/tileset in RAM or VRAM, you store a picture of the text you want to display. You can use arithmetic and logical shifts to move bits around in your font tile (thus shifting it to the left or right, depending on how your code is written), then you use a binary AND operation to merge your tile with the bitmap. You have to keep track of the previous character's shift value, though, so you know where to put the new tile and how many shifts you need to do.

Tomato

I don't know if it'll help or not in this case, but I sometimes went into detail about this sort of thing while working on Mother 3. Here's an example of trying to explain how VWFs sort of work: http://mother3.fobby.net/blog/2008/03/29/welcome-to-text-welding-102/

Gideon Zhi

Quote from: Tomato on March 13, 2013, 01:27:55 PM
I don't know if it'll help or not in this case, but I sometimes went into detail about this sort of thing while working on Mother 3. Here's an example of trying to explain how VWFs sort of work: http://mother3.fobby.net/blog/2008/03/29/welcome-to-text-welding-102/

Yeah, read this. It's basically what I was trying to say only a hell of a lot clearer.

wyndcrosser

Thanks for responding, I'll look through it.

I'm having a hell of a time making Biomotor Unitron 2 make sense, when I'm limited on space.

Pikachumanson

Would a MTE routine work on a Neo Geo Pocket game?

KingMike

I'm sure the NGP can handle MTE. ;)

Now whether it can feasibly be created and inserted with available tools is a different question. :)
"My watch says 30 chickens" Google, 2018

Pennywise

#7
Quote from: Pikachumanson on March 15, 2013, 04:42:50 PM
Would a MTE routine work on a Neo Geo Pocket game?

All hack concepts are universal. The only thing that makes them different are the limitations of the system and the ASM involved. Even something like a VWF can be done on the NES depending whether or not a game has VRAM.

Quote from: wyndcrosser on March 15, 2013, 04:41:14 PM
Thanks for responding, I'll look through it.

I'm having a hell of a time making Biomotor Unitron 2 make sense, when I'm limited on space.

A hacker's best friend is expansion or compression. It makes dealing with space restrictions relatively trivial. I would recommend looking at some technical docs to see what is possible and what's not especially for something like expansion.

Also if you're dealing with space restrictions with the text, you probably won't be able to do a VWF. The extra code and data will need extra space of its own that the game just doesn't have the room for currently.

wyndcrosser

I don't quite understand how it works, but from what I understand I can clear out the Japanese script and use all of that space for creating the letters, similar to the guide you guys posted earlier.... I guess I don't understand how to make the game "look" for letters "here and there" instead "there". It's probably just something I'm going to have to dig through to understand.

Thanks

FinS

Simply put, a normal text routine writes the pointers to the tiles containing the letters.  A vwf draws the tiles which are being pointed to which allows the letters to be scrunched together.

Gideon Zhi

That makes my brain hurt. Very much improper use of the word "pointer"! You're streaming the text from ROM either way; the only difference is how it's represented in VRAM.

With a tiled font, you have the entire font stored in VRAM. Each font tile is indexed along these lines. A lot of people don't understand the relationship between tiles and their hexadecimal representation... Anyway, elsewhere in VRAM, you have a tilemap, a complete index of every tile in a given layer on the screen. If you wanted to write the word "CAT" to the screen in Journey to Silius (see above) you'd write 0C 0A 1D into the tilemap, along with whatever other necessary data goes into the tilemap (palette index rotation data on the SNES, for example).

With a VWF, you're just drawing a picture of the text. You still have a regular font stored in the ROM, but it just grabs it one letter at a time, does a shift, then paints it into VRAM. It still tilemaps it - with nothing written into the tilemap, you wouldn't have anything to display - but it might write something like 00 01 02 03 for a string that, once rendered, only takes up four tiles.

Wynd, correct me if I'm wrong, but you still don't even have a grasp on text pointers, yes? In other words, you're currently limited to how long the strings are in the games you work on. Let me tell you, there are two types of "space" you need to consider when it comes to translation hacking - ROM space and screen space. Your capability to store longer strings in the game you're working on is a ROM space issue. The capability to list a word in an interface that's longer than the developers originally planned is a screen space issue. Having a VWF will make your text nice and pretty, and might help you fit "Shield of Faith" into a space that used to only accomodate eight letters, but it's not going to help you with storage at all, and it's frankly one of the more advance topics particular to our field. No disrespect, but please, learn to walk before you try to run.

"Clearing out the Japanese script" as you put it will help with your ROM space troubles, provided you know about text pointers. VWFs are really really nice to have, but are generally a nice aesthetic touch more than anything else.

Bongo`

Quote from: Pennywise on March 17, 2013, 07:23:14 PM
Also if you're dealing with space restrictions with the text, you probably won't be able to do a VWF. The extra code and data will need extra space of its own that the game just doesn't have the room for currently.

  If the NGP is anywhere near flexible with ROM access as the SNES is, then do what I do
and that is use the actual Font space in ROM as code AND font data since a standard ASCII
font will not require as much space anyway. Works well if you have 24-Bit or greater "jump-ability"
in NGP asm.
R.I.P Rose Mary C. 11/20/1937 - 2/11/2007
Dynamic-Designs Over 30 years of video game experience!
Completed: Doraemon RPG, Fuzzical Fighter, Gulliver Boy, Just Breed, FEDA, Mystic Ark, Slayers ( Co-op ), Lennus-II
Current: Aretha-2 and many more...

Drakon

interesting, it's like, an offset?

Gideon Zhi

Quote from: Drakon on March 19, 2013, 09:52:35 PM
interesting, it's like, an offset?

Nah, what he's trying to say is that since a Japanese font has so many more characters than a Roman font, you can blank out any unused characters and use the newly-empty space for the extra code required to print the vwf.