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.
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't load any assets, all sprites and sounds are generated with code.
Happy to answer questions, and please let me know if you have any feedback on the game. Thanks!
I helped the author track down and fix a certain bug: the paddle would get stuck to the ground, when the fractional subpixel value of its y-coordinate was very slightly below zero. He sent me a free cartridge and T-shirt as thanks.
Edit: oh wait, it's way more fun on Safari. On Firefox it feels slow and slugish, but on Safari it's great!
I think the game should scroll up infinitely as you progress. It will enhance the psychological feel of falling in space when the pong drops. And you can introduce levels, bosses, goals, etc.
The basic game play mechanic here is solid. Just like keeping a party balloon from hitting the ground!
Safari on m1 mac - no lag and frustratingly fun :)
Nice game!
And ad a daily challenge / and allow users to share it. 80% sure your game will grow fast in MAU
May I ask why? Like Wordle, this game seems perfect for the web browser. Not every game needs to be an app; virtually all mobile browsers allow you to shortcut a website to your phone's dashboard. Wordle demonstrates the general public is still perfectly happy to access a web based game.
I also can't see need to rewrite it in a fully fledged game engine, such as Unity? That seems to me to add a lot of overhead for what is a really simple game.
Although nowadays if people don't see a GitHub link they think there is no source code available.
But still he could just have taken a look into the DevTools
https://archive.org/details/PLBMPongOut_1020
You could in fact do likewise: let the player choose the initial parameters and the speed of change. Maybe with preset difficulty tiers if high scores are kept.
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 "#". We would spend some time at the beginning of the class building/improving it and at the end playing it. We used keys like "W" and "S" for the left player and "O" and "L" for the right player. Since the initial setup with rendering and "physics" of the game went quite fast, we thought about how to improve it and make it more fun.
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: - "wall", would create a 3 squares wall at the location of the bonus - "turn of the lights", would hide everything but the ball (even the paddles) - "gun", would allow you to shoot and destroy walls and bonuses - "bigger/smaller paddle", self explanatory - "net", 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.
It's been my one and only experience building a game but I think it was the most fun I've had programming… If anybody is up for re-building a pong with bonuses I'd be definitely up for that ;)
Back on the topic: love the implementation OP, pretty addictive. And, as can be read above, it brought back some nice memories.
- Makeing the paddle wider or narrower
- Multi-ball
- Capturing / releasing the ball when it hits the paddle.
- Destructive ball (pass through walls)
- Extra life
[1] https://www.classicgame.com/ArkanoidSharing to good and bad bonuses between us (the two players) definitely added a cherry on top of this experience though.
[0] https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResT...
* Higher refresh rates means more frames can be displayed each second by the monitor
* Lower latency between some input action (mouse, keyboard) and the frame being drawn on the monitor (provided your game can run at a matching number of frames per second; FPS)
* Synching your FPS to refresh rate (e.g. if you're game can run at a locked 280fps and your monitor is running at 280hz) will remove tearing and provide a very smooth experience
On the desktop the benefits are less pronounced: Everything just feels a bit smoother, like moving your mouse point/open windows around the monitor.
Such high refresh rate displays normally aren't very colour accurate when compared to displays used for media editing.
1 Player = Almost Pong
2 Players = Pong
3 Players = Pong + Almost Pong
I especially appreciate the "loads no assets" aspect. I will take a look at the code in the morning!
p.s. have you considered the name "Flappy Pong"?
0: https://d33wubrfki0l68.cloudfront.net/bundles/72f7c09a3e8485...
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.
Yes, I guess also inspired by Flappy Bird.
Great game-feel and sound.
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's part of the challenge, to switch thumbs, like you're playing both sides...
Oh, and soon you'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.
[0] https://www.cnet.com/tech/services-and-software/no-flappy-bi...
* https://news.ycombinator.com/pool, explained at https://news.ycombinator.com/item?id=26998308
If Web Audio is disabled then window.AudioContext is undefined, causing a crash:
Uncaught TypeError: AudioContext is not a constructor
Sound https://d33wubrfki0l68.cloudfront.net/bundles/72f7c09a3e8485a33911cdf084acaeaf58ce17ce.js:5
startGame https://d33wubrfki0l68.cloudfront.net/bundles/72f7c09a3e8485a33911cdf084acaeaf58ce17ce.js:482 setInterval(() => {
function jump() {
function fireSpaceBarToDocumentElement(eventName) {
const SPACE_BAR = 32
const ev = new KeyboardEvent(eventName, { bubbles: true, keyCode: SPACE_BAR })
document.documentElement.dispatchEvent(ev)
}
fireSpaceBarToDocumentElement('keydown')
fireSpaceBarToDocumentElement('keyup')
}
function shouldJump() {
function goingLeft() { return ball.speedX < 0 }
function goingRight() { return ball.speedX > 0 }
function leftPaddleAboveBall() { return ball.y < paddle1.y }
function rightPaddleAboveBall() { return ball.y < paddle2.y }
if (goingLeft() && leftPaddleAboveBall()) return true
if (goingRight() && rightPaddleAboveBall()) return true
return false
}
if (shouldJump()) jump()
}, 1)Good game! I had fun playing it.
I'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.
Otherwise excellent execution, and I think you pulled off a nice, simple runner style game with a classic look and good polish!
Having the experience of fail, score 1, score 1, score 14,... is really fun. I think it has just the right mix of difficulty/friction and reward, such that it's pretty easy to get success once you "lock in".
I'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've never written any games, though it's something I think about.
Fun experiment for simple games like this: Play this game every day just for 5-10 rounds before bed and in the morning. You'll get a little better every time you get sleep.
(max score of 47 on macOS Safari)
Would be handy if the main page indicated which games were mobile capable so you didn't have to click through to find out.
Now to modernize it ; NFT ball colors! and store every successful bounce in a blockchain! Grandma will get it. haha
minor feedback...sometimes I mistakenly tap `Follow Me on twitter` which opens up twitter app :(
Brought back old memories of the "Paddle War" in Commander Keen.
I will feature this in upcoming issue of https://proddducts.com
Great fun
Nice Work!
7 hits
yep