Kings of the Beach Font

From ModdingWiki
Jump to navigation Jump to search
Kings of the Beach Font
Kings of the Beach Font.png
Format typeFont
Max glyph count91
Minimum glyph size (pixels)8×6
Maximum glyph size (pixels)8×6
Access modeIndexed
Metadata?None
Bitmap glyphs?Yes
Vector glyphs?No
Compressed glyphs?No
Hidden data?No
Games

The font used in Kings of the Beach is an 8x6 pixel 1-bit font that supports custom character widths, but lacks a real header. It always has 91 symbols, starting at symbol code 0, and ending after the standard ASCII uppercase 'Z' character. It contains no lowercase characters.

Font extraction

The font needs to be extracted from either the VBCGA or VBEGA file, however, these files are compressed using EXEPACK v4. You will need an application like UNP to decompress them first.

After decompression, the font data can be found at:

  • VBCGA: 2C503 (637 bytes)
  • VBEGA: 2BD93 (637 bytes)

The data is identical in both files.

Since it does not exist as separate file, the font data will need to be extracted to a file for editing in an editor, and reinserted afterwards.

Note that these locations may differ depending on the unpacking tool. If they do not match, the symbol data analysis below can help you find the byte data for the 'A' character, which should be 0x1E1 bytes after the start of the file.

File format

Offset Data type Name Description
0x00 UINT8[0x5B] SymbolWidths Symbol widths array.
0x5B UINT8[0x5B * 0x06] FontData Font data, in blocks of 6 bytes per symbol.

To accurately identify a file as being a KotB font file, all you need to check is if the file size is exactly 0x5B * 7 = 0x27D (637 bytes), and if none of the values in the first 0x5B bytes contain a value higher than 8.

Symbol data

Since the symbol data starts from 0, all you really need to do to find and visualize a symbol with code SymbolCode is to read the data at FontData[SymbolCode * 0x06], visualize each byte as a row of 1-bpp pixels, and cut it off at the width specified in SymbolWidths[SymbolCode].

For the character 'A', the symbol code is 0x41, meaning the data offset is 0x5B + 0x06*0x41 = 0x1E1, and the width can be found at offset 0x41.

The six bytes at offset 0x1E1 are 60 90 F0 90 90 00, and the width value at offset 0x41 is 05. The resulting image:

60 .11..---
90 1..1.---
F0 1111.---
90 1..1.---
90 1..1.---
00 .....---

Note that some symbols seem to have an incorrect width in the widths array; for example, the symbol at code 0x3D, which should be '=' in ASCII, is actually a right-facing arrow '➞'. However, while the font data contains the full arrow, its width is set to 5 instead of 6, cutting off the arrow's point. The simple '-' dash at code 0x2D likewise seems one pixel too short, missing the padding pixel behind it, and can be seen sticking to the next letter when used in-game. For some reason, the '+' character at code 0x2B is a duplicate of the '-' one, but with two extra blank pixels behind it.

Tools

The following tools are able to work with files in this format.

Name PlatformView images in this format? Convert/export to another file/format? Import from another file/format? Access hidden data? Edit metadata? Notes
Westwood Font Editor WindowsYesYesYesN/AN/A Created by Nyerguds