Difference between revisions of "SCI Specifications: Chapter 1 - Introduction"

From SCI Wiki
Jump to navigationJump to search
Line 41: Line 41:
 
*Text (Text resources are nothing more than a series of ASCIIZ strings)
 
*Text (Text resources are nothing more than a series of ASCIIZ strings)
 
<!--; but the other resources deserve further discussion.-->
 
<!--; but the other resources deserve further discussion.-->
 +
 +
&nbsp;
 +
==== Graphical resources summarized ====
 +
 +
The screen graphics are compromised of the four graphics resources. The background pictures are drawn using vector-oriented commands from at least one pic resource (several resources may be overlaid). The fact that vector graphics were used for SCI0 allows for several interesting picture quality improvements. Pic resources also include two additional "maps": The priority map, which marks parts of the pictures with a certain priority, so that other things with less priority can be fully or partially covered by them even if they are drawn at a later time, and the control map, which delimits the walking area and some special places used by the game logic. FreeSCI uses a fourth auxiliary map for during drawing time (this is a heritage from Carl Muckenhoupt's original code).
 +
 +
View resources contain most of the games' pixmaps (multi-color bitmaps). Each view contains a list of loops, and each loop contains a list of cels. The cels themselves contain the actual image information: RLE encoded pixmaps with transparency information, and relative offsets.
 +
 +
View resources are used for foreground images as well as for background images (for example, the "Spielburg" sign in QfG1 (EGA) is stored in a view resource and added to the background picture after it is drawn).
 +
 +
The cursor resource contains simple bitmaps for drawing the mouse pointer. It only allows for black, white, and transparent pixels in SCI0.
 +
 +
The fourth graphics resource is font data. It contains bitmapped fonts which are used to draw most of the text in the games. Text is used in one of four places: Text boxes, Text input fields, the title bar menu, and occasionally on-screen.

Revision as of 16:58, 5 September 2013

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:

 

Graphical resources summarized

The screen graphics are compromised of the four graphics resources. The background pictures are drawn using vector-oriented commands from at least one pic resource (several resources may be overlaid). The fact that vector graphics were used for SCI0 allows for several interesting picture quality improvements. Pic resources also include two additional "maps": The priority map, which marks parts of the pictures with a certain priority, so that other things with less priority can be fully or partially covered by them even if they are drawn at a later time, and the control map, which delimits the walking area and some special places used by the game logic. FreeSCI uses a fourth auxiliary map for during drawing time (this is a heritage from Carl Muckenhoupt's original code).

View resources contain most of the games' pixmaps (multi-color bitmaps). Each view contains a list of loops, and each loop contains a list of cels. The cels themselves contain the actual image information: RLE encoded pixmaps with transparency information, and relative offsets.

View resources are used for foreground images as well as for background images (for example, the "Spielburg" sign in QfG1 (EGA) is stored in a view resource and added to the background picture after it is drawn).

The cursor resource contains simple bitmaps for drawing the mouse pointer. It only allows for black, white, and transparent pixels in SCI0.

The fourth graphics resource is font data. It contains bitmapped fonts which are used to draw most of the text in the games. Text is used in one of four places: Text boxes, Text input fields, the title bar menu, and occasionally on-screen.

  1. With several notable exceptions, such as script 0 and most vocab resources.