10 ms·
Show HN: Pong Wars
- breaker-kind 3y agohttps://contranoid.com/ https://contranoid.com/
- throwaway2046 3y agoSo hypnotizing... I was waiting for something magical to happen when the two balls touch.
- orenlindsey 3y agoOnly a single HTML file. All you need.
- geor9e 3y agoI thought this comment was saying they only used html like this other HN post was talking about https://www.htmhell.dev/adventcalendar/2023/2/ https://www.htmhell.dev/adventcalendar/2023/2/ . But no, the comments just saying they put all the .js and .css inside the .html file.
- qwertyforce 3y agodx1*=2; dy1*=2; dx2*=2; dy2*=2;
- senkora 3y agoSee also OP’s post on Mastodon: https://hachyderm.io/@vnglst/111828811496422610 https://hachyderm.io/@vnglst/111828811496422610
- geor9e 3y ago3 colors would get interesting, because as the other two bully one into a corner, the small space causes rapid block zapping, quickly bringing it back from the brink of defeat.
- brown 3y ago4 players: https://codyebberson.github.io/pong-wars/ https://codyebberson.github.io/pong-wars/
- DylanSp 3y agoThat's definitely cool to watch, the patterns of territories get a lot more complex.
- almostnormal 3y agoIn that one balls seem to be able to punch through (and flip) squares (when going almost vertical) instead of bouncing on every square they hit.
- bitcurious 3y agoIt's a bug/choice that is present in the original as well.
- macintux 3y agoSpent a fair bit of time watching that one last night, thanks. I can definitely see why computer scientists were entranced by Conway's Game of Life.
- plancien 3y agoI was inspired by this and created a version with customizable ball count, accessible code... and a speed slider, to satisfy the less patient among us. https://explorers.toxicode.fr/?remoteWorkspace=pong-war https://explorers.toxicode.fr/?remoteWorkspace=pong-war
- archon1410 3y agoThe code links this tweet as the source of the idea: https://twitter.com/nicolasdnl/status/1749715070928433161 https://twitter.com/nicolasdnl/status/1749715070928433161 [nitter: https://nitter.net/nicolasdnl/status/1749715070928433161 https://nitter.net/nicolasdnl/status/1749715070928433161] Quote: "The endless fight for #genuary23 #genuary #genuary2024 It's not an original idea, I've seen this before but couldn't put a hand on it." It says the battle is endless. I wonder if there's any way to mathematically prove that.
- baq 3y agoBy definition… if there’s no end condition, it won’t end ;)
- praptak 3y agoOn top of this there's a negative feedback loop. The ball whose territory gets smaller has less distance to travel between hits. This means that even if there was anything resembling a "win" condition it would be hard to achieve.
- mrec 3y agoYou'd think, but I'm currently looking at a 161/863 split which has been pretty stable for a while now. I thought at first that ball speed is being scaled by territory size to cancel out the negative feedback, and the "winning" ball is moving noticeably faster than the losing one, but I can't see that being deliberate in the code. (There is some randomization of speed on a bounce, but it ought to be pure noise.) EDIT: 120/904 now.
- yellowapple 3y agoOne possible win condition would be a ball reaching the opponent's side. That happened in my case, with "night" eventually breaking through to the left-most edge.
- geor9e 3y agoThat just explains why it tends towards balance. It's just like all the air molocules in a room reliably bouncing around where you can inhale them. There's no hard law of nature saying all the air wont move to one side, suffocating you. It's just statically extremely improbable. But they asked for proof for or against a possibility at all, not whats probable.
- pbiggar 3y agoWould love to be able to speed this up!
- sbarre 3y agoI had the same thought... If you drop this in the console you can speed things up: dx1*=2;dx2*=2;dy1*=2;dy2*=2; edit: someone else in the thread figured out a better way, I updated mine, but credit to them. Although it has accuracy issues when you get too fast...
- TacticalCoder 3y agoThere's beauty in knowing that one could be ported and run perfectly fine on any old 8 bit computer! So simple yet mesmerizing...
- wkjagt 3y agoNow I want to try this on my Commodore 64. I should already have some code I could reuse as I was already working on a breakout type of game. So the “clearing a block and bounce the ball back in the right direction” should be somewhat reusable.
- tamimio 3y agoIt look like the white ball is faster..
- sbarre 3y agoThe code introduces some speed variation on each bounce, either positive or negative so it's possible that over time one ball ends up a lot faster?
- deleted 3y ago[deleted]
- jaredhallen 3y agoIt does seem to have an advantage. I started it over several times and haven't seen the day side ever get ahead.
- billylo 3y agoWhat if it has real paddles? left-hand (using A,Z) vs. right-hand mode (K,M)? :-)
- NKosmatos 3y agoHey, I can see an addictive mini game being developed pretty soon… I’m sure one of the bright minds of HN will offer us this game so we can alter/control/influence this never ending battle of the two pongs :-)
- netsharc 3y agoSeeing "day" and "night", I thought the site was taking the local time reported by browsers of all the visitors, and rendering a "pie graph" of the proportion of visitors currently with daylight and visitors without daylight... Although I suppose with the planet's unequal distribution of population (and then the distribution of HN visitors), such a graph would have a correspondence with the time of day. Now I'm wondering if there is a visualization of time of day at Z vs number of world population in daylight (assuming good weather and no smog...)
- notfed 3y agoHold my beer.
- notfed 3y agoDone, I opened a pull request for this. https://github.com/vnglst/pong-wars/pull/5 https://github.com/vnglst/pong-wars/pull/5
- notfed 3y agoHosted it here: https://identity.pub/pong-wars-web/ https://identity.pub/pong-wars-web/ Control the paddles with: - Q (Player 1, Up) - A (Player 1, Down) - P (Player 2, Up) - L (Player 2, Down)
- sega_sai 3y agoIt is really cool. It would be interesting to make the speed proportional to the either the number of squares owned or the square root of that. Because right now as the area the ball owns gets smaller, the number of hits will increase at the same speed.
- JKCalhoun 3y agoLike the card game, "War", it seems to self-regulate that way. I assume neither side will ever win.
- yellowapple 3y agoWith "War" it's indeed possible to win, though.
- deleted 3y ago[deleted]
- sodality2 3y agoWar is also entirely deterministic and contains no choices, so some don't consider it a game
- Waterluvian 3y agoHmm! Because once the cards are shuffled everything is a fixed series of events? Would Snakes and Ladders be the same then if we replaced a die with a randomized deck of cards of the numbers 1-6? And in that sense: any “game” that’s purely random is also not a game then?
- jaredsohn 3y agoAgree but I think these things can be considered games in the sense that it gives younger kids practice in following rules and interacting within a group. Also is an activity for them to spend time and there is a concept of 'winning' even if the participants cannot impact that.
- ericskiff 3y agoOh man - I love this, but I thought it was going to be a loving write up of the freeware “mortal kombat but it’s pong” game from 1994 https://archive.org/details/msdos_Pong_Kombat_1994 https://archive.org/details/msdos_Pong_Kombat_1994
- BugsJustFindMe 3y agoOr the better named Mortal Pongbat https://www.macintoshrepository.org/5394-mortal-pongbat https://www.macintoshrepository.org/5394-mortal-pongbat
- layer8 3y agoThere’s a universe in which it will reach a yin-yang configuration.
- joshuahutt 3y agoMine did. https://imgur.com/a/DC8iqY1 https://imgur.com/a/DC8iqY1
- jareklupinski 3y agosometimes you gotta make the universe https://imgur.com/a/dtY960z https://imgur.com/a/dtY960z https://github.com/vnglst/pong-wars/pull/8 https://github.com/vnglst/pong-wars/pull/8
- dbrueck 3y agoDarn, I wish they had named it breakout wars instead.
- Waterluvian 3y agoI love how the “losing” side has a shorter distance to go to “fight back” so it is a somewhat endless battle.
- ognarb 3y agoJust did an implementation of this in C++ with Qt Scene Graph as a learning experience in case someone is interested https://invent.kde.org/carlschwan/warpong/-/blob/master/src/scene.cpp?ref_type=heads https://invent.kde.org/carlschwan/warpong/-/blob/master/src/...
- Tepix 3y agoNeat. Isn't it a bug that sometimes the ball drills deeper?
- wkjagt 3y agoI don’t thinks so. It’s a bit like in a breakout game where the ball gets “stuck” behind some blocks and clears a ton of them by bouncing back and forth between them.
- pests 3y agoI think there is. The ball can wedge itself between cells that are touching and then it penetrates 5-6 cells in clearing the whole path instantly (probably as it's bouncing between the 0 pixel gap between cells). I had just started the sim and the left ball on its first or second bounce suddenly took a major section of the right side.
- eigenvalue 3y agoNot trying to steal anyone's thunder here, but I was so taken with this little program when I saw it earlier today on Twitter that I thought it might be fun to make it somewhat interactive, so that the players could actually influence the path of the balls using the keyboard, and also activate a "speedup" (mode but at the expense of their ability to influence the path). I also added some charts to track the state over time. You can "play" it here: https://dicklesworthstone.github.io/ball_fighters/ https://dicklesworthstone.github.io/ball_fighters/ And code is here: https://github.com/Dicklesworthstone/ball_fighters https://github.com/Dicklesworthstone/ball_fighters I give full credit to the original author of this post FWIW.
- voisin 3y agoSomething seems off in the behaviour, at least on mobile. The bouncing doesn’t seem to be the same.
- eigenvalue 3y agoThe original collision behavior glitched (the ball would skip through blocks of the opposite color)when the velocity was higher, so I tweaked it a bit so that wouldn’t happen. That probably explains the difference.
- notfed 3y agoI just did my own mod, hosted here: https://identity.pub/pong-wars-web/ https://identity.pub/pong-wars-web/ Control the paddles with: - Q (Player 1, Up) - A (Player 1, Down) - P (Player 2, Up) - L (Player 2, Down) Pull request opened: https://github.com/vnglst/pong-wars/pull/5 https://github.com/vnglst/pong-wars/pull/5 > I give full credit to the original author of this post FWIW. Ditto :)
- starshadowx2 3y agoSometimes a ball gets stuck behind the paddle in your version.
- deleted 3y ago[deleted]
- Wowfunhappy 3y agoI wish the speed of the balls didn't change. I would prefer that randomness come from slight changes to the bounce angle.
- totetsu 3y agoIt’s like staring into a mirror for the soul. It’s just dots and square why should it feel so dramatic
- cypherpunk666 3y ago€0.02 another pong variant, desktop only tho... https://www.obfusco.com/pn0gjs/index.html https://www.obfusco.com/pn0gjs/index.html
- boredhedgehog 3y agoI'm greatly fascinated by this kind of thing, but I have to call it "this kind of thing" because I don't even know if there are genre terms to categorize and analyze them. They're inspired by game algorithms, but they aren't games; Conway's "Game of Life" was a misnomer. They're animated, but they aren't scripted like animations. In the real world we have someone like David C. Roy, who calls his art "kinetic sculptures". Algorithmic motion pictures? Game simulators? Autonomous automatons?
- quijoteuniv 3y agoAlgorithm haiku
- rickdeveloper 3y agoI have seen the term "zero player game" used for this. There is even a short Wikipedia article: https://en.wikipedia.org/wiki/Zero-player_game https://en.wikipedia.org/wiki/Zero-player_game.
- deleted 3y ago[deleted]
- drbscl 3y agoI'm a fan of the term "toy", in a similar lens as "executive toy"
- lou1306 3y agoChaotic systems? As in, fully deterministic systems that are highly sensitive to initial conditions? EDIT: browsed the code a bit and there is some randomness in the bounce dynamics, so it's only "fully deterministic" if you count the PNRG seed as part of the initial conditions.
- chrisweekly 3y agoIf it's chaotic, is it still fully deterministic?
- prakashn27 3y agoCan someone explain what is use of this ? Is there something I am missing? More confined the area ball bounces more Other ball always occupies 1 spot at time These two conditions make this game never ending
- reqo 3y agoIt does not have to have a use or a point, it is up to you to decided what it represents. I see at as an interactive yin and yang!
- fifilura 3y agoIt represents a statistical distribution. Probably not a a bell curve but something related. The use of it? Humanity has yet to find out, but there are lots of uses for other statistical distributions. Maybe it finds it use in a machine that calculates the optimal route for autonomous robot drones to take in a warehouse? (Just making it up) Meanwhile it is there for you to enjoy. A toy.
- charlieyu1 3y agoInteresting, but is it possible to speed up, or change the color scheme?
- jb1991 3y agoThis is unexpectedly hypnotizing.
- robblbobbl 3y agohaha cool, reminds me of kid cudi day 'n' night
- widea 3y agoInteresting, I wonder if randomness and jitter as its source play a part here. Than, is this the visualisation of a True Random Number Generator?
- dorus42 3y agoMy 12 year old son just made it in Scratch: https://scratch.mit.edu/projects/957461584/ https://scratch.mit.edu/projects/957461584/
- jprd 3y agoYou are rightfully proud!
- qwertox 3y agoGreat idea, but watching it makes me feel terribly anxious.
- ramijames 3y agoThis is genuinely beautiful on a few levels. Esthetically it is pleasing to just sit and watch. Philosophically it is interesting in that it is a digital metaphor for an ongoing struggle. Lastly, and most interestingly, it remixes two really simple old ideas into something new. This is an exceedingly rare thing to do well. Kudos. Many kudos.
- Duanemclemore 3y agoTooo cool. I sat and watched it play for a length of time that's longer than I'm comfortable admitting last night.
- MegaDeKay 3y agoThis would look great running on a HUB75 LED panel driven by an ESP32!
- quercusa 3y agoSetting the with to 1200 in <canvas id="pongCanvas" width="1200" height="800"> give flatter bounces off the long walls. This makes for some interesting 'drill' patterns
- jmmv 3y agoSo cool I had to spend an hour replicating it in EndBASIC: https://repl.endbasic.dev/?run=jmmv/pongwars.bas https://repl.endbasic.dev/?run=jmmv/pongwars.bas -- Super-hacky and buggy, but it works for a quick demo! Make sure to press any key while this runs to drop into the interpreter and play around :)
- busfahrer 3y agoThis reminds me of a blog post a while advocating less state, as a demo they implement the infamous DVD screensaver completely stateless.
- BorisMelnik 3y agovery cool! reminds me of Arkanoid