CHR Usage

From Legends of Fairwind
Jump to: navigation, search

This information applies to game backgrounds. For foreground sprites (player characters, NPCs, treasure chests, and the overworld representation of cities, towns, castles, etc) please see Sprite Limitations.

How Represented in Memory

Game backgrounds are generated using palette data (See Palette Usage) and CHR, ATTR, and NAM tables like a classic NES.

The CHR table holds 256 individual 8x8 tiles. The tiles are 2bpp which means they are 4-color graphics. The specific colors aren't stored in the CHR table, so each CHR could potentially be reused on the screen with a different set of colors.

Note: In actuality, all our graphic data is 4bpp since we store 2 extra intensity modifier bits per pixel for our "Super" graphics mode option, but graphics should initially be designed as 2bpp and then enhanced with intensity bits after the 2bpp version has proven satisfactory.

There can be four palettes active at one time for the background layer. Each of these palettes defines colors #1, #2, and #3. Color #0 is the background color and must be the same for the entire screen.

The NAM table holds the CHR values for the entire "scene." The ATTR table holds the palette index for each 2x2 block of NAM table tiles.

Visible Area

The visible portion of the NAM table on the NES was 32x30. (Actually slightly less on NTSC systems where part of the edges got cut off.)

We are considering our mobile platforms as if they have a 28x18 visible area.

CHR Allocation

The game reserves the first half of the CHR table for text and dialog boxes (except for the copyright symbol which is used only for the title screen.) Although some of these will also be useful for creating scenes as character #0 (0x00) is filled with color 0, character #9 (0x09) is filled with color 3, character #16 (0x10) is filled with color 2, and character 32 (0x20) is filled with color 1.

Additionally, the last 32 entries in the CHR table are reserved for item icons and indicators.

This leaves 6 "rows" of 16 entries for each domain (level/dungeon/map) to allocate as needed. Since most blocks are composed of a 2x2 arrangement of CHR tiles, that equates to roughly 24 visually distinct block types on a given map. This can be increased by some block types sharing certain CHRs or repeating the same CHR entry.

The domain editor automatically manages the free CHR space and fills it with the tiles for the block types in use on your map. If you exceed the amount of CHR space available, you will begin to see blank spots or X's on your map while in the editor. This means you need to reduce the amount of unique blocks on that particular map.

CHR Sets and Sizes

Each domain has room for 97 unique tiles in its background CHR set. The 4 solid colors tiles aren't counted as they are already present in the reserved set.


Suggested Nature Tiles for Towns

48 tiles total:

Plateau = 26 Tiles (24 Tiles + 2 Shadow Tiles)

Either Oak or Pine Trees = 12 Tiles (10 Leaf + 2 Trunk)

Grass = 6 Tiles (3 Tiles + 3 Shadow Tiles)

Water = 4 Tiles (2 Tiles + 2 Shadow Tiles)

Suggested Buildings for Town

18 tiles total:

Building = 18 Tiles (1 Roof + 1 Roof Peak + 2 Wall + 2 Window + 2 Chimney + 6 Gable + 4 Closed Door)

Ideas for Additional Building Sets

Bold indicates completed.

- Log Cabin (For Tornwald, Fairport, etc.)

- Stucco (Using the wood palette, for Portico and parts of Forthgard; somewhat like spanish mission architecture)

- Tudor (For most of the medium sized towns in Caledonia)

- Granite (For Darkhelm, Forthgard - possible to use existing interior stone wall tiles for the outside walls)

- Roundstone (Ardbaile, Tansmere, etc.)

- Thatch (For Teeburi village, Fashiki village, etc.)

Town Sign Sprites (NEED DESIGN)

Up to one of these sprites each will be used per town. They are mentioned here just to point out that they are not background blocks:

Armor Sign, Weapon Sign, Church Sign, Magic Sign, Item Sign, Inn Sign, Stable Sign, Wainwright Sign

Suggested Accessories for Towns

19 tiles total:

Stone Walls = 8 Tiles

Horizontal Bridge = 4 Tiles

Vertical Bridge = 2 Tiles

Pot = 4 Tiles

Garden/Flower = 1 Tile

Total So Far

If all Town Tiles so far are used (one type of tree only), 85 tiles are occupied. 12 tiles remains.

Pick a Path Type

Sharp Sand = 4 Tiles (2 Tiles + 2 Shadow Tiles)

Smooth Sand = 8 Tiles (In addition to the Sharp Sand tiles)

Cobble Path = 5 Tiles

Stone Path = 4 Tiles

Optional for Towns

Arched Door = 4 Tiles

Signpost = 4 Tiles (May also be used sparingly as a sprite.)

Fence = 3 Tiles

Swamp = 2 Tiles (Shares other tiles with Sand)

Ice = 2 Tiles

Waterfall = 2 Tiles

Water Well = A sprite since there is only one per town.


Overworld Oak Groves = 14 Tiles (12 Leaf + 2 Trunk shared with Pine Groves)

Overworld Pine Groves = 10 Tiles (8 Leaf + 2 Trunk shared with Oak Groves)

Overworld Mountains = 8 Tiles

Overworld Oceans = 12 Tiles (8 Coasts + 4 Waves)

See Sample Shots.