This week has been the first week of the “Game Programming I” course. Since the course doesn’t require any previous knowledge of programming, the material has been pretty basic so far. Which suits me well, I realize now. I have a tiny bit of programming experience from playing around in GameMaker years ago, but GameMaker has its own programming language which in my opinion is a lot easier to use than the more powerful “C++” we are learning now. Even the basic stuff gets complicated when you actually start working with it yourself, as opposed to listening to it in a lecture. We got a bunch of exercises to do for practice of which the last one was the most comprehensive: to make a (ridiculously) simple guessing game. The game is played by typing numbers, guessing on a number between 1 and 100. After each incorrect guess, the game tells the player whether the guess was too high or too low. A correct guess results in a congratulation as well as a display of how many guesses were needed to get to the right answer, after which the only option is to exit the game. Deadly simple, right? Nope. My “game engine” is perfectly functional only without the random generation of a number, which sadly is the very core of the game. Apparently, generating a random number is not as simple as it sounds, and code for this was included in the sheet of exercises; code which I happily copied into my project; code which I still can’t get to work properly. I originally planned to finish all the exercises before writing this post, but alas; after a while of battling the error messages with everything I’ve got (desperately Googling bits of the randomization code), I have now decided to postpone the completion of the game until tomorrow, when I will have time to thoroughly go through the randomization code and actually understand it completely. Which I obviously should have done from the start. Lesson learned.
A proper update with the finished guessing game will follow. Pre-order now and play it on release day! Or something.