Lurker News
Two browser windows (acting as socket clients) communicate their:

- Screen dimensions - (screen.width, screen.height)
- Window dimensions - (window.innerWidth, window.innerHeight)
- Window X/Y position - (window.screenX, window.screenY)
...or whichever calculation works best for you.
The original work by Bjorn Staal https://twitter.com/_nonfigurativ_/status/172732259457002734 used localStorage, but I found sockets more fun, because if tweaked a bit, this can be shared with friends.
Here's a demo of how it works and the codebase: https://github.com/Momciloo/fun-with-sockets/

Comments (129) 42 threads

Show all comments

Showing thread 4 of 42

Simran-B#
If you like this, you might also enjoy WindowKill, a video game similar to Asteroids that cleverly uses windows that can overlap and interact with each other.

You need to shoot at the window boundaries, too, or the window shrinks. Additional windows appear later in the game with boss enemies.
Gameplay video: https://youtu.be/7iP68FZWVxM