Progress Continues


Update

So it’s been a while (around 2.5 years) since I did some proper work on this project, but now I’ve got some motivation and drive back to work on SkyWays.

During this time a “new” compiler for the CD-i was disovered. The old one only ran within a 32 bit Windows VM and crashed a lot. With the new compiler a VM is no longer needed, making development easier and less frustrating.

3D Depth Effect

The CD-i is a 2D console, so to create The graphics for SkyWays uses three layers:

  • The bottom layer is an MPEG video showing the backdrop
  • The middle layer is the track, which is pre-rendered outside of the CD-i and stored in the level data
  • The top layer consists of the ship and the HUD

Together this creates the illusion of a 3D environment, and if there only was a flat track, this would probably be enough. However there are height differences and tunnels, and drawing the ship always on top breaks this illusion, as you can see in the image below. The ship should be inside of the tunnel (and thus hidden):

Ship should be hidden in tunnel

In order to solve this, two things are needed:

  1. Figure out which parts of the ship should be invisible
  2. A way to hide or remove these parts of the ship

Transparency

Let’s tackle the second problem first. The most obvious solution would be to simply erase the pixels that should not be visible. This would also mean the pixels would have to be added back when they become visible again or restart with a full ship on every frame. Most games on the CD-i have a screen buffer with all pixels on which the graphics are drawn. The aforementioned pixel manipulation would be a perfectly suited solution for that.

However, that’s not how SkyWays operates. When the ship is moved in SkyWays, no changes are made to the pixels on the graphics buffer itself, instead the start position from which the pixels are displayed on the screen is manipulated. For example, if the ship moves one pixel to the left, the start address is increased by one pixel, shifting everything on the screen (and thus the ship) to the left.

Another way to control which pixels are visible is using the “Matte” system. Without getting too technical, with the Matte system it is possible, among other things, to turn on and off transparency on certain positions of a display line. Therefore, if transparancy is turned on for certain pixels of the ship, these would not be shown on screen and thus hide those pixels.

If this logic is reversed, namely that transparency is always on and only turned off for pixels that should be visible, some other effects become possible. One of the features that I wanted to add in SkyWays is that the ship has multiple graphics, showing it in different orientations based on the position (left to right) on the screen. Using mattes all of these orientations can be in a single image, and only the correct one is shown:

Side-by-side all ships on one line, only the right ship

Depth

Originally, I considered the problem of determining which parts of the ship should be hidden, one of the hardest ones that needed to be solved for the game. However, if we pretend the sprite of the ship to be “flat”, we can cheat by using the same process to export the level, to also generate the transparency data.

The exact way the level export and loading works is a topic for a future post, but in essence it operates in the following way:

  • The level is created as a 3D scene
  • For each position along the track this scene is rendered to an image
  • This image is shown on the CD-i as a background to the ship
  • When the ship moves forward along the track, the next image is shown

The ship in SkyWays has a fixed distance from the camera. If, when rendering the level to an image, the level is clipped at the position of the ship, the rendered data represents the parts that should be shown on top of the ship. An example of this is shown in the images below.

Render of full screen next to render of overlay only and last black-white representation of overlay

Thus, the level is rendered twice, once with and once without the clipping mask, and saved in the level file for each position along the track. In order to save memory the clipping mask is not exported as an image. Instead, only the position of the transitions (white -> black and black -> white) are exported for each line.

The game combines these transitions with the position of the ship to determine what parts should be visible, resulting in a final image:

Next Steps

A lot of progress has been made, but there’s still a long way to go before the game is complete. Next I want to work on the interaction of the ship with the level, so that you can actually jump on and between blocks, and fall into the void if you miss.

Comments

Log in with itch.io to leave a comment.

(1 edit)

Great! That you continue with this and keep the system alive, think you are the only one in the world who still makes something for the CD-I. Unfortunately I can not get further than making films and Kodak CD on CD-I. Hats off that you master this technique! Greetings,  an old rock-solid CD-I Fan.

Great to hear this is still in development - keep me posted for Retro Gamer!