Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a revised version of the PAL specification #71

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions docs/file-formats/PAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,28 @@ slug: /file-formats/pal
title: PAL (Placeholder)
---

:::info
This document describes the PAL file format used in the Ragnarok Online client.

This section is a placeholder. If you know anything about the topic, please help fill it with content!
## Contents

:::
PAL files are alternative [color palettes](<https://en.wikipedia.org/wiki/Palette_(computing)>) used to tint sprites. To be specific:

- An array of 256 8-bit RGBA color values is appended at the end of any (modern) [SPR](/file-formats/spr) sprite - the "default palette"
- All standalone PAL files found in the game client are using exactly the same format, which makes it easy to recolor sprites
- The client can swap any one of them in to replace the default palette, with certain palettes matching specific sprites

All the same limitations apply to the default and alternative palettes - that is to say, transparency isn't supported.

## Alpha Channel

Transparency is determined for each color according to its RGBA values, after loading the palette:

- The color stored at palette index 0 is considered the transparent background color - usually red, green, or magenta
- Colors that are "close" to the transparency color might also be rendered transparent (warning: unverified claim)
- If a palette contains alpha values, they appear to be ignored in favor of the actual transparency color

The exact behavior requires some verification still, but a possible approach was described [here](https://github.com/rdw-archive/RagnarokFileFormats/blob/master/PAL.MD) (might be incorrect, though).

## Layout

See the `ColorPalette` field in the [SPR layout table](/file-formats/spr#layout). Any SPR file above version `1.1` includes a default palette (i.e., all of them do).
Loading