Settings

Theme

Show HN: 2d web paddle game

raould.github.io

309 points by cypherpunk666 2 years ago · 80 comments · 1 min read

Reader

Simple retro paddle arcade game written in Javascript, using good ol' Canvas.

jsnell 2 years ago

Very cool!

The physics seem very different from classing pong / arkanoid physics, where the angle is determined by which part of the paddle was hit. Instead it seems like it's maybe totally random within a fairly small cone around the horizontal axis. Is that intentional?

  • apgwoz 2 years ago

    I've never "studied" "paddle dynamics" in these games, and when implementing pong, always just reflected, which doesn't provide good game play, but pong is always a "I'm trying out a different framework" type exercise.

    Pong using where it hits to affect the angle never totally made sense to me. I assume the explanation is "the paddle is drawn as a rectangle, but is actually parabolic." Additionally, I've always wondered why I've never seen a pong where the paddles have acceleration to some maximum velocity, and if the paddle is not stationary, you get lateral spin, causing non-linear ball paths on the return hit.

    • hombre_fatal 2 years ago

      There's an old 3d pong game from the flash era where you put spin on the ball.

      https://www.crazygames.com/game/curve-ball-3d

      • Cyphase 2 years ago

        Thanks for sharing! Perfect game until Level 6, died on level 7 with 21,150 points.

      • pony_sheared 2 years ago

        You reminded me of one of the first Mac games I got as a kid: Shufflepuck Cafe, I don't think it had spin but the sideways speed of your mouse was imparted on the puck

      • airstrike 2 years ago

        Soooo satisfying, thanks for sharing. Now I also feel like writing my own version

      • gazook89 2 years ago

        My god I forgot about this, and probably for the better. Too many hours wasted on it.

        Thanks

      • chrisweekly 2 years ago

        Oh yeah! I forgot about this one. Thanks for the link.

    • RunSet 2 years ago

      > Pong using where it hits to affect the angle never totally made sense to me. I assume the explanation is "the paddle is drawn as a rectangle, but is actually parabolic."

      It doesn't have to be realistic, only fun. The justification (very much not an explanation) is that it is more fun if the player can affect the angle of the rebound by positioning the paddle.

      It's also not realistic for Mario to change his jump's arc after he leaves the ground but the "rule of cool" holds in the Mushroom Kingdom, too.

    • ComodoHacker 2 years ago

      >using where it hits to affect the angle never totally made sense to me

      I believe different angles add complexity and fun.

      • apgwoz 2 years ago

        Well yes, of course. The way the different angles are computed isn’t intuitive. If a ball bounces off a table, it doesn’t change direction from its normal reflected bounce just because it didn’t hit the center.

        That’s why I’m suggesting there must be something that guides the idea that hit position changes the angle. If the paddle was actually parabolic, and just drawn as a rectangle, that’s an intuitive reason for the different reflective angles.

        • nkrisc 2 years ago

          > That’s why I’m suggesting there must be something that guides the idea that hit position changes the angle.

          Fun. The guiding principle for all games should be: is it fun?

          The reason the position of impact determines the angle is because it’s more fun, Not because it’s realistic.

          Realism is rarely fun.

          It’s a game, not a physics simulation.

          Edit:

          Additionally, if you only implement perfect reflection and have a rectangular arena, then the only bounce angles that can occur are the initial ball angle A and 90 - A on the top and bottom sides. That’s not fun.

        • ComodoHacker 2 years ago

          I believe the idea was to give the player more control with limited input signals.

  • dole 2 years ago

    I love Arkanoid and other pong-alikes, so also I'm curious about seeing how deflection angles on paddle location hit would play. Great design, music and play!

tlh 2 years ago

Bullet Hell Pong. Brilliant. Is there a win state? I just kept on playing until I hit the back button…

  • umvi 2 years ago

    When there are no balls left in play, the game is over. If you have more points at game over, you win.

    • quirino 2 years ago

      In that case I think the strategy would be to create a lead and then let all the balls through so that the game ends. At the start I was winning but at some point I wasn't able to keep up anymore.

    • Cyphase 2 years ago

      Ah, thanks. I paused and came back here, saw this comment, then went back and let the balls go by. Okay, I'll be honest, I accidentally unpaused early and they went by before I had a chance to think about whether I had enough of a lead. I did! Final score 405, the difference between my score and the bot's.

    • soneca 2 years ago

      I didn’t know it was when no balls were left. So this time I got an initial game, jumped ahead after using a special, then let all balls pass. I won by two points! :)

fallinditch 2 years ago

Very cool, nice design, much of the satisfaction comes from the sounds ++

29athrowaway 2 years ago

The best pong game to date was Plasma Pong

https://www.youtube.com/watch?v=yGJO5bydch4

https://en.wikipedia.org/wiki/Plasma_Pong

Remake: https://anirudhjoshi.github.io/fluid_table_tennis/

siavosh 2 years ago

Is there GPT involved?

  • loeber 2 years ago

    Same question here. When I saw its name, my first thought was "a transformer that plays pong? Interesting"

  • pimlottc 2 years ago

    Yeah, that doesn't make sense to me, unless we're now just using "GPT" as a generic word for "AI" (i.e. computer player) now.

waltbosz 2 years ago

Fun. Are there plans for local two player mode?

Also, when was this made? The copyright notices say 2011.

Cyphase 2 years ago

Challenge 1: Win the game with the lowest lead you can get. Or tie.

Challenge 2: Win the game with the least number of points; total points, before the bot's points are subtracted.

My first attempt at this (which was my second game) I won with 442 - 405 = 37.

EDIT: Second attempt, this time on mobile: 43 - 35 = 8

simplify 2 years ago

Awesome game! Best pong variant I've played!

Would be great to have an end goal. I managed to maintain a 200pt lead up to 1300pts and decided to give up cause I didn't know how long it would go.

  • Cyphase 2 years ago

    As I learned from other comments, the game ends when all the balls are out of play. Whoever is in the lead wins, and your final score is the amount of the lead. So you can allow the balls to get past you and go out of play to end the game, but make sure you have enough of a lead first!

    Hmm, next I'll see how low of a score I can have and win the game.

apgwoz 2 years ago

It wasn't until I read the comments that I actually gave it a chance. Would love to see a "Oh, you think it's Pong? It's not!" indicator on the page.

egypturnash 2 years ago

I was thinking "okay I think I am about done with this, I am at 2.5k to 2k", and then the game spawned a "defend" powerup for the computer player, which blocked off the entire computer side with destroyable blocks, and I decided I was done. 2721 to 2167.

Cute idea, could be kinda fun with another human, maybe with some way to push a button to lose points in exchange for a powerup on your side?

ungawatkt 2 years ago

Holding down one arrow key and only pressing the other makes directional changes much quicker, since the second press overrides but doesn't cancel the first.

Very fun!

shooshx 2 years ago

Boy that escalated quickly

rajkumardongre 2 years ago

I never thought that I would spend so much time in a ping pong game, really amazing work.

w-ll 2 years ago

I liked it but would suggest maybe changing the orientation so you can use left/right instead of up/down. i was playing way better once i rotated my keyboard so i could use two fingers

asicsp 2 years ago

That was really cool. Nice of you to include a warning, but I wish there was a light-theme mode (or may be there was one and I missed it).

hgs3 2 years ago

Very cool. You can control the paddle with the mouse by holding left click. I missed that my first playthrough and used the arrow keys.

kinduff 2 years ago

gpt's eyes don't dry out

jareklupinski 2 years ago

powerups had to start spawning on the CPU's side to keep it fair

feelin pretty good about that :)

  • mikepurvis 2 years ago

    At first the CPU was beating me as it could jump around to get more of the balls returned, but once it was thick enough I pulled ahead as I seemed better able to aim for returning the big clusters.

  • aidenn0 2 years ago

    Yeah, I was winning until the CPU got the space-invaders style barrier when there were like 100 balls in play.

drivingmenuts 2 years ago

I dig it. Nice twist to it.

tbreschi 2 years ago

This is sooo much fun!

frankbinette 2 years ago

That was fun to play!

JoeOfTexas 2 years ago

Holy balls, so many. Great game. I got a high of 550.

flykespice 2 years ago

I thought it would go on forever but I made it 'till the end.

Final Score: 2071 - 1715 = 356

Damn I did pretty good against GPT, it seems like AI still has so much to learn from humans :)

blinding-streak 2 years ago

This is dope AF. Thanks for sharing!

osm3000 2 years ago

That was a lot of fun! Thank you :)

lordelph 2 years ago

Jeff Minter-esque! Nice work!

martinbaun 2 years ago

I love these comments

// Welcome to The Land of Global Varibles, And Inconsistent Naming.

//

// sorry: velocities are kinda hacky guesstimates;

// the naming is horrible just about everywhere;

// this code is probably like 85.2% bugs or bad taste.

//

// note: my use of

// "left" is -x in canvas coordinates;

// "up" is -y in canvas coordinates;

// ideally (x,y) of objects consistenly means (left,top).

//

// note: the noyb2 font only has upper case letters,

// with a few icons in the lower case.

davyAdewoyin 2 years ago

Wow, That was nice to play.

mapster 2 years ago

My progression: Ok. Oh it’s like that? I got you. Oh fuck you. Oh fuuuuck you!!

Love this. Really need a paddle input device on the iPhone.

aavshr 2 years ago

this is absolutely great, multiplayer version?

wreq2luz 2 years ago

Yo this is sick!

asadm 2 years ago

MY FINGERS!

anon115 2 years ago

holy shit this is so fun <333

shibeprime 2 years ago

Me: Oh , so it's pong... wait, why is there TWO balls?

>30 seconds later<

Me: AAAAAAAAAAAAAAAAAAAAAHHHHHHHH!!!!!!!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection