GSoC Week 9: Space, and glitchy planet rendering

This past week has been spent on space; trying to make heads or tails of the game’s “pseudo-3d” engine. And, while it hasn’t been entirely unsuccessful, progress on this front has been relatively slow.

I started by getting the background starfield working. It involved some trigonometric functions and matrix multiplication. Nothing too insane, once I figured out what I was looking at. To complicate matters, the game has at least 3 fixed-point decimal formats, including a format specifically for numbers between -1 and 1, in addition to using the processor’s floating-point hardware on occasion.

Encouraged by this early progress, the next step was to make more elements of the game’s intro visible, starting with the red planet the Enterprise flies past. However, when I finally reached the function which draws space objects to the screen, the function graph showed me this would be no picnic.

Each box is a block of code, some too small to see.
Each box is a block of code, some too small to see.

Despite my best efforts, I was unable to quite get this working properly. I discovered today that I didn’t even have an accurate view of the function, because part of the code is overwritten from elsewhere before it gets called! Perhaps because of this incompleteness, I was only able to get a sliver of the image to appear in a glitchy way.

I’ll figure this out, eventually. But I alotted myself a week to work on this before moving on to other things, so I’ll come back to this later. It’s time to start focusing on code cleanup so this can be merged into scummvm, as well as finishing up the away missions. Then, I’ll come back to finish space combat and everything between missions.

Written on July 24, 2018