GSoC Week 10: Nuclear moon bases

Last week I worked on mission 6, “That Old Devil Moon”. It features some interesting lore of two ancient civilizations that annihilated each other through the use of nuclear weaponry. What a totally, uh, alien and unthinkable prospect, haha…

This mission features the most obscure puzzle in the game, which involves converting “sacred numbers” from base 10 to base 3 to crack passcodes! While I personally can handle a bit of base conversion, the even bigger sin is that the hint required to open the door is missable! If you fail to look up every remotely relevant entry in the ship’s computer before beaming down, you’ll have no way of even knowing what numbers you’re even supposed to convert! I definitely had to look up a walkthrough here.

Incidentally, while implementing the text input boxes, I found a way to crash the game. Simply fill up the box, then repeatedly press the “end” key, enter a character, press “end” again, etc. Soon the text buffer overflows into something that’s probably important and the game crashes. This works because the “end” button is the only one that doesn’t check if the length of the string exceeds the maximum text size. Naturally this is fixed in scummvm.

In addition, this mission, too, has some ways to get an infinite score, by repeatedly scanning or using the computers in the final room. Using McCoy’s tricorder on the air in this room also works. That’s all in the way of bugs that I’ve found, though.

GSoC officially ends next week. I’ve opened up my pull request to the main branch, though the engine is still incomplete, so I can continue working on it in-tree; in addition to working on the final mission this week, I have some feedback to take care of before the pull request gets accepted.

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.

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.

GSoC Week 8: Set phasers to stun. …Then kill.

Last week was mostly focused on finishing up the second part of the “Feathered Serpent” mission, in which Quetzalcoatl is put on trial by the klingons for spreading messages of peace. Kirk agrees to go through a set of trials to prove his honor or something so that Quetzalcoatl can go free.

Kirk offering a fine defense.

Mission oddities

Last week, I mentioned various ways to get an infinite score in this mission. Well, there are even more, easier ways to do so in the second half, including:

  • Repeatedly scanning a door lock with Spock.
  • Repeatedly scanning an energy life-form with Spock.
  • Repeatedly carving out part of a room with a phaser.

All of the above are in a single room. This room also interestingly allows you to cancel a death if you react fast enough.

In addition, this mission has two endings (three if you just give up defending Quetzalcoatl entirely). The “main” win method is to discover a weird alien room, which is probably what most people did.

The secondary method is very obscure, and I suspect most people don’t know about it. If you don’t discover the alien room, you instead must pass a Klingon automaton blocking you.

Since the solution is so obscure, I’ll just tell you. Using the stun phaser doesn’t work; after two shots, it kills the crew. Using the kill phaser doesn’t work, either; it kills the crew after only one shot.

So, what’s do be done? Use the stun phaser, THEN the kill phaser. That will give it just enough energy to overload before it can take out the crew. …Naturally…

On my casual playthrough, I completely gave up on passing the automaton, since I already knew about the other method of completing the mission. This is an “inferior” way to beat the mission, anyway, but it’s interesting that it’s locked behind such an obscure solution.

What’s next

For now, I’m taking a break from the repetitive mission logic to take a look at the pseudo-3D and ship combat stuff. I really have no idea how long this will take, but I felt I needed to look at something fresh and different. Regardless, my primary mission is to get the away missions working and I only have 3 weeks left (officially), so I’ll return to that if time doesn’t allow me to finish the starship stuff. Due to the belatedness of this post, there’ll be another later this week.

GSoC Week 7: What does Quetzalcoatl need with a starship?

This week, in addition to finishing up the Harry Mudd mission, I’ve done the first half of mission 5, “Feathered Serpent”. This is the only mission to be divided into two “away mission” segments, with another ship segment between the two.

In classic Star Trek style, we encounter the Aztec god Quetzalcoatl (Quetzecoatl?) attempting to bring enlightenment to the Klingons. Lt. Buchert must have jinxed us when he mentioned the absence of any angry gods last mission.

The first half of the mission consists of eight rooms, which is technically a record so far, but some rooms are little more than scenic pathways. It’s also very linear compared to other missions. There’s only one case where you might have a reason to backtrack at all, and often you’re prevented from going back to previous rooms entirely.

This mission has some rather pretty screens.

Mission oddities

There is a case where you can scan Lt. Stragey (the redshirt) while he’s dead, and someone who is… clearly not McCoy, say “He’s dead, Jim”. Was DeForest Kelley sick that day? Well, he says the same line in other places, so I substituted one of those in.

There are at least two ways to get an infinitely high score in this mission. The first way is to repeatedly try to grab a snake in the second room. Whether you succeed or not, you get a point each time. (Normally the snake retreats into a hole before you can grab it.)

The second way is to repeatedly solve one of the puzzles. I don’t really want to give away any solutions, but there’s a particular action you can do repeatedly on the lake screen. The first time, it wards off a monster, but after that it serves no purpose, despite continuing to give you points.

Unfortunately, based on my limited testing, it looks like your score does cap at 100% in the final report.

Unused stuff & version differences

The devs seemed to have a good sense of humor; in particular, the original floppy version was snarkier in places. If you use a knife on yourself, it says “You won’t break your contract to the network that easily!”

That line was changed later; this particular piece of text changed between the original floppy release, the mac release, and the voiced release. Supporting all 3 will surely be a nightmare.

Also, it turns out that the redshirts are named after the devs, which somehow makes the redshirt deaths seem even funnier.

A personal favourite of mine.

I’ve also encountered the string “***Game Over, Man!***” in the game files multiple times, at least back in the first mission; perhaps it was used before they implemented the “game over” menu properly. Today, I even found a voiced version which seems to be unused, done with all the professionalism of any other line. I wasn’t a fan at first, but this narrator voice is growing on me.

Anyway, there are just two and a half missions to go now. I think I could manage to finish this within GSoC, starship sections and all. I doubt I’ll have enough time to finish Judgment Rites, but perhaps I can get a decent chunk done if space combat doesn’t turn out to be too insane to implement.