SCI Specifications: Chapter 1 - Introduction
Introduction
The basics
The Sierra Creative Interpreter is a stack-based virtual machine ("P-Machine"). In addition to its roughly 125 basic opcodes, it provides a set of extended functions for displaying graphics, playing sound, receiving input, writing and reading data to and from the hard disk, and handling complex arithmetical and logical functions. In version 0.xxx of the interpreter, Sierra split the game data into nine different types of information:
script data: SCI scripts and local data
vocab data: Parser data and debug information
patch data: Information pertaining to specific audio output devices
sound data: MIDI music tracks
cursor data: Mouse pointer shapes
view data: Sets of sets of image and hotspot information
pic data: Background images and metadata
font data: Bitmap fonts
text data: Plain text information
Each game may contain up to 1000 different elements of each data type; these elements are referred to as "resources". The index numbers of the various resources need not be in sequence; they are usually assigned arbitrarily. [1]
Resource Storage
Individual resources can be stored in one of two ways: Either in resource files (which, surprisingly, are called something like "RESOURCE.000" or "RESOURCE.001"), or in external patch files (not to be confused with "patch" resources). The external files are called something like "PIC.100" or "script.000", and they take precedence over data from resource files.
There is also a file called "RESOURCE.MAP", which contains a lookup table for the individual resources, and another file, "RESOURCE.CFG", which contains configuration information.
Resource information stored in external patch files is not compressed and therefore easily readable. It is, however, preceded by two bytes: The first byte contains the resource type ORed with 0x80, the purpose of the second byte is unknown (but it appears to be ignored by the original SCI version 0 engine).
As stated before, external patch files take precedence over resource resource files. Applying those external files as patches is an option since FreeSCI version 0.2.2.
The resource files, however, are more complicated. Each of them contains a sequence of resources preceded by a header; these resources may be compressed. It is, also, quite common to find resources shared by several resource files. The reason for this appears to be that that, back when hard disks were rare and hard to come by, the games had to be playable from floppy disks. To prevent unnecessary disk-jockeying, common stuff was placed in several resource files, each of which was then stored on one disk.
The individual resources: A summary
The resource types of SCI0 can be roughly grouped into four sets:
- Graphics (pic, view, font, cursor)
- Sound (patch, sound)
- Logic (script, vocab)
- Text (Text resources are nothing more than a series of ASCIIZ strings)
- ↑ With several notable exceptions, such as script 0 and most vocab resources.