All posts tagged openal

And so on the second last week, the creator of Masteroids introduced death into his game. He saw that is was good and so he moved on to the next task.

This last week I’ve got a lot of work done. I implemented lives and that players can die, and get a Game Over screen. I implemented the saucers, one big that fires at random and one small that aims at the closest player. I limited the amount of bullets in the air (space) from the same player to 4, which is the same number as in the original Asteroids. Also the time to live on the bullets are much shorter, so you never feel ‘out of ammo’.

I had a huge bug in the game that slowly made my controls for the ship stop working, one after the other as the game was played. It only appeared when I spawned saucers, so I obviously thought that was the origin of the problem, but then I found out that my input manager thought that several buttons were pressed, starting with the first char and going upwards, until it said that I was pressing all the controls at once and the game then crashed. This was very hard to debug, since every single try that I made had to go on for 2-3 matches where I spawned a hell of a lot saucers. It showed up to be a problem with how I had implemented my input manager (I’ve had problems with it before, probably the same source of the problem, but I thought it fixed), the problem was how I stored the boolean array indicating which buttons were being pressed and not and how I used it. I ended up converting to the C++ way, using a vector instead of an array, and passing copies to everywhere instead. This ultimately solved my problem.

I’ve done lots of improvements and bug fixes as well. I fixed so every entity have width and height that they take into account before going over one edge and reappear at the other side of the screen. I tweaked the font a little so that smaller font looks better at original resolution, and started using it through out the game. I’ve implemented so the player(s) get an extra life per each 10.000 points they score. That smaller saucers appear more frequently until a score of 40.000 when only they appear.

I’ve also implemented sound effects, is really brings the game alive. I ended up using OpenAL after lots of effort spent on PortAudio that I just couldn’t get to work. Both of them are cross-platform and I find that important when selecting a library (so is LodePNG and FreeType that I use). I don’t have all the effects in the game yet, but that shouldn’t take long. I got hold of some of the original sfx from Asteroids that I’ll be using, but I’m currently having problems with the saucer sounds, they appear to be to short to play, ending up saying that they have no data on them. VLC can’t play them but Movie Player can.

I’ve started on the highscore synch and will complete it this final week. Same goes with the sound effects. Then there will be bug-fixes and play-test so that I can improve the game overall.