Friday, July 17, 2009

Silkroad CREST project

One night, I was thinking: "How does the emblem system work?". I could not sleep so I started to fiddle with Silkroad client and started off this this project.

Basics

Silkroad stores guild/union crests on stand-alone FTP server. There is no obvious reason for this implementation and I do not understand why they have done it in this way.

Another weird fact is that files are kept in single directory which makes it really difficult to load (takes long).
Following example shows list of some files from crest storage.
A10_1363_2.crb
A10_1363_3.crb
G90_350_5.crb
G90_350_6.crb
File naming
A10_1363_2.crb
File name written above can be split into these parts:
Name                    Description
---------------------------------------------------
type                    Type of crest (Aliance, Guild)
serverId                ID of server
guildId                 ID of guild
crestIndex              Index of crest
File data
Silkroad uses 16x16 pixel big 8bpp bitmaps with static color palette and no compression. Thus, stored crests on FTP server are 256B big.

Once you know this, it is simple to rebuild "original" bitmap from crest file.
You only need basic knowledge of BMP structure. BMP is composed of 4 logical parts, as is shown below:
header
meta
palette
bitmap (crest file content)
Crest file contains bitmap part of BMP. Since header, meta and palette are static, it is easy to rebuild bitmap:
static part (header, meta, palette)
dynamic part (bitmap)
Issues
  1. FTP server is damn slow
  2. Requests timeout on some occasions
Results
  1. Crest downloader & converter (running)
  2. Some crests from Korean Silkroad.

1 comment:

  1. Hello.
    Can you upload 1 Conveted File please?
    I got trouble with the color table.
    Thanks!

    ReplyDelete