So I played this javascript game online and thought it was pretty cool, but didn't like little parts of it so I decided to make it myself. It's a very simple game, but can become adictive. 
here's the project webpage:
http://code.markmusicproduction.com/OPong
here's the screenshot:
http://code.markmusicproduction.com/OPong/screenshot2.gif
here's the binary:
http://code.markmusicproduction.com/OPong/OPong.zip
enjoy!
The zip seems to be broken.
try again, I had to re-upload just then.
Ooo nice! Really smooth, I like it.
Couldn't play it, because it runs unplayable FAST. :C
it runs unplayable FAST. :C
dang, I was afraid of that. 
I have uploaded the new version, please try playing the game again. I unfortunately can't test it on other computers, but as far as I can tell the new version will run the at the same speed for all computers. 
Ooo nice! Really smooth, I like it.
thanks! The screenshot is deceptively lame.
Very nice! But I'd like to see a bit more graphic sparkle! I want the ball to spit out particles when I hit a good spin!
Look at the bright side, you can train your reflexes with the older version
Screenshot looks very promising! If you need someone to make binaries for other platforms (in case you don't want to distribute source code), I can do one for Linux x86_64...
Woo 
I like that spin effect! Will you make a multiplayer version?
None of these OpenLayer games ever work for me. I get the menu, but no cursor. And when I somehow manage to start the game, I get a black screen, with the score and the word "Foul" pops up whenever I miss a ball (which is always since I can't see anything).
interesting. Sometimes if I have other apps running and play the game for a while, then the a paddle, the ball, or whole screen will go black or disappear. I had assumed it was a specific problem with my computer or graphics card, maybe the two are related? 
Will you make a multiplayer version?
I thought about it, but I have never done any protocall (or whatever it's called
) programming.
Real cool, man. Nice job!
For some reason though, I can't see my mouse at the beginning, but if I click, it starts so hey! who cares, right? You people are so much better at programming in allegro than me 
Just one question: How did you get that animation... what did you do and use(I'm relatively new)to get the mouse to work?
Thanks to Miran who has ported OPong for 64-bit Linux. Grab the binary at the project page
If you haven't played this game yet you should definately check it out! also, please review my project in the depot. Give it a good score.
what did you do and use
I used the OpenLayer library to handle graphics. It's a great lib you should definately check it out. The projection is done with my own code because I don't yet know OpenGL. Getting the mouse to work is easy, start the game with install_mouse(), then use mouse_x and mouse_y to find the coordinates. It's in the manual.
I tested the new version. It is running not unplayable fast anymore.
It is fun to play. (much better then the flash version I once played)
But it is not running at the same speed all the time. :C
If the ball moves straight to the other side it moves normally, then it gets a little bit slower, and then back to normal speed again.
If the ball is spinning, the speed is incredible fast again.
I guess the speed could be controlled easily with the allegro timers (I guess you use them so I totally don't know why this is happening!)
Some code i would use for this. If you find some errors please correct them. (didn't code with C for quite some time)
| 1 | |
| 2 | void increment_speed_counter() |
| 3 | { |
| 4 | game_speed_counter++; |
| 5 | } |
| 6 | END_OF_FUNCTION(increment_speed_counter); |
| 7 | |
| 8 | void update_ball() |
| 9 | { |
| 10 | ball_flag = 1; |
| 11 | } |
| 12 | |
| 13 | END_OF_FUNCTION(update_ball); |
| 14 | |
| 15 | int game() |
| 16 | { |
| 17 | /* will make, that the screen is only redrawn all 60 frames */ |
| 18 | install_int_ex(increment_speed_counter, BPS_TO_TIMER(60)); |
| 19 | |
| 20 | /* manipulate the position of the ball only at given intervals |
| 21 | (and on the same on all machines */ |
| 22 | install_int(update_ball, 60); |
| 23 | |
| 24 | while (game_is_running == 1) { |
| 25 | |
| 26 | /* handle the logic stuff */ |
| 27 | while (speed_counter > 0) { |
| 28 | hanlde_input(); |
| 29 | game_speed_counter--; |
| 30 | need_redraw = 1; |
| 31 | if (ball_flag == 1) {call_your_ball_pos_routine; ball_flag = 0;} |
| 32 | } |
| 33 | |
| 34 | /* redraw the screen */ |
| 35 | if (need_redraw == 1) draw_screnn(); |
| 36 | |
| 37 | need_redraw = 0; |
| 38 | |
| 39 | } |
| 40 | } |
With this the game should run at the same speed at all devices. I hope.
If I posted something totally wrong, please correct me.
[Edit]
You probably have to cahnge the timing of the update_ball timer. the 60 will be fast I guess. Play around with the value.
hmm, I think the sporatic timing that you seem to be describing might be an OpenLayer issue. Do you have any other apps running? What kind of hardware to you have?
The timing method I'm using is the one described in OL's FpsCounter(). This method (should) allow the hardware to run at any fps while maintaining consistant game speed. I have noticed in some spots that the game will speed up or slow down, but only for a split second and when the frame has not been regularly refreshed (which is to be expected). The ball spin can get very fast, so that part is probibly normal.
I still can't get the ball to spin. Is the code that does that by any chance dependant on framerate? Like if the framerate is high, there's a very small chance the mouse has moved between frames (which makes the ball spin if I understand correctly).
When the match's paused because one has scored I can hold down the left button and move the mouse around. When the game begins the ball is suddenly released with a big curvature in its trajectory.
Miran's ZIP file seems to be invalid.
Miran's ZIP file seems to be invalid.
Works for me. Maybe you need to press Ctrl+F5
Hmm.
I hadn't runnig any other apps then firefox. Will try after a fresh rebbot again.
here my system. (there should be something like a system profile. So anyone could enter it once and everybode could have a look at it)
Laptop
Win Xp; Service Pack 1; Home Edition
Pentium 4, 3.2 Ghz
1 Gb ram
ATI Mobility Radeon 9800
Anything missing?
[edit]
I am the only one with speed issues? (with the new version)
Maybe a bit offtopic and more OL-related: if I tab away from your game (while it's fullscreen) the desktop resolution isn't changed back to its default value.
I thought about it, but I have never done any protocall (or whatever it's called
) programming.
It's protokewl
New Version! YAY!
... optimisim! 
When the game begins the ball is suddenly released with a big curvature
fixed
if the framerate is high, there's a very small chance the mouse has moved between frames
I was afraid that might happen.
However, I think I was able to fix this one as well. One way to check is to hold F5 (this will track your mouse movement to a log file). While holding F5, move your mouse around quickly. Then check the log file. the value after "abs: " should peak around 150-ish. Also because of the new implementation, the curve of the ball will not always be as strong as the spin you put on it. You might put some sick spin but then get very little curve.. but this is like a 1 in 8 chance, and is now a new feature of the gameplay 
I'm still not sure what's causing the strange uneven timing, yet.
Download the new version today!

you can get it at the project page:
http://www.allegro.cc/depot/OPong
or at my website
http://code.markmusicproduction.com/OPong
oh also, there's new sound effects and sound spacing, including enhanced depth. 
Michael Faerber: try this one: http://members.allegro.cc/miran/tmp/OPong.zip
it's an older version but if it works then I screwed something up when transfering the file to allegro.cc's server.
[edit] strange, for some reason allegro.cc's copy of the file hangs downloading at 100% and never finishes
Still no mouse/paddle, black screen, etc. And wow... my toolbar was moved to the top of the desktop this time. Thanks, OpenLayer!
I don't think that's OpenLayers fault. I think that happens when the screen resolution changes. You should probably be thanking either Windows or OpenGL.
It doesn't work in my computer.
Unsupported refresh rate, you should include a text .cfg file for easy configuration.
P4 2400mhz, fx5700, Philips 107S5 monitor, winXP.
Unsupported refresh rate? hmm, I don't make any changes to the hardware configuration... All that is done with OpenGL. I'll have to double check that when I get home.
cant get spinning to work, cant find help file that explains it.
Johnny, I have plenty of other OpenGL programs (including my own) that change the resolution and work just fine.
Mark Oates, consider adding an external config file so that I can try setting up various options to get it working... windowed, resolution, colour depth, etc.
OpenLayer uses AllegroGL to set up the screen. Also, could you post the openlayer.log so that I could get a hint of why the graphics aren't showing (maybe some OpenGL extension issue).
| 1 | OpenLayer started up succesfully |
| 2 | |
| 3 | Auto Loader: Executing 9 pending loading commands |
| 4 | Auto Loader: Completed |
| 5 | |
| 6 | Screen set up succesfully |
| 7 | |
| 8 | Loading a true type font: d:\Misc\Temp\OPong\fonts\scifi2k2.ttf |
| 9 | Loading a true type font: d:\Misc\Temp\OPong\fonts\scifi2k2.ttf |
| 10 | Loading bitmap: images/paddle.tga |
| 11 | OpenGL extension GL_ARB_texture_non_power_of_two was not found. |
| 12 | Loading bitmap: images/ball.tga |
| 13 | OpenGL extension GL_ARB_texture_non_power_of_two was not found. |
| 14 | Loading bitmap: images/life.bmp |
| 15 | OpenGL extension GL_ARB_texture_non_power_of_two was not found. |
| 16 | Loading bitmap: images/OPong_title2.bmp |
| 17 | OpenGL extension GL_ARB_texture_non_power_of_two was not found. |
| 18 | Collecting garbage |
| 19 | |
| 20 | Garbage Collector: Destroying 9 items |
| 21 | Garbace Collector: Completed |
| 22 | |
| 23 | Destroying the framebuffer |
| 24 | Used framebuffer: Framebuffer emulation |
| 25 | OpenLayer shutdown finished |
When I somehow manage to start the game, the game arena does blink into existence for a split second, but then I just get all black with the text.
I would write in the code for a config file, but that computer is now giving me the blue screen on boot up because of a recent power failure in the appartment. 
my logfile says the same thing. :/ do you hear audio when you move the mouse quickly? Try pressing 5 on the keypad, that re-aligns the camera to the origin, it's a shot in the dark. Try pressing the left mouse button to serve the ball.
All you have to do to start the game is press the left mouse button. You get text as shown in the screenshot, ... no squares at the top left?
man...
Mark, the audio seems to work fine (sounds cool actually
). Pressing 5 doesn't do anything.
And yes, I get just text... no squares, no boxes, no paddles, no ball. 
But as I said before, seems to be a common problem with OpenLayer stuff on my machine.
I've heard about a similiar problem before. The issue could be in OpenGL drivers - OpenLayer requires relatively new drivers in order to upload the textures correctly. However, it's strange that the text works...