TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: I made a web game called Almost Pong

1135 pointsby lessmilkabout 3 years ago
Hi HN!<p>I made many small web games in the past with Unity or Phaser. But this time I wanted to make something completely on my own. So I coded a basic game framework in plain JavaScript, and used it to make Almost Pong.<p>This was a really fun project that taught me a lot about JavaScript, and I plan to make more minimalist games with this framework. Interesting fact: Almost Pong doesn&#x27;t load any assets, all sprites and sounds are generated with code.<p>Happy to answer questions, and please let me know if you have any feedback on the game. Thanks!

112 comments

zhichuabout 3 years ago
I like small games like this. We can have a simple playing while resting.
indigochillabout 3 years ago
This is a wonderful little game. The concept and execution is extremely concise but the thing that really sealed the deal for me was noticing the escalating difficulty by making the paddles shrink.
评论 #30525074 未加载
maaaaatttttabout 3 years ago
Let me use this thread to tell this somewhat related story of mine.<p>When I was still at university we had a C class and were doing it in a computer lab with partners (back then very few students could afford a laptop). I was always partnering up with the same friend. Since we were a bit bored with the class we started building our own pong in C. Rendering was done in ASCII in the command line, with paddles being 3 pipes, the ball a capital 0 and the walls &quot;#&quot;. We would spend some time at the beginning of the class building&#x2F;improving it and at the end playing it. We used keys like &quot;W&quot; and &quot;S&quot; for the left player and &quot;O&quot; and &quot;L&quot; for the right player. Since the initial setup with rendering and &quot;physics&quot; of the game went quite fast, we thought about how to improve it and make it more fun.<p>What made it incredibly fun (at least for us) in the end, was the addition of bonus squares. So, between the two paddles, if the ball that you just touched hit a bonus square, it would activate an effect for you or for the game depending on the bonus. We had: - &quot;wall&quot;, would create a 3 squares wall at the location of the bonus - &quot;turn of the lights&quot;, would hide everything but the ball (even the paddles) - &quot;gun&quot;, would allow you to shoot and destroy walls and bonuses - &quot;bigger&#x2F;smaller paddle&quot;, self explanatory - &quot;net&quot;, would temporarily put a net behind you preventing you from missing the ball - and some more, like speed up the ball, add an extra ball, etc.<p>It&#x27;s been my one and only experience building a game but I think it was the most fun I&#x27;ve had programming… If anybody is up for re-building a pong with bonuses I&#x27;d be definitely up for that ;)<p>Back on the topic: love the implementation OP, pretty addictive. And, as can be read above, it brought back some nice memories.
评论 #30531944 未加载
hyperpallium2about 3 years ago
&quot;flappy badminton&quot; - the shuttlecock aka a &quot;birdie&quot; is traditionally made with feathers <a href="https:&#x2F;&#x2F;wikipedia.org&#x2F;wiki&#x2F;Shuttlecock" rel="nofollow">https:&#x2F;&#x2F;wikipedia.org&#x2F;wiki&#x2F;Shuttlecock</a> )
评论 #30527346 未加载
评论 #30528926 未加载
danielandrews43about 3 years ago
You were one of my biggest inspirations for going into software engineering, I absolutely loved your website in high school and would always mess around with the source code to your games. Happy to see you’re still going!
评论 #30525165 未加载
cercatrovaabout 3 years ago
Remember when Flappy Bird was making $50k a day (or something like that [0]) and the creator should shut it down? Ah, memories. You could potentially recreate this to put on the mobile app stores and see how it does, I think a lot of people would play it.<p>Oh, and soon you&#x27;ll see people here on HN competing to hack the top score as with previous games [1], either though writing an AI to play the game or by modifying the JS itself on the site.<p>[0] <a href="https:&#x2F;&#x2F;www.cnet.com&#x2F;tech&#x2F;services-and-software&#x2F;no-flappy-bird-developer-didnt-give-up-on-50000-a-day&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.cnet.com&#x2F;tech&#x2F;services-and-software&#x2F;no-flappy-bi...</a><p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29921419" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29921419</a>
dangabout 3 years ago
I think the second-chance pool* lobbed this one onto the front page while the OP was offline. I emailed to let him know that it&#x27;s at #1...twill be quite a thread to come back to!<p>* <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;pool" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;pool</a>, explained at <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26998308" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=26998308</a>
throwaddzuzxdabout 3 years ago
That&#x27;s a fun concept, but you might want to speed it up a little bit. I stopped at 20 because I got bored, it&#x27;s way too slow. The ball moves too slowly and the paddles should shrink a bit faster. The change that occurs between 1 and 20 should probably happen between 1 and 5, or 1 and 3 instead.<p>Edit: oh wait, it&#x27;s way more fun on Safari. On Firefox it feels slow and slugish, but on Safari it&#x27;s great!
评论 #30527066 未加载
评论 #30529385 未加载
评论 #30526929 未加载
schiffernabout 3 years ago
If this isn&#x27;t working for you on Firefox, check that dom.webaudio.enabled isn&#x27;t set to false.<p>If Web Audio is disabled then window.AudioContext is undefined, causing a crash:<p><pre><code> Uncaught TypeError: AudioContext is not a constructor Sound https:&#x2F;&#x2F;d33wubrfki0l68.cloudfront.net&#x2F;bundles&#x2F;72f7c09a3e8485a33911cdf084acaeaf58ce17ce.js:5 startGame https:&#x2F;&#x2F;d33wubrfki0l68.cloudfront.net&#x2F;bundles&#x2F;72f7c09a3e8485a33911cdf084acaeaf58ce17ce.js:482</code></pre>
zebracanevraabout 3 years ago
Impossible to play on a 280hz monitor. I see you&#x27;re using Date.now() to calculate the delta. Instead, use the first argument given to you by requestAnimationFrame for higher resolution, which is a DOMHighResTimeStamp[0]<p>[0] <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;DOMHighResTimeStamp" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;DOMHighResT...</a>
评论 #30526108 未加载
评论 #30524647 未加载
Sydneycoabout 3 years ago
This is funny. I feel this could evolve into a different game based on the number of players:<p>1 Player = Almost Pong<p>2 Players = Pong<p>3 Players = Pong + Almost Pong
评论 #30526550 未加载
andaiabout 3 years ago
Hey! Your 12 games in 12 weeks thing (back in ...2014? Jesus, time flies) was what got me into HTML5 game dev! So I wanted to say thank you for the inspiration :)<p>I especially appreciate the &quot;loads no assets&quot; aspect. I will take a look at the code in the morning!<p>p.s. have you considered the name &quot;Flappy Pong&quot;?
评论 #30525288 未加载
justinhjabout 3 years ago
Really fun and addictive. I would extend the screen downwards so there is a clickable area that is not part of the play area. Then you will be able to see what is going on better. Just an idea.
评论 #30525078 未加载
评论 #30525094 未加载
creakingstairsabout 3 years ago
This was pretty fun to play. Half way through the game I realised this was like flappy birds but within one screen. In saying that, this felt more fun to me because the space between each challenges was bigger, letting me I feel like I was more in control.
评论 #30525266 未加载
评论 #30523878 未加载
Laremereabout 3 years ago
Be careful, especially if you do anything commercial with this: &quot;Pong&quot; is trademarked by Atari. Fun game, but might need to choose a different name...
评论 #30525278 未加载
评论 #30525066 未加载
评论 #30525386 未加载
评论 #30534676 未加载
Wingyabout 3 years ago
I find it fun to write scripts to play games like this, here&#x27;s my solution:<p><pre><code> setInterval(() =&gt; { function jump() { function fireSpaceBarToDocumentElement(eventName) { const SPACE_BAR = 32 const ev = new KeyboardEvent(eventName, { bubbles: true, keyCode: SPACE_BAR }) document.documentElement.dispatchEvent(ev) } fireSpaceBarToDocumentElement(&#x27;keydown&#x27;) fireSpaceBarToDocumentElement(&#x27;keyup&#x27;) } function shouldJump() { function goingLeft() { return ball.speedX &lt; 0 } function goingRight() { return ball.speedX &gt; 0 } function leftPaddleAboveBall() { return ball.y &lt; paddle1.y } function rightPaddleAboveBall() { return ball.y &lt; paddle2.y } if (goingLeft() &amp;&amp; leftPaddleAboveBall()) return true if (goingRight() &amp;&amp; rightPaddleAboveBall()) return true return false } if (shouldJump()) jump() }, 1)</code></pre>
mysterydipabout 3 years ago
I&#x27;m working on a game right now, and one of my roadblocks is how to handle the myriad of resolutions, aspect ratios, and portrait vs landscape modes, plus the overriding some mobile browsers do for touch (scrolling the screen, etc). What has been your approach to consolidating all of those differences so a game &quot;just works&quot; on all platforms?
评论 #30528080 未加载
MrLispyabout 3 years ago
My best score at Almost Pong is 49! <a href="https:&#x2F;&#x2F;www.lessmilk.com&#x2F;almost-pong&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.lessmilk.com&#x2F;almost-pong&#x2F;</a><p>Good game! I had fun playing it.
dylan604about 3 years ago
Ha! I read the instructions and did exactly what it said. Hit space once and the &quot;ball&quot; started to move on non-touch device, I was trying to figure out how to move the paddles so continuously kept watching the ball drop with 0 score. I was halfway convinced that it was a joke game (which would have been pretty clever).
评论 #30526580 未加载
noufalibrahimabout 3 years ago
Very nice. Well done. I love takes like this which subvert the ideas from the old classics. Reminds of of <a href="http:&#x2F;&#x2F;hcs64.com&#x2F;efp.html" rel="nofollow">http:&#x2F;&#x2F;hcs64.com&#x2F;efp.html</a> which is Pong but from the balls point of view.
mushyhammerabout 3 years ago
Missed the chance to name it Flappy Pong
评论 #30523943 未加载
scrameabout 3 years ago
Good Job, I hate you for tempting me to play more.<p>I&#x27;m afraid to play more because I think a bunch of random objects will pop up and make me go crazy, and its a little too late at night for me to start doing that and get sucked into something.<p>Otherwise excellent execution, and I think you pulled off a nice, simple runner style game with a classic look and good polish!
dpixabout 3 years ago
This has THE MOST satisfying sounds of any game I&#x27;ve ever played
评论 #30526422 未加载
6gvONxR4sf7oabout 3 years ago
Bug report: On an iphone with text size larger than default, you can’t see the whole game area. I read with text at 115% (hit the “aA” next to the url on the mobile browser to access font size), so it took me a while to even realize there was supposed to be another paddle on the right side that was off screen.
ilkkeabout 3 years ago
Reminds me very much of AdamAtomic&#x27;s Flappy Jam entry [1] that was later cloned as a fairly popular mobile game called Don&#x27;t Touch The Spikes<p>[1] <a href="https:&#x2F;&#x2F;haxeflixel.com&#x2F;demos&#x2F;Flappybalt&#x2F;" rel="nofollow">https:&#x2F;&#x2F;haxeflixel.com&#x2F;demos&#x2F;Flappybalt&#x2F;</a>
Nowadoabout 3 years ago
You have about 48h to be the first to put it in a mobile app store if you&#x27;re into that. Cool concept!
loxiasabout 3 years ago
This is fantastic! I love it. &quot;I don&#x27;t even like video games&quot; :D<p>Having the experience of fail, score 1, score 1, score 14,... is really fun. I think it has just the right mix of difficulty&#x2F;friction and reward, such that it&#x27;s pretty easy to get success once you &quot;lock in&quot;.<p>I&#x27;d be curious what your creative process is, if you start with a goal idea and then code to build it, or if you go the opposite direction, starting with what can be built and seeing how to make something fun out of it. I&#x27;ve never written any games, though it&#x27;s something I think about.
userSumoabout 3 years ago
Cant belive your project of making a game a week was 8 years ago. it was such a nice project! Over the years lessmilk stuck in my mind as a example of a very cool project that also made some money.
mninmabout 3 years ago
Cool gameplay loop! Lots of short jumps makes it easier. Maybe change it so that every time a paddle is hit the player gets 10 points but looses a point every time they jump.
xmorseabout 3 years ago
Cool game!<p>It would be even better if every time you hit the paddles the speed increases, this way it becomes more difficult with time and makes the game less boring.
评论 #30527910 未加载
skeeter2020about 3 years ago
My immediate reaction was pong + flappy bird. I think the execution, engagement and yes, frustration, matches your intended goals, so good job!
emmaLeabout 3 years ago
It&#x27;s really hard to play on the phone. At first I kept tapping on the links below the game when I focused more on the game and less on my finger position. After I got used to tapping a bit higher and not letting my finger slip down I got another problem: when the paddle was really low, my thumb would block the view so I couldn&#x27;t see the paddle or the ball.
modernerdabout 3 years ago
Reminds me of qomp by Stuffed Wombat (“You are the Ball. Escape.”).<p><a href="https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;1066900&#x2F;qomp&#x2F;" rel="nofollow">https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;1066900&#x2F;qomp&#x2F;</a><p><a href="https:&#x2F;&#x2F;twitter.com&#x2F;wombatstuff" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;wombatstuff</a>
kohlermabout 3 years ago
Haha nice. Hard to play on my QMK based keyboard, probably because I mapped space to be ctrl if hold and that causes some latency
jhanschooabout 3 years ago
One thing to consider to increase the difficulty is to make jumping add to the vertical velocity a la flappy bird, rather than fix it to a certain positive vertical velocity. Right now a reliable strategy is to let the ball fall to a certain angle below the paddle, then spam jump to get a fixed trajectory to the paddle.
评论 #30524699 未加载
评论 #30527208 未加载
antirezabout 3 years ago
It&#x27;s incredible how in a matter of minutes the game becomes so much simpler compared to the first times.
shelbyKiraMabout 3 years ago
HAHAH, Fun little thing I did with this fabulous game was... I&#x27;m running a userscript. The game isn&#x27;t VISIBLE. How far can you get, only with SOUND? <i>cough</i> I gave up pretty quick. But kinda an intriguing thought experiment!
zagrebianabout 3 years ago
On mobile, it would be useful if the tap area was extended below the board by an inch or so.
winridabout 3 years ago
The highest I got was 20, having to stop as I could spend an hour on this.<p>Fun experiment for simple games like this: Play this game every day just for 5-10 rounds before bed and in the morning. You&#x27;ll get a little better every time you get sleep.
wanderer_about 3 years ago
This has a real chance to be a successful mobile game, if I were you I may start thinking about an app. Every project has to stop somewhere, though, so leaving it as a fun little game in the browser would be fine too!
评论 #30527520 未加载
Bluecobraabout 3 years ago
This is a lot of fun! I can’t wait until this gets released on the Atari 2600!
TimTheTinkerabout 3 years ago
Wow, the parabolic motion for this is spot-on. It seems you faithfully reproduced s=(a*t^2)&#x2F;2, or got extremely close to it - very impressive :) It&#x27;s also very responsive.<p>(max score of 47 on macOS Safari)
p0laabout 3 years ago
My best score at Almost Pong is 34! <a href="https:&#x2F;&#x2F;www.lessmilk.com&#x2F;almost-pong&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.lessmilk.com&#x2F;almost-pong&#x2F;</a>
__sabout 3 years ago
Is the name a nod to Almost Pizza <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KLHRjaUBb3o" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KLHRjaUBb3o</a> ?
krossitalkabout 3 years ago
Missed a golden opportunity to name it &quot;Flappy Pong&quot;.
XCSmeabout 3 years ago
This is a really cool idea, it has flappy bird vibes. The only complaint is that it&#x27;s a bit too easy and gets boring after a while because there&#x27;s no challenge.
johnmaguireabout 3 years ago
Great game! On mobile my finger naturally drifted toward the bottom of the hit pad for visibility and I ended up clicking the link below it a couple times. Disappointing. :(
yoz-yabout 3 years ago
I really like this one. My hope is that the upcoming Play date console would be full of these kinds of “I have 30 seconds and want to play a game” jewels.
ChrisArchitectabout 3 years ago
Reminds me of one of the standard version Easter eggs in Android a few versions ago was a game with this exact same &#x27;press to make float&#x27; action
评论 #30524351 未加载
superasnabout 3 years ago
Fun game. On the mobile it would be great if I could tap anywhere on the screen and not just the black area as my thumb obscured the paddles sometimes.
napoluxabout 3 years ago
And in 1 week from now AppStore will be full of clones.
minusSevenabout 3 years ago
His other games didn&#x27;t load on firefox for me.
chrisvalleybayabout 3 years ago
A lot of fun! What might also be fun is if you could hold space &#x2F; mouse 1 to «charge» the jump so that you jump higher if you hold.
mfkpabout 3 years ago
73 on my first try :)<p><a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;2M6ce5h.jpg" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;2M6ce5h.jpg</a>
Vetchabout 3 years ago
This is excellent, creative and could also serve as a much less boring than pong project for starting reinforcement learning.
评论 #30524661 未加载
radicalriddlerabout 3 years ago
Nice! What a fun little game. Ended up with 36, and I feel like after 30, the bars stopped getting smaller, not sure though.
nix23about 3 years ago
Thanks for looking like a dump ass to my coworkers for hammering my mechanical space-bar for 5 minutes strait......
umurgdkabout 3 years ago
These games are so much fun (I&#x27;m talking about your other games too). Especially loved gravity snake and square
jacksonkmarleyabout 3 years ago
Cool.<p>Would be handy if the main page indicated which games were mobile capable so you didn&#x27;t have to click through to find out.
samstaveabout 3 years ago
Great game.<p>Now to modernize it ; NFT ball colors! and store every successful bounce in a blockchain! Grandma will get it. haha
nickkellabout 3 years ago
Can anyone hear audio on mobile? I’ve tried it with both safari and chrome on iPhone and it’s completely mute
评论 #30527114 未加载
GistNoesisabout 3 years ago
For more fun you should play it on the beats of &quot;another brick in the wall&quot; (with some beats skips).
bertmanabout 3 years ago
Fun game! Also Kudos for the &quot;Wordle&quot;-esque share function, i.e. no stupid Twitter or Facebook.
scosmanabout 3 years ago
* flappy pong *
dnateabout 3 years ago
FYI: Your old games (Run, Pixel War etc.) seem to not work in firefox for me while they work in safari.
dietricheppabout 3 years ago
Hah! I recognize this website from the “one game a week” stuff a while back. Had some fun playing those.
tagersenimabout 3 years ago
This is awesome! I did however accidentally click on the links below the game, ruining my streak
adenozineabout 3 years ago
I think I&#x27;m too old to do any better, I got 29. What a neat little idea, very clever!
robbiejsabout 3 years ago
Flappy Pong. Fun stuff! Well done
hyperpallium2about 3 years ago
flappy pong!<p>Great game-feel and sound.<p>Only complaint is a standard one: on mobile, your thumb obscures the play area. Maybe have a surrounding area be touch sensitive? Or say it&#x27;s part of the challenge, to switch thumbs, like you&#x27;re playing both sides...
评论 #30526773 未加载
nextaccounticabout 3 years ago
Very good! The secret is to focus the eyesight on the target, not the ball
itsbitsabout 3 years ago
Nice..<p>minor feedback...sometimes I mistakenly tap `Follow Me on twitter` which opens up twitter app :(
smnplkabout 3 years ago
First 5 attempts I couldn&#x27;t make it past 4, after that I could get to 20 :D
xwdvabout 3 years ago
Next I would like to play a basketball game where I play as the basketball.
Andrew_nenakhovabout 3 years ago
Pong meets Flappy bird. Nice.
srazzaqueabout 3 years ago
Very cool!<p>Brought back old memories of the &quot;Paddle War&quot; in Commander Keen.
Proddductsabout 3 years ago
amazing Little game and other games are also next level.<p>I will feature this in upcoming issue of <a href="https:&#x2F;&#x2F;proddducts.com" rel="nofollow">https:&#x2F;&#x2F;proddducts.com</a>
hungryforcodesabout 3 years ago
I have no idea why your games make me laugh so much when I play them.
umtksaabout 3 years ago
I dont know why but I love one button games, really enjoyed it cheers
uraniumabout 3 years ago
That&#x27;s lovely, thank you. I just laughed out loud playing it.
takladevabout 3 years ago
Just burnt my hour playing this. Goes on to say how awesome it is.
blable2about 3 years ago
OK, well done but boy I&#x27;m really bad at playing games. ha ha
sedivy94about 3 years ago
Gosh that was fun to play! Thank you so much for sharing.
afterburnerabout 3 years ago
Gravity Snake is great!
TeeWEEabout 3 years ago
This is addicting! Make it a mobile app! (Should be simple with Unity) Create a launching website, add branding (keep it simple)<p>And ad a daily challenge &#x2F; and allow users to share it. 80% sure your game will grow fast in MAU
评论 #30526343 未加载
评论 #30526031 未加载
评论 #30525880 未加载
crispyalmondabout 3 years ago
This is such a good take on a classic. I love it!
jgauthabout 3 years ago
Nice. Simple and fun for a few minutes. I got 45
indigodaddyabout 3 years ago
This is kind of brilliant<p>Great fun
Simon_O_Rourkeabout 3 years ago
Great thinking outside the box on a classic!
rubyronabout 3 years ago
29 on fifth try, on iPhone Safari. Love it!
robbywashere_about 3 years ago
best score was 21. my strategy was to keep the &#x27;ball&#x27; as low as possible until it came time to hit the paddle.<p>Nice Work!
JMS2021about 3 years ago
Flappy Balls... Like mine in old age ...
bberenbergabout 3 years ago
This is great, I love it. Max score of 20.
billyboarabout 3 years ago
Cool game! Also has an addictive element.
adrianomartinsabout 3 years ago
Congrats for the dead simple creativity!
ccakesabout 3 years ago
Awesome work! Super fun to burn 10mins on
nadermxabout 3 years ago
I applaud this, simply devilishly hard.
m4rc3lvabout 3 years ago
I like it. Also the sounds are neat.
评论 #30523780 未加载
rezmasonabout 3 years ago
It&#x27;s got a good feel to it.
bodge5000about 3 years ago
love seeing this kind of thing, a simple concept perfectly executed
farzherabout 3 years ago
why does this have so many upvotes???????????????????????????
评论 #30524775 未加载
评论 #30524835 未加载
madcabout 3 years ago
This is brilliant.
rotanibmocy2about 3 years ago
Fun game. Love it
tzotabout 3 years ago
Flapping Pong?
cottsakabout 3 years ago
this is awesome!
taurusnoisesabout 3 years ago
I made it to 7.
herokuabout 3 years ago
Source code?
评论 #30525117 未加载
评论 #30524756 未加载
6510about 3 years ago
very nice, it needs full screen
nro337about 3 years ago
Great game!
TruthWillHurtabout 3 years ago
Genius.
dekken_about 3 years ago
ctrl+f &quot;flappy pong&quot;<p>7 hits<p>yep
alana314about 3 years ago
26
评论 #30524736 未加载