I'm guessing you built it 64-bit, because it no worky-worky on my crappy work XP box.
pong game and opengl
I'm sort of wondering why you didn't just provide the source along with the binary so we could give a better analysis of why things might be broken or ways you can improve your design/literal code.
[attachment=17488:pongsrc.zip]ok I am still learning how to be a better coder so go easy on me.
It's relatively easy to build a "perfect" computer player for Pong, but a bit more challenging to provide a beatable but fun opponent. Take a look at how human players typically play the game, and try to add in some of the same behaviours and mistakes.
Try the following:
- When the ball is moving away from the AI paddle, move the paddle back to the centre position. A real person might overshoot or fall short by a small but randomised amount rather than moving exactly to the centre.
- When the ball is moving towards the AI paddle a typical human player will try to anticipate where the ball is going and move the paddle there, but will make small mistakes and occasionally mis-predict, especially if the ball is bouncing up and down a lot. Add in some small random variation to have the paddle overshoot or fall short of the correct position.
- Have the paddle attempt to correct any errors when the ball is getting close -- a real human player always panics and tries to correct their mistakes once they notice they're in the correct spot.
You can probably improve further on the above method, but it should be a good starting point at a more realistic, less unbeatable computer player.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement