Show HN: 2d web paddle game

309 points by cypherpunk666 1 year ago | 71 comments
Simple retro paddle arcade game written in Javascript, using good ol' Canvas.
  • jsnell 1 year 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 1 year 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 1 year 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 1 year ago
          Thanks for sharing! Perfect game until Level 6, died on level 7 with 21,150 points.
          • pony_sheared 1 year 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 1 year ago
              Soooo satisfying, thanks for sharing. Now I also feel like writing my own version
              • gazook89 1 year ago
                My god I forgot about this, and probably for the better. Too many hours wasted on it.

                Thanks

                • chrisweekly 1 year ago
                  Oh yeah! I forgot about this one. Thanks for the link.
                • RunSet 1 year 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 1 year ago
                    >using where it hits to affect the angle never totally made sense to me

                    I believe different angles add complexity and fun.

                    • apgwoz 1 year 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.

                  • dole 1 year 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 1 year ago
                    Bullet Hell Pong. Brilliant. Is there a win state? I just kept on playing until I hit the back button…
                    • umvi 1 year ago
                      When there are no balls left in play, the game is over. If you have more points at game over, you win.
                      • quirino 1 year 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.
                        • l3x4ur1n 1 year ago
                          That was my strategy when I realized I sat on the toilet for too long already
                        • Cyphase 1 year 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 1 year 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 1 year ago
                          Very cool, nice design, much of the satisfaction comes from the sounds ++
                          • 29athrowaway 1 year ago
                          • siavosh 1 year ago
                            Is there GPT involved?
                            • loeber 1 year ago
                              Same question here. When I saw its name, my first thought was "a transformer that plays pong? Interesting"
                              • 1 year ago
                              • pimlottc 1 year 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.
                                • oneeyedpigeon 1 year ago
                                  That's exactly what I assumed it was — a wry commentary on AI.
                                  • quirino 1 year ago
                                    My first thought was that the AI of the bot was code written by GPT.
                                • waltbosz 1 year ago
                                  Fun. Are there plans for local two player mode?

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

                                • Cyphase 1 year 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 1 year 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 1 year 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 1 year 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.
                                    • jabroni_salad 1 year ago
                                      But that would rob you of the little a-ha moment when you realize the subversion :(
                                      • seeingnature 1 year ago
                                        Yup - and that was worth it! I love a good a-ha moment.
                                        • apgwoz 1 year ago
                                          I agree, it's fun. However, who wants to play pong? It's not exactly a flashy "CLICK ME" type game.
                                    • egypturnash 1 year 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 1 year 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 1 year ago
                                          Boy that escalated quickly
                                          • rajkumardongre 1 year ago
                                            I never thought that I would spend so much time in a ping pong game, really amazing work.
                                            • w-ll 1 year 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
                                              • 1 year ago
                                              • 1 year ago
                                                • asicsp 1 year 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 1 year 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 1 year ago
                                                      gpt's eyes don't dry out
                                                      • jareklupinski 1 year ago
                                                        powerups had to start spawning on the CPU's side to keep it fair

                                                        feelin pretty good about that :)

                                                        • mikepurvis 1 year 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 1 year ago
                                                            Yeah, I was winning until the CPU got the space-invaders style barrier when there were like 100 balls in play.
                                                          • drivingmenuts 1 year ago
                                                            I dig it. Nice twist to it.
                                                            • tbreschi 1 year ago
                                                              This is sooo much fun!
                                                              • frankbinette 1 year ago
                                                                That was fun to play!
                                                                • JoeOfTexas 1 year ago
                                                                  Holy balls, so many. Great game. I got a high of 550.
                                                                  • pretzellogician 1 year ago
                                                                    Very cool game! 757 high score; the power-ups keep getting more interesting.
                                                                  • flykespice 1 year 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 1 year ago
                                                                      This is dope AF. Thanks for sharing!
                                                                      • osm3000 1 year ago
                                                                        That was a lot of fun! Thank you :)
                                                                        • lordelph 1 year ago
                                                                          Jeff Minter-esque! Nice work!
                                                                          • martinbaun 1 year 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 1 year ago
                                                                              Wow, That was nice to play.
                                                                              • mapster 1 year 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 1 year ago
                                                                                  this is absolutely great, multiplayer version?
                                                                                  • wreq2luz 1 year ago
                                                                                    Yo this is sick!
                                                                                    • asadm 1 year ago
                                                                                      MY FINGERS!
                                                                                      • anon115 1 year ago
                                                                                        holy shit this is so fun <333
                                                                                        • shibeprime 1 year ago
                                                                                          Me: Oh , so it's pong... wait, why is there TWO balls?

                                                                                          >30 seconds later<

                                                                                          Me: AAAAAAAAAAAAAAAAAAAAAHHHHHHHH!!!!!!!

                                                                                          • redbell 1 year ago
                                                                                            > 30 secs later

                                                                                            Me: Oh! It's multi-pong war

                                                                                            • Cyphase 1 year ago
                                                                                              This made me laugh out loud, thanks.
                                                                                              • 1 year ago
                                                                                              • kruxigt 1 year ago
                                                                                                [dead]
                                                                                                • zhouz777 1 year ago
                                                                                                  [dead]
                                                                                                  • zhouz777 1 year ago
                                                                                                    [dead]