Allegro.cc - Online Community

Allegro.cc Forums » The Depot » OPong release

This thread is locked; no one can reply to it. rss feed Print
 1   2 
OPong release
Mark Oates
Member #1,146
March 2001
avatar

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! ;D

Jonny Cook
Member #4,055
November 2003

The zip seems to be broken.

The face of a child can say it all, especially the mouth part of the face.

Mark Oates
Member #1,146
March 2001
avatar

try again, I had to re-upload just then.

Jonny Cook
Member #4,055
November 2003

Ooo nice! Really smooth, I like it.

The face of a child can say it all, especially the mouth part of the face.

Christopher Bludau
Member #5,401
January 2005

Couldn't play it, because it runs unplayable FAST. :C

Mark Oates
Member #1,146
March 2001
avatar

Quote:

it runs unplayable FAST. :C

dang, I was afraid of that. :P

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. :)

Quote:

Ooo nice! Really smooth, I like it.

thanks! The screenshot is deceptively lame. :P

ngiacomelli
Member #5,114
October 2004

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!

CursedTyrant
Member #7,080
April 2006
avatar

Look at the bright side, you can train your reflexes with the older version :P

---------
Signature.
----
[My Website] | [My YouTube Channel]

miran
Member #2,407
June 2002

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... :)

--
sig used to be here

Marco Radaelli
Member #3,028
December 2002
avatar

Woo :D
I like that spin effect! Will you make a multiplayer version?

Paul Pridham
Member #250
April 2000
avatar

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).

Mark Oates
Member #1,146
March 2001
avatar

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? :-/

Quote:

Will you make a multiplayer version?

I thought about it, but I have never done any protocall (or whatever it's called :P) programming.

Matt Kindy
Member #7,331
June 2006
avatar

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?

Mark Oates
Member #1,146
March 2001
avatar

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. :)

Quote:

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. ;)

Christopher Bludau
Member #5,401
January 2005

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 
2void increment_speed_counter()
3{
4 game_speed_counter++;
5}
6END_OF_FUNCTION(increment_speed_counter);
7 
8void update_ball()
9{
10 ball_flag = 1;
11}
12 
13END_OF_FUNCTION(update_ball);
14 
15int 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.

Mark Oates
Member #1,146
March 2001
avatar

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.

miran
Member #2,407
June 2002

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).

--
sig used to be here

Marco Radaelli
Member #3,028
December 2002
avatar

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.

Michael Faerber
Member #4,800
July 2004
avatar

Miran's ZIP file seems to be invalid.

--
"The basic of informatics is Microsoft Office." - An informatics teacher in our school
"Do you know Linux?" "Linux? Isn't that something for visually impaired people?"

miran
Member #2,407
June 2002

Quote:

Miran's ZIP file seems to be invalid.

Works for me. Maybe you need to press Ctrl+F5 :P

--
sig used to be here

Christopher Bludau
Member #5,401
January 2005

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)

Marco Radaelli
Member #3,028
December 2002
avatar

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.

Quote:

I thought about it, but I have never done any protocall (or whatever it's called :P) programming.

It's protokewl :)

Mark Oates
Member #1,146
March 2001
avatar

New Version! YAY! ;D

... optimisim! :P

Marco said:

When the game begins the ball is suddenly released with a big curvature

fixed

miran said:

if the framerate is high, there's a very small chance the mouse has moved between frames

I was afraid that might happen. :P 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! :D :D

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 ???

Paul Pridham
Member #250
April 2000
avatar

Still no mouse/paddle, black screen, etc. And wow... my toolbar was moved to the top of the desktop this time. Thanks, OpenLayer!

Jonny Cook
Member #4,055
November 2003

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.

The face of a child can say it all, especially the mouth part of the face.

 1   2 


Go to: