reaction game

Home Read the Story Download Credits

Tricky little devil

14 November 2019

Wow, getting the handling of my little ship to feel right turned out to be a real challenge. Either the thrust was so low that it took forever to cross the screen, or so high that it was uncontrollable.

I had so much trouble in fact that I ended up adding a new window to the program - a debugging window to let me see what was going on in the data. This turned out to be an elegant way of getting a feel for what is happening, so I’m going to leave it there and maybe add to it as I go. I also added a grid to the background so I could visually see motion even when there was nothing but the ship on the screen, but that was ugly and, although useful, is not something to keep (maybe a command-line option?).

I also ran into some issues with the game crashing. The first was easy - I had an Exception set to go off if processing was too slow, only this happens easily when using a step-through debugger. Since that exception was only really for debugging, I just changed it to a log statement. The other one though was more surprising. It seems that when the screen saver kicks in the Win32 GetMousePosition method starts failing to get a position. My error handling on this method was light - throw an exception - because I never expected it to happen. I need to manage this better, most likely by just pausing the game when the screensaver starts. Still, it’s not urgent, so I just noted it in the TODO and will get back to it later.

Adding thrust required me to add the concept of time to the engine. Initially, I thought I could get away with merely tracking the time between two loop iterations, but it turned out this led to some weird acceleration profiles. I think this was to do with the loop spinning so fast that all the tiny errors added up. Regularising the period of the loop seemed to clear that right up.

And tada, now I can control the ship using indirect mouse movement.

showing the ship under thrust

(showing the ship under thrust)

I don’t think I’m done with this yet; the “feel” is going to take some fine-tuning as I go. But, for now, I can live with this enough to progress, who knows what changes the next stage is going to bring?

Rendering

Every time I modify the rendering of the ship or the explosion, I want to see what effect it would have. Trying to play just right to check all those conditions was getting annoying. So I added a simple little test application that uses the same rendering code - now I can pop it open and see how the rendering looks. Much easier.

visual test application

(visual test application)

Other Notes

I also realised whilst playing a bit of RimWorld (which is incredible, and if you haven’t tried it I highly recommend it), there is something else missing from my game that is pretty much a must-have. Sound! Exploding without sound is dull, so is firing the massive rocket and not hearing the tremble. So sound needs to go on my todo list. But I didn’t rank it above being able to win, so I’ll just note it for now and move on.

Winning

At this point, I have possibly the most frustrating game imaginable. You can play, you can lose, but nothing you can do will make you win. That’s a bit sad.

Thinking about winning two things occurred to me - one, there must be a reason to win (which rather implies a back story), and two, I probably want to support playing multiple levels with increasing difficulty.

The first I’m going to tackle in a moment. The addition of levels I’m going to bump until after I can win at least the first level :D

Back Story

Every game deserves at least some kind of back story. It sets the focus and ensures gameplay follows some narrative, even if the player is unaware of the story.

So what is the back story for reaction? Glad you asked ;)

Read the BackStory here

Having written the back story, I now know more specifically what I’m going to build :) Unfortunately, it means I already took one small misstep. There doesn’t need to be a border around the world; there will simply become a point where it is no longer possible to fight the pull of the black hole due to limited fuel availability.

Never mind, it’s not a huge thing to change, and at least I now know the plan for the next steps:

Wow, that’s quite a lot to do until I can win. It’s certainly too much for one iteration. So lets back up a little and select the most critical.

I think there are two things I should do first:

Then two more:

And then follow up with:

At this point, it will be an actual game albeit simple and not yet having the complete set of mechanics, but playable.

So that’s the new plan.