Computer Science Canada

I know you guys must be tired of these, but take a look at my Pong game? :$

Author:  Wakening [ Mon Jan 02, 2012 11:21 pm ]
Post subject:  I know you guys must be tired of these, but take a look at my Pong game? :$

I'd very much appreciate some feedback on this. It's my first legitimate Turing project. Any feedback would be great. Smile

Author:  mirhagk [ Mon Jan 02, 2012 11:41 pm ]
Post subject:  RE:I know you guys must be tired of these, but take a look at my Pong game? :$

2 suggestions, 1 minor and 1 major. The minor one is that only the player who got scored against should be able to start the ball.

The major one has to do with delays, and the fact you have none. I'm assuming your machine is a lot slower than mine, since I could barely see the ball before I lost. Look into delay, and specifically Time.DelaySinceLast() which will make it so that nearly every machine will run at the same rate (assuming it's fast enough to keep up)

Author:  Wakening [ Tue Jan 03, 2012 12:37 am ]
Post subject:  Re: I know you guys must be tired of these, but take a look at my Pong game? :$

Actually, I did have delays slowing the speed of the entire game, but I felt it was too slow. Though I didn't think of the idea that it might run at different speeds on different computers. Thanks for the suggestion.

Author:  mirhagk [ Tue Jan 03, 2012 9:22 am ]
Post subject:  RE:I know you guys must be tired of these, but take a look at my Pong game? :$

Time.DelaySinceLast is what you probably want. You can set it to a certain delay, and if the computer takes too long then it won't do the delay at all.

Author:  Wakening [ Tue Jan 03, 2012 10:34 am ]
Post subject:  Re: I know you guys must be tired of these, but take a look at my Pong game? :$

code:
Time.DelaySinceLast (Time that computer pauses for regardless of machine speed)


Would that be how it is used? It sounds really useful for situations where delay should be accurate.

Author:  Tony [ Tue Jan 03, 2012 11:59 am ]
Post subject:  RE:I know you guys must be tired of these, but take a look at my Pong game? :$

You can look at the documentation for details on use -- Time.DelaySinceLast

Author:  Wakening [ Tue Jan 03, 2012 3:30 pm ]
Post subject:  RE:I know you guys must be tired of these, but take a look at my Pong game? :$

Thanks, I've implemented the Time.DelaySinceLast and it's looking pretty good. Smile

One thing I'm trying to do is create a basic AI for a one player mode. Is there any strategies to do that besides just making the computer paddle try and copy the ball's y-value?

Author:  mirhagk [ Tue Jan 03, 2012 9:15 pm ]
Post subject:  RE:I know you guys must be tired of these, but take a look at my Pong game? :$

Well one way of doing it is just having the AI follow the ball, each loop randomly checking to see if the AI moves.

Another, better way, is to calculate where the ball will be when it reaches the paddle (like a human does) and throw in a random amount of error so it can be wrong sometimes.


: