• Breaking News

    Improvements to Good Old Pong In my last post, I mentioned I followed along with a tutorial showing how to build a basic game of Pong. This is what it looks like: And the source code is over on my Github account: https://ift.tt/2ZtkZ1U I followed the tutorial with very little changes. But here are some things that came to mind while seeing it come together: Game Loops I won't be making any changes here, but the use of FreeGlut and an "update" timer callback made me think about game loops in general. I likely would have just made a "while ( gameActive )" type of loop if left to my own devices. Here's an interesting article I found on the subject: https://ift.tt/144TsFL Lots of Global Variables My instincts are to avoid global variables, and find ways to encapsulate program data into some kind of structure. So among my enhancements will be splitting up the game state to make things a bit more flexible. Paddles Away! The players can move their paddles off screen. Let's get some collision detection on those. Balls Away! That sounds a little inappropriate... But the collision detection on the ball allows it to go a little off-screen before it bounces. Let's fix that. No Game Mode or Game Options There is no "press a key to start" screen, no menu, and no game options. Let's add a few of these to make it more interesting, such as paddle length and ball speed. Computer Opponent One of the options should be to allow a computer opponent, hopefully with a few difficulty levels as an option. Something Fun I don't want to take Pong too far before I move onto something else, so I'll limit myself to just one "fun" thing to add to the game. I'll let it be a surprise. My plan is that a week or so from now, I'll already be on to the next basic game idea. My next entry will cover the above changes. https://ift.tt/eA8V8J

    In my last post, I mentioned I followed along with a tutorial showing how to build a basic game of Pong. This is what it looks like: And the source code is over on my Github account: https://ift.tt/2ZtkZ1U I followed the tutorial with very little changes. But here are some things that came to mind while seeing it come together: Game Loops I won't be making any changes here, but the use of FreeGlut and an "update" timer callback made me think about game loops in general. I likely would have just made a "while ( gameActive )" type of loop if left to my own devices. Here's an interesting article I found on the subject: https://ift.tt/144TsFL Lots of Global Variables My instincts are to avoid global variables, and find ways to encapsulate program data into some kind of structure. So among my enhancements will be splitting up the game state to make things a bit more flexible. Paddles Away! The players can move their paddles off screen. Let's get some collision detection on those. Balls Away! That sounds a little inappropriate... But the collision detection on the ball allows it to go a little off-screen before it bounces. Let's fix that. No Game Mode or Game Options There is no "press a key to start" screen, no menu, and no game options. Let's add a few of these to make it more interesting, such as paddle length and ball speed. Computer Opponent One of the options should be to allow a computer opponent, hopefully with a few difficulty levels as an option. Something Fun I don't want to take Pong too far before I move onto something else, so I'll limit myself to just one "fun" thing to add to the game. I'll let it be a surprise. My plan is that a week or so from now, I'll already be on to the next basic game idea. My next entry will cover the above changes.

    from GameDev.net https://ift.tt/2ZoGG2U

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728