Skip to content
Thoughtful, detailed coverage of everything Apple for 34 years
and the TidBITS Content Network for Apple professionals
12 comments

Reading Too Much into Pong Wars

Jason Kottke recently said he could spend all day watching Koen van Gilst’s Pong Wars, a JavaScript-based mashup of Pong and Breakout (designed by Steve Wozniak with help from Steve Jobs) that feels like a hyperactive 8-bit lava lamp. Pong Wars features two balls, Day and Night, that bounce according to the physics of those games. The Day ball travels through light areas and turns dark blocks light, whereas the Night ball does the reverse, turning light blocks dark.

Simple though it is, Pong Wars is mesmerizing. I couldn’t prevent my brain from rooting for the underdog (“Go, Day!”), wondering how unbalanced the score could get (Night always led and briefly exceeded 800 of the 1024 possible points), assigning narrative to the onscreen actions (“Watch out, he’s got a groove going on the bottom.”), and reflecting on whether it was playing out larger themes of good versus evil (or at least Spy vs. Spy).

Taking Kottke’s comment at face value, I let Pong Wars run while doing other things and came back a while later to discover the two balls locked in a vibratory loop (below left). That seemed odd, so I reloaded the page. The final state was exactly the same, so I closed the page and opened it again, starting a timer to see how long it would go. Indeed, 32 minutes in, it would always get stuck in the same way.

Pong Wars

I pinged Koen van Gilst on Mastodon about the need for an initial random seed, but my old friend Keith Dawson popped up a few minutes later with suggested fixes. Since Pong Wars is open source and just a single index.html file on GitHub, I copied it locally, made Keith’s changes, and voila! Day and Night are more evenly matched in Keith’s modified version (above right), and although every run-through so far has eventually ended up in a vibratory loop, it’s no longer predictable when it will happen.

Who will port Pong Wars to the Vision Pro so the balls can bounce around your house? For now, I’d settle for a macOS screen saver.

Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 33 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.

Comments About Reading Too Much into Pong Wars

Notable Replies

  1. There are 1024 squares in the grid, not 1000. So the max score would be 1023 since the one losing takes up at least one square.

  2. That’ll teach me to estimate without adding up the values. :-) Fixed…

  3. I played the edited version as mentioned in the last lines. It got stuck very soon, with day and night in an endless embrace.

  4. Yeah, I’ve seen it get stuck very quickly sometimes and other times go for hours.

    Sometimes it almost feels organic, in the sense of the Game of Life.

    Thanks! It looks like there are some interesting proposals in those pull requests.

    https://github.com/vnglst/pong-wars/pulls

  5. The first thing I noticed is that they need to add a few things that Atari had decades ago in order to avoid infinite repeating loops.

    On games with user-controllable paddles, the ball’s “reflect” angle would not always be a simple 90-degree reflection. Instead, the angle of the ball leaving the paddle would be a function of where on the paddle it hit - closer to the center produce a near-perpendicular angle, while hits close to the edge produce a much wider angle.

    Games that involved a “ball” infinitely bouncing would occasionally (maybe once per minute or so) have the software select a random angle after a bounce, in order to ensure it has the potential to go anywhere. (So there is no position of Pong paddles that could result in the ball forever bouncing between them without the players having to move their paddles - so an abandoned game will always end.)

    And (as one PR already suggested), the initial angles should be random, not simple 45° paths.

  6. An important thing, given Atari’s and Pong’s coin-op roots!

  7. Reminds me of the steady state that Life often reaches. (Life as in the game that John Conway devised)

  8. I modified it into a version I call “Tag-Team Pong Wars”. When the balls collide, they change colors. It’s at Tag-Team Pong Wars.

    It works but could use some fine-tuning. Right now, the balls move sequentially through the list of colors. I want to make the next color random. The balls can still get locked into an endless loop but I think the random colors might fix that. But I’ve already spent a couple hours on this and I need to start doing my real job!

  9. I saw them on top of each other, thrashing colors for an extended period of time (a minute or so), but they eventually broke free of each other.

  10. That makes sense. There is a little bit of randomness added with every iteration.

  11. Ok, I couldn’t help myself! I added the random colors. And I shortened the color names so they won’t word-wrap when the canvas is displayed at its maximum width. I really need to get to work now.

    The new version is at the same link.

Join the discussion in the TidBITS Discourse forum

Participants

Avatar for ace Avatar for mac Avatar for juandesant Avatar for aforkosh Avatar for nootski Avatar for Shamino Avatar for Halfsmoke Avatar for stngiam