Home
Memoirs of a Gamer
Movies I watched
Guidebook
Code Projects
Links
As previously stated, Gorgon uses a virtual 160x200 pixel screen buffer which gets stretched to a 320x200 pixel physical screen. The reason behind this choice was to ape the look and feel of Sierra Online's AGI engine, but it also has a practical rational: Half the resolution means less memory to load the image data.
Screen artwork is, as the title of this article suggests, always full screen. This rule is enforced by the scrpacker tool which is used to compile the screen artwork files. Also, because Gorgon is designed specifically for low color space video modes (ie 4 color, 16 color, 256 color), the image tools can only handle files that are stored in a indexed internal format. The supported file formats at this time are PCX and BMP, both of which MUST be 256 color files or below.
The screen package files generated are simple collections of images which can be referenced by index numbers (0 based) in scripts. There are 2 classes of screen packs used by Gorgon. There are the video mode specific files for CGA, EGA/Tandy 16 color graphics, and VGA; and then there is the priority screen collection, which is shared by all video modes. These two classes are loaded into different buffers in memory according to the class at run time. The video mode specific screens are decompressed into a color back buffer that matches the selected video mode's memory layout. The mask screens are loaded into 2 special 16 color backbuffers, the Map and Mask buffers.
The Map buffer is used for collision detection for sprites. The player sprite automatically assigns it's mask priority to whatever the color value is of the pixel in the Map buffer it's centered on (More about this in the Sprites article).
The Mask buffer is used for sprite depth masking. Every pixel of a sprite is drawn to the screen if the sprite's priority is equal to or greater than the current pixel's value in the Mask buffer.
Regardless of class or color depth, as stated above, these files are all generated using the scrpacker tool. This tool takes batch files in the form of a raw 8 bit text file with lines specifying commands used in generating the package with the format "command value". There are 4 primary commands:
RLE should always be set to "on". This can be ignored if the "-rle" switch is passed to scrpacker in the command line. Gorgon assumes all screen files are Run Length Encoded. This means that the files are usually much smaller than if the 160x200 pixel images were just dumped raw into the package. Raw images dumped produced excessively large screen pack files and was abandoned very early on. This tool is used for several other as of yet unreleased engines, hence why the tool can handle so many more resolutions and both raw and rle formatted files.
Mode has a number of supported values, but Gorgon only uses 2: cga-hf, and tandy-hf. These specify 4 color "half width" (160x200) and 16 color "half width" (160x200) respectively. The cga-hf is only used for the CGA screen artwork. Priority screens, EGA/Tandy, and VGA all use the tandy-hf mode. Note: Despite VGA's 256 color depth, Gorgon saves space in memory by using all 16 color images then applying a color shift specified by scripts.
Out is literally just specifying the file to be created by scrpacker.
Img specifies an image to package. Images are packaged in the same order they are defined in the batch file. This will inform what index to use to reference a particular image in script. The first image defined takes the index value "0" and subsequent images' indices enumerate from there.
sample_batch.ini
mode tandy-hf out res1.tnd img screen_images/screen_0.bmp img screen_images/screen_1.bmp img screen_images/screen_2.pcx img screen_images/screen_3.bmp img screen_images/screen_4.pcx |
Then processed with
scrpacker sample_batch.ini -rle |
Running this will collect the 5 files specified in the screen_images folder into the EGA/Tandy 16 color mode file "res1.tnd". These screens can then be loaded by room scripts (usually) with the command "screen.load 0" through "screen.load 4" depending on which image you want loaded at what time.