Saturday 3 December 2011

Progress

Today I've made some pretty big changes to the game. I've changed the way the time between squares being shot is calculated. The time between every particle being shot from the centre used to be 60 milliseconds. But I've realised later that measuring that "pause" using actual time was a bad idea, because, if the game starts lagging the FPS drops, and if the FPS drops the paddle that the player is moving slows down, but time keeps on running. So after a while the paddle speed and the speed of the particles get out of sync and the game is unplayable. Of course this game doesn't lag. It's way too simple. On my (crappy) machine it has a constant 59-60 FPS rate. So I had to create some lag with other programs to be able to test this.
What I did to fix it was, I started measuring frames instead of measuring time. So now instead of shooting a square from the centre every 60 milliseconds the game shoots one every 5 frames.

I've also optimised the code quite a bit today. From having 1196 lines of code It came down to only 976. That is 220 lines of code less. Pretty damn sweet if I do say so myself.

No comments:

Post a Comment