Computer Science Canada My Old Pong Game |
Author: | Anonymous [ Thu May 11, 2006 8:23 pm ] | ||
Post subject: | My Old Pong Game | ||
I don't use this anymore, but this is my first pong game. No AI, just 2P. Also how come the pong paddles slow down when two users hit a key at once?
|
Author: | do_pete [ Thu May 11, 2006 8:34 pm ] |
Post subject: | |
Because you have a delay in the procs that move the paddles. Anyways, nice game overall. ![]() |
Author: | ohgeez_ [ Thu May 11, 2006 9:41 pm ] |
Post subject: | |
okk. not bad at all but.. - avoid those processes at all costs. unless if its for the sound. the other parts are unnecessary or at least i believe can be avoided. - i dont suggest u using 'quit' with your esc button. why cant u just use exit? - i'd suggest u make the boards so that they cant go into the green area since the ball doesnt go there anyway. the green part kind of covers the board. but its quite good a game overall good job =D |
Author: | Anonymous [ Sat May 13, 2006 3:18 pm ] |
Post subject: | |
If I use exit, it still runs in the background because I am using a process. How can I kill a process? I like using processes because it's the easiest way I find to make things run in the background. |
Author: | ohgeez_ [ Sat May 13, 2006 3:24 pm ] |
Post subject: | |
im not sure if there is a better syntax but one u can use is 'return' it terminates a subprogram oh and processes... avoid them learn to use alternatives. |
Author: | Anonymous [ Sun May 28, 2006 9:28 am ] |
Post subject: | |
processes shorten the length of the code, in some cases dramatically. and in the end, with a program like pong in my case, would have the same result, almost. |
Author: | ohgeez_ [ Sun May 28, 2006 12:55 pm ] |
Post subject: | |
are u sure that processes can shorten ur code? because i think that if u were to put the process boucy ball in the loop, it wouldnt make a big difference. using processes for music is ok though although its true for your program, process or not process, it doesnt make a big difference. |
Author: | MysticVegeta [ Sun May 28, 2006 1:01 pm ] |
Post subject: | |
ohgeez_ wrote: using processes for music is ok though
Not if you have turing 4.05 or +. "Music.PlayFileLoop" needs no processes |
Author: | Cervantes [ Sun May 28, 2006 1:12 pm ] |
Post subject: | |
What's this business about "processes" that I hear? Do my ears deceive me? vahnx, there is absolutely no reason to use processes for pong that outweighs the consequences that come with process usage. Make sure you read the article outlining the reasons to avoid processes. |
Author: | Anonymous [ Sun May 28, 2006 1:32 pm ] |
Post subject: | |
There's nothing wrong with processes. I know they are randomly called "fork hi fork ho", they don't run (1,2,1,2). But in the case of pong it doesn't matter. It shortens the length of my pong game by a few lines. If Holtsoft didn't like processes, they wouldn't be in Turing. They probably put it in to help lazy people like me. |
Author: | Andy [ Sun May 28, 2006 3:19 pm ] |
Post subject: | |
processes are in turing not so people can abuse them. they're useful for playing music, and multi threaded programming. Pong was never intended to be done with processes. And learn to take constructive critisisms |
Author: | Cervantes [ Sun May 28, 2006 3:47 pm ] |
Post subject: | |
vahnx wrote: There's nothing wrong with processes.
Yes, there is a lot wrong with processes. Read the article. Tony said it well: Tony wrote: You essensially throw your code flow into a blender, mix it up and say. "Here I have a bunch of lines of code. They are in no particular order. If the computer happens to pick the right order - the results will be as expected. Otherwise I have no idea what might happen" vahnx wrote: They probably put it in to help lazy people like me.
If you understood how to do this without processes, you wouldn't see any difference in difficulty. The reason you used processes here has nothing to do with being lazy: it has to do with a fundamental eagerness -- accomplishing something by doing it the first way that pops into your head, without giving other altneratives a second thought. vahnx wrote: It shortens the length of my pong game by a few lines.
I don't think so. |
Author: | Anonymous [ Sun May 28, 2006 5:17 pm ] |
Post subject: | |
Fine you win. Why did Holtsoft include Processes in Turing? Except for the fact of Music.Sound. |
Author: | HellblazerX [ Sun May 28, 2006 6:11 pm ] |
Post subject: | |
For multi-threaded programs (threads are another name for processes) and sound. And no, Pong is not a multi-threaded program. An example of a multi-threaded program would be a web chat server, in which the server needs to handle each client separately in a process so that client won't affect the server's or other clients' performances. And if Music.PlayFileLoop doesn't use processes, then how does it work? |
Author: | Cervantes [ Sun May 28, 2006 6:21 pm ] |
Post subject: | |
You use a process (or thread) when you need to continue running one piece of code while another piece is hanging. That is, that second piece of code is waiting on the get line. HellblazerX gave an excellent example of a web chat server. I'm going to reverse it, and explain why I needed threading in making an IRC client. An IRC client needs to connect to multiple servers and get a line of data through a socket connection. The code hangs there at that get line until data is received. At that point, that data needs to be handled. This is impossible to do without threads because your code could be hanging waiting for one server to send a line while the other server has sent a whole bunch of lines that aren't being received. |
Author: | Im_Emo [ Tue Jun 13, 2006 12:28 pm ] |
Post subject: | |
ok....neato..... ![]() |