I think that one of the most peculiar aspects of Ultima VII original code (which is a supreme example of what I use to call "Programming ART") is the dynamical palette manager of the indexed VGA colours it had.
I think that Exult 256-colour palette is divided into four types:
1) System Colours: reserved for fonts (menus, dialog, books/scrolls, etc.), mouse pointers, menus, paperdolls, gumps and the like. They are altered by lighting only (day, night, sunrise/sunset, dungeons/lamps/torches, thunderstorms, etc.)
2) World Colours: used for textures in the game, portraits, items and character sprites. They are altered by lighting conditions only and are most of the 256 total colours (i guess they're much less thane one would think)
3) Magic Colours: used for magic-related items (potions, scrolls, items, etc.). Their palette is constantly changing AND is subject to lighting conditions, too.
There are several subsets of slots (e.g. 3 for "cyan" or "cold" magic, 3 for "green" magic, 5 for "red/orange/yellow" or "fire" magic, 3 for "purple" magic, and so on) whose RGB values cycle around, indipendendly, to create the magnificent look of magica auræ around objects or inside apparata. Pure genius!
4) Transparecy Colours: used for transparency effects such as shadows, glasses, invisible objects (chests, bags, caltrops, characters), ghosts, blood and other corporeal fluids (monster blood, puke, garbage, spider silk, etc.). Their palette continuously adapts to the requirements, and still change according to other transparent or magical objects, and to lighting conditions as well.
The wonderful thing is that you can still put a slained slug (with its transparent green blood) on a dead human's body (with its transparent red blood) under a glass window (transparent white), wait for a cloud (transparent black) to come over the scene... and still be able to discern some pavement's details !!!!!
I think that the adaptive algorithm which computes the number of "transparency layers" and reserves as many colours as needed to discern the objects is SIMPLY Astonishing.
My question: is my assumption correct? And what soruce file(s) is the Exult's palette manager coded into?
dynamical palette engine
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Re: dynamical palette engine
Actually in the old dos days, I remember I could obtain the same effect simply by keeping a 256x256 array which told me "color X + color Y = color Z".
To create it, I just went into Autodesk Animator Pro, which had the best palette tool at that time, and created two 256x256 linear gradients, each line holding one of the palette's 256 colours. Then I rotated one by 90 degrees, and proceeded blending the first over the second.
+
=
With this, you've got a matrix where you can fish for blendings. Take red #15 + blue #175, go to [15,175] and you've got a soft purple.
To create it, I just went into Autodesk Animator Pro, which had the best palette tool at that time, and created two 256x256 linear gradients, each line holding one of the palette's 256 colours. Then I rotated one by 90 degrees, and proceeded blending the first over the second.
+
=
With this, you've got a matrix where you can fish for blendings. Take red #15 + blue #175, go to [15,175] and you've got a soft purple.
Re: dynamical palette engine
Your assumptions are mostly correct, but things are not as complex as you might imagine.
Lighting is handled by having different palettes. They range from dark (night) to bright (day) and are stored in palettes.flx.
Translucency is handled by lookup tables. Each type of translucency (red, green, grey, ...) has a lookup table attached to it. It simply maps a palette entry to another palette entry. These tables are stored in xform.tbl. So, when drawing a translucent pixel, we lookup the current pixel (i.e., of the object beneath the translucent object) in the correct table and paint the new pixel.
Finally we rotate a number of groups of palette entries periodically to provide the glowing/magic effect.
Lighting is handled by having different palettes. They range from dark (night) to bright (day) and are stored in palettes.flx.
Translucency is handled by lookup tables. Each type of translucency (red, green, grey, ...) has a lookup table attached to it. It simply maps a palette entry to another palette entry. These tables are stored in xform.tbl. So, when drawing a translucent pixel, we lookup the current pixel (i.e., of the object beneath the translucent object) in the correct table and paint the new pixel.
Finally we rotate a number of groups of palette entries periodically to provide the glowing/magic effect.
-
- Posts: 468
- Joined: Thu May 14, 2020 1:34 pm
Re: dynamical palette engine
And that's the technique used by 99% of the games of that time.
- Gradilla Dragon