Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (736)
Games in Android Showcase (223)
games submitted by our members
Games in WIP (813)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Pong in Java  (Read 8487 times)
0 Members and 1 Guest are viewing this topic.
Offline ivostojanov
« Posted 2016-01-19 13:17:26 »

Hello guys,

My name is Ivan, I am kinda new in Java but I tried to make a simple good old pong game just to see if I have the "skill" for making even the simplest of games.

Download the jar on this link.(Oldest Version look below for newer!)

Any advice for the game, future reference, comments would be appreciated  Grin

|---------SCREENSHOTs OF THE GAME---------|

-MyPong Boost Update Version



-MyPong AI Update



-MyPong First Look




|---------CONTROLS---------|

-W/S Player 1 Movement                                                    
-UP/DOWN Arrow Player 2 Movement                                                                                        
-U - UNPAUSE
-P - PAUSE

|---------GAMEPLAY VIDEO (OUTDATED)---------|

<a href="http://www.youtube.com/v/6E3uNzKpClU?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/6E3uNzKpClU?version=3&amp;hl=en_US&amp;start=</a>

!------------AI UPDATE------------!

- Download

!------------BOOST UPDATE------------!

- Download

|---------BOOST UPDATE CONTROLS---------|

-W/S Player 1 Movement                                                    
-B - Boost                                                                                        
-P - PAUSE & UNPAUSE


Kickin' it old school :3
Offline Riven
Administrator

« JGO Overlord »


Medals: 1310
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2016-01-19 15:07:47 »

Welcome on the forums! Pointing

 - You double-posted your entry on the forum. This is a bit frowned upon Smiley
 - Please don't create topics in 'featured games' as mods will handpick game topics and move them to that board.
 - I moved your 2nd topic to the 'work in progress / toy projects' board, which was more suited.

Could you please add a screenshot of your game to the first message in the topic, so we can get a feel for the game you published?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline ivostojanov
« Reply #2 - Posted 2016-01-21 21:46:52 »

Thanks  Grin

I realized that I was in the wrong section after I posted my topic, I tried to delete it but I didn't have the permission of course  Tongue

Thanks for the advice, I added a screenshot and edited my post a lil.

This is my first post so yeah sorry if I caused any inconvenience.  Smiley

Kickin' it old school :3
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EliwoodL

Junior Devvie


Medals: 2
Exp: 8 years



« Reply #3 - Posted 2016-01-21 23:04:05 »

Y'know somethin'?  You completed a game.  That puts you ahead of my years of fiddling with stuff but never quite creating something that was, well, y'know, playable.  Even if pong is just pong, it's definitely an excellent first project!
Offline FabulousFellini
« Reply #4 - Posted 2016-01-22 01:16:41 »

I can't get it to play.  The jar opens fine and opens with the game paused.  But the "H" for help does not seem to work for me, and I cant figure out how to start the game.

-FabulousFellini
www.fabulousfellini.com
Offline ivostojanov
« Reply #5 - Posted 2016-01-22 09:43:00 »

Well you always have to start small, if you get caught up on to a big project you'll just get stuck and it's not like a single programmer can do all the work that it takes for creating a game.

And sorry I should have mentioned that u should use U for UNPAUSE and P for PAUSE.

The help menu is not yet completed but yet again this game is far from finished.

This game doesn't have an AI right now so you can only play it with two players Player 1 with W/S and Player 2 with UP/DOWN Arrow.


Kickin' it old school :3
Offline ivostojanov
« Reply #6 - Posted 2016-01-22 16:31:47 »

!------AI UPDATE------!

Download Here

I made the AI today and I just can't beat him...I guess I need to fix that too.

Also I made some bug fixes on how sometimes u appear to hit the ball with the paddle but you still lose .-.

Kickin' it old school :3
Offline ziozio
« Reply #7 - Posted 2016-01-22 19:07:15 »

I doesn't seem to matter where in the paddle you hit the ball, it will always come off the bat in the same way. The AI is already moving to the right position before the ball even gets to you because it looks like it has already calculated where it is going. With out variation of how the ball comes off the paddle there isn't really much for the AI to think about. It could probably calculate the next 1000 positions it needs to go to before I get the first bounce in.
Offline ivostojanov
« Reply #8 - Posted 2016-01-22 19:58:03 »

I guess I should calculate the direction of where the paddle is going plus where the ball lands on the paddle to get the right bounce.
Actually the AI is pretty simple as well he just follows the movement of the ball's height coordinate with a given speed, I am gonna have to work on this too.  Tongue
Thank you for the critic, I'll have more time to work on it as soon as I finish my first semester next week  Grin

Kickin' it old school :3
Offline Riven
Administrator

« JGO Overlord »


Medals: 1310
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #9 - Posted 2016-01-22 20:11:14 »

Having the ball bounce in the same direction regardless of the point of contact (on a specific face) is actually physically correct behavior, as long as the face is perfectly flat. You can change the outbound angle by moving the paddle during the collision. This means that the ball actually has to intersect the paddle for a tiny (non-zero) period of time. Things get surprisingly complex fast, which is why everybody cheats by working the relative position to the paddle into some blatantly wrong algorithm that 'feels fun' - it is a game after all...

You can lookup some YouTube videos of the First pong ever, it was mostly analog logic, the ball didn't even have a straight trajectory, you could move the paddle along 2 axis, it would bounce off the net in the middel - way better than any pong clone since.

<a href="http://www.youtube.com/v/XNRx5hc4gYc?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/XNRx5hc4gYc?version=3&amp;hl=en_US&amp;start=</a>

<a href="http://www.youtube.com/v/-I73oK9q-jk?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/-I73oK9q-jk?version=3&amp;hl=en_US&amp;start=</a>

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ivostojanov
« Reply #10 - Posted 2016-01-22 20:29:38 »

It is physically correct, at first it enters at 45 degrees and it exits at the same angle on the other end, as time passes the angle differs but not by much.

In other words if I don't want to do the math, I can always make a fake algorithm that would probably be more fun.
And as always those non-logical fictional movements are a lot more fun xD
I guess I forgot to think a little out of the box about these things.

Thanks for the advice Riven will google some others pong examples, I appreciate it since I am kinda new around here :3

Kickin' it old school :3
Offline ags1

JGO Kernel


Medals: 356
Projects: 7


Make code not war!


« Reply #11 - Posted 2016-01-25 11:23:14 »

There are two things you can do for the bounce angle: make the angle dependent on the position the ball hits the bat (and then make the bat sprite slightly rounded to make this truly realistic) or make the output angle dependent on the current motion of the bat. The second option works better if the motion of the bat is variable (e.g. has a simple acceleration/deceleration).

Offline ivostojanov
« Reply #12 - Posted 2016-02-08 19:20:30 »

<--------------------------UPDATE-------------------------->              
            

-AI improved
-All in all the gameplay is balanced
-Paddle reverse hit available if you hit the ball back from where it came from
-Ball speed depends on reverse hits
-"Boost" added, you can use it while holding your paddle steady and holding down the button B
-When you use boost the ball goes straight at a "current speed" and then it bounces in an random trajectory.
-3 reverse hits = +1 boost, each player has 3 boost when the game starts
-args1 took the advice for the round look on the paddles, you were right it looks better and feels better, thanks :3
-I made the pause on one button only, because some people were confused(P to pause and then P to unpause).
-When the game starts it automatically starts with a boost, and when you continue playing(play again) the ball chooses a trajectory randomly.


All in all the whole game is running around the reverse(perfect) hits right now.



<--------NEW CONTROLS--------->
-W/S for movement
-P to Pause and Unpause
-B for Boost(while holding the paddle steady)
-ENTER to Play Again!


!-And finally to download this version press here.

And once again thanks to everyone who took the time to comment and give advice, it gave me lots of ideas, inspiration and motivation!

Kickin' it old school :3
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
cybrmynd (121 views)
2017-08-02 12:28:51

cybrmynd (145 views)
2017-08-02 12:19:43

cybrmynd (140 views)
2017-08-02 12:18:09

Sralse (155 views)
2017-07-25 17:13:48

Archive (625 views)
2017-04-27 17:45:51

buddyBro (734 views)
2017-04-05 03:38:00

CopyableCougar4 (1263 views)
2017-03-24 15:39:42

theagentd (1241 views)
2017-03-24 15:32:08

Rule (1217 views)
2017-03-19 12:43:22

Rule (1270 views)
2017-03-19 12:42:17
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!