Reverse Engineering Sierra's Adventure Game Interpreter - Part 3

20th October 2018 | Programming

This is the third part of a continuing series of articles as I explore the inner workings of Sierra's Adventure Game Interpreter (AGI). This article will focus on the use of colors in these 80s games.

When I was working on my example to export the views from an AGI game, I noticed that there seemed to be some inconsistencies in the color palette values I had originally used from another code example. The original color palette had appeared to vary slightly from the standard CGA palette, but after more carefully inspecting the available colors in several AGI games, I noticed that it was indeed using the CGA colors, and not some variant palette.

The following table lists the CGA color palette, which consists of four highlights and twelve colors formed from a mixture of red, green, and blue components. Note how each of the RGB elements increments by a perfect third. In the 8-Bit Guy's video Modding a consumer TV to use RGB input, he explains how with a digital RGB signal, there are only eight colors possible using three bits (23 = 8), but an intensity signal effectively doubles the number of colors, which is what we see with the CGA color palette where most of the colors have a light and dark variant, the exception being for the brown color.

Full CGA 16-Color Palette
0 Black
(0, 0, 0)
#000000
8 Grey
(85, 85, 85)
#555555
1 Blue
(0, 0, 170)
#0000AA
9 Light Blue
(85, 85, 255)
#5555FF
2 Green
(0, 170, 0)
#00AA00
10 Light Green
(85, 255, 85)
#55FF55
3 Cyan
(0, 170, 170)
#00AAAA
11 Light Cyan
(85, 255, 255)
#55FFFF
4 Red
(170, 0, 0)
#AA0000
12 Light Red
(255, 85, 85)
#FF5555
5 Magenta
(170, 0, 170)
#AA00AA
13 Light Magenta
(255, 85, 255)
#FF55FF
6 Brown
(170, 85, 0)
#AA5500
14 Yellow
(255, 255, 85)
#FFFF55
7 Light Grey
(170, 170, 170)
#AAAAAA
15 White
(255, 255, 255)
#FFFFFF

Since the CRT monitors of the era were based off of RGB, instead of the standard primary colors of red, blue, and yellow, so the available colors are more of a mix of red, green, blue, cyan, magenta, and yellow along with several levels of highlights from black to white.

Most of the standard colors are represented with this color palette, with the notable exceptions of orange and purple, two of the three secondary colors on a standard RYB color wheel, which are absent. These two colors are simulated with the light red and magenta colors.

In the AGI version of Mixed-Up Mother Goose, the giant pumpkin (which houses Peter Peter Pumpkin Eater and his estranged wife) was more of a salmon color, since a true orange was not available. Of interest, in the SCI remake of Mixed-Up Mother Goose, the pumpkin looks much closer to orange, but upon further inspection, one will find that it still maintains the similar salmon color, but the higher screen resolution and dithering effect trick the eyes into perceiving that the pumpkin is closer to orange. It's interesting to see how doubling the screen resolution, yet keeping the same color palette gives the illusion of more colors.

Also of interest is how the colors might even vary slightly from one system to another. The screenshot at the beginning of this post is from King's Quest on an Apple ][, where the colors are slightly different from a PC, plus there are some artifacts around the edges of objects where the color bleeds. However, if the screen uses a mono tint, the images and text are a little sharper.

When the Mac version of King's Quest 2 is run through ScummVM, the green is a little more fluorescent in appearance when compared to the DOS version of the game. Whereas the PC uses the traditional #55FF55 color for the light green, the Mac uses a more vibrant #00FF00, which is in line with many of the Mac colors which tend to be a little brighter.

Apple Macintosh Default 16-Color Palette
0 White
(255, 255, 255)
#FFFFFF
8 Green
(31, 183, 20)
#1FB714
1 Yellow
(251, 243, 5)
#FBF305
9 Dark Green
(0, 100, 18)
#006412
2 Orange
(255, 100, 3)
#FF6403
10 Brown
(86, 44, 5)
#562C05
3 Red
(221, 9, 7)
#DD0907
11 Tan
(144, 113, 58)
#90713A
4 Magenta
(242, 8, 132)
#F20884
12 Light Grey
(192, 192, 192)
#C0C0C0
5 Purple
(71, 0, 165)
#4700A5
13 Medium Grey
(128, 128, 128)
#808080
6 Blue
(0, 0, 211)
#0000D3
14 Dark Grey
(64, 64, 64)
#404040
7 Cyan
(2, 171, 234)
#02ABEA
15 Black
(0, 0, 0)
#000000

As can be seen by comparing the Macintosh and CGA color palettes, they hold many similarities, but the Macintosh palette uses better representations of orange and purple.

This article was originally intended as an addendum to a previous post, but it became far more involved as I further explored how AGI and various computing platforms presented color.

AGI Color Palette

[5 April 2019 Update] I have been experimenting with a fair bit of AGI-style art lately. It was becoming annoying having to continually set the colors I wanted, so I created this custom AGI color palette for macOS. Download the file, unzip it, place the AGI Color Palette.clr file into your ~/Library/Colors folder, and then the AGI Color Palette will be available in the standard color picker under the Color Palettes tab.


References