Version 1.2 - May 22, 2009
by Christophe Fontanel
The Hint Oracle is a tool found on the Chaos Strikes Back Utility disk. It looks in your saved game and gives you hints based on the location of your champions in the dungeon.
The Hint Oracle uses the data in the file HCSB.HTC to perform this task.
Each hint consists of a name and one or more pages. In the Hint Oracle, you have to click on the "Next" button to see the next page. In that way you can just read the hint part you need.
The goal of this page is to describe the format of .htc files.
The Hint Oracle hints file HCSB.HTC contains:
If your party is located on level 05 at coordinates (25,07) and you run the Hint Oracle, the following hint will be available:
In the HCSB.HTC file, a location is defined to associate the coordinates with the hint number : (05,25,07) / 195.
The hint number 195 is defined with its name and it contains 3 pages numbered 426 to 428.
The file format is exactly the same for Chaos Strikes Back for Atari ST and Amiga. It uses big endian format: the most significant byte of a word (2 bytes) is stored first.
You can convert files between .htc and .txt formats with the HTCConverter v1.0 that I wrote.
The following table lists all known Hint Oracle files:
|Hints File Description / MD5 Hash||File size||Number of locations||Number of hints||Number of pages||Notes|
|HCSB.HTC Release 1 (Atari ST 2.0 & 2.1 EN, Amiga 3.x EN)
|HCSB.HTC Release 2 (Amiga 3.x EN)
||68912||5036||219||512||Test file for translations mistakenly released|
|HCSB.HTC Release 3 (Amiga 3.x EN)
|HCSBF.HTC (Amiga 3.x FR)
|HCSBG.HTC (Amiga 3.x GE)
Here is a detailed description of the contents of the HCSB.HTC file from Chaos Strikes Back for Amiga Utility Disk English Release 1.
This example is used to show the structure of an .HTC file. Offsets would be different in other files with arbitrary numbers of locations, hints and pages.
In this part of the document, each section of the file is entitled with the following information: Offset hexadecimal (offset decimal) Size of section in bytes - Description of section.
Below the title of each section are details about its content.
2 bytes: 00 02 : Every hints file starts with these bytes. Their meaning is unknown.
2 bytes: 00 0D : This value is the dungeon ID of the dungeon that this hints file applies to. The same value is stored in the first word of the corresponding dungeon.dat file. In Chaos Strikes Back, the dungeon is supplied as a saved game and the dungeon ID has the same 00 0D value.
2 bytes: 00 03 : Every hints file has these two bytes. Their meaning is unknown.
2 bytes: 12 37 (4663) : Number of location records in the file.
2 bytes: 00 06 (6) : Size of each location record in bytes.
Each location record is defined by 6 bytes (4663 locations * 6 bytes = 27978 bytes).
1 byte: X coordinate. Value between 00 and 1F (00-31). (Level offset must not be included).
1 byte: Y coordinate. Value between 00 and 1F (00-31). (Level offset must not be included).
1 byte: Level number. Value between 00 and 0F (00-15). (The Chaos Strikes Back dungeon has 10 levels so only values between 00 and 09 are used.)
1 byte: Unused, always 00.
2 bytes: Hint number associated to the location.
2 bytes: 00 D2 (210) : Number of hint records in the file.
2 bytes: 00 1A (26) : Size of each hint record in bytes.
Each hint record is defined by 26 bytes (210 hints * 26 bytes = 5460 bytes).
22 bytes: Hint name, up to 21 characters, terminated with a 00 byte. Allowed characters: A-Z and space. Padded with 00 bytes. The first 00 marks the end of the name. Some hints have some characters after the first 00 byte. These characters are ignored by the Hint Oracle.
2 bytes: Index of the first page of the hint.
2 bytes: Number of pages in the hint.
2 bytes: 01 EC (492) : Total number of pages for all hints.
This section contains 2 bytes per hint page (492 pages * 2 bytes = 984 bytes).
The 2 bytes of the first page of a hint represent the length in bytes of the compressed hint content (which includes all the hint pages).
The 2 bytes for the subsequent pages of the hint are always 00 00.
As a consequence, the sum of all the 2 bytes values from this section equals 31734, which is the size of the Hints contents section of the file.
This section contains a sequence of variable-length compressed hint contents. The length of each compressed content is defined in the previous section of the file.
Each hint content is compressed using the LZW algorithm (see below).
After decompression, each hint content is a string containing the text of all the pages of the hint. Each page is ended by a 00 byte.
Each page can contain up to 12 lines of around 30 characters maximum.
The ASCII character number 2Fh (slash) is used as carriage return. The Atari ST and Amiga English Release 1 versions of the hint Oracle do not display characters above 7Fh. The Amiga English Release 3 version displays these characters for multilanguage support. The Atari ST and Amiga English Release 1 versions of the hint Oracle display the ASCII character number 96h as a space. The Amiga English Release 3 version displays the character correctly.
The hints contents are compressed with the LZW (Lempel, Ziv and Welch) dictionary compression algorithm.
If you want to learn more about this algorithm, you should read the LZW Data Compression article by Mark Nelson, published in Dr. Dobbs's Journal in 1989. This is the article I used to understand and then implement the algorithm in my HTCConverter.vbs script.
The things to know about the use of this algorithm by the Hint Oracle are:
In binary representation: 99 A4 D0 54 10011001 10100100 11010000 01010100 These are the decoded ^ ^^ ^^ ^ strings (we only have | || || | single characters -----|--------||--------||--------| +-- because the first 3 etc.. 3rd 9bit 2nd 9bit 1st 9bit | codes are lesser than code code code | 256). The hint starts "i" "h" "T" <--- with the word "This".
I wish to thank Paul R. Stevens, the man who ported Chaos Strikes Back to Windows. His source code and the Hint Oracle dump feature of Chaos Strikes Back for Windows were very useful to produce this document.
Version 1.2 - May 22, 2009: Added list of known hint files.
Version 1.1 - September 10, 2008: Added explanation of the dungeon ID value at the beginning of the file.
Version 1.0 - August 31, 2002: First release