Ravvioli GitHub avatar

browsertabs-talking

Ravvioli

A browser experiment where a Pong ball moves seamlessly across multiple browser windows using localStorage as a cross-window message bus.

Stars

144

7-day growth

No data

Forks

8

Open issues

0

License

No data

Last updated

2026-07-05

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It demonstrates a creative, dependency-free approach to multi-window coordination, turning any desktop layout into a shared game table.

Who it is for

  • Web developers exploring inter-window communication
  • Creative coders building multi-screen browser experiences
  • Game enthusiasts interested in novel input/output setups

Use cases

  • Learning how localStorage can synchronize state across windows
  • Prototyping games or visualizations that span multiple monitors
  • Creating interactive installations where users arrange windows arbitrarily

Strengths

  • No runtime dependencies – uses only browser APIs
  • Simple host-election mechanism that works even with hidden tabs
  • Collision model treats gaps between windows as walls and touching windows as rooms

Considerations

  • Collision check uses leading edge only, may clip through very small gaps
  • Requires separate browser windows (not tabs)
  • Must be served over localhost; file:// protocol not supported

README quick start

Multi-Window Pong

A tiny browser experiment where one glowing Pong ball moves across multiple real browser windows as if the desktop were one shared table.

Open the same URL in two or three separate windows, arrange them on your screen, and the ball will cross between touching windows. Empty space between windows behaves like a wall.

How It Works

Browser windows from the same origin can communicate through localStorage. When one window writes to localStorage, every other open window receives a storage event.

This project uses that as a tiny message bus:

  1. Each window writes its screen rectangle: screenX, screenY, innerWidth, and innerHeight.
  2. All windows keep a live registry of the other windows.
  3. The window with the lowest id becomes the host.
  4. Only the host runs physics.
  5. The host broadcasts the ball position through localStorage.
  6. Every window renders the same global ball position relative to its own screenX/screenY.

That means each canvas is just a viewport into one shared screen-space coordinate system.

The collision model asks one simple question: is this screen point covered by any open window? If yes, the ball can move there. If no, it bounces. This makes touching windows behave like connected rooms while gaps behave like walls.

Run

Serve the folder over localhost. Do not open index.html directly with file://.

node server.js

Then open:

http://127.0.0.1:8000/

Use separate browser windows, not tabs.

Test

node physics.test.js
node windowRegistry.test.js
node viewport.test.js

The tests cover the important weird parts: open-room collision, hidden tab host election, and shared screen coordinates.

Files

  • index.html - full-window canvas and minimal styling
  • main.js - app wiring and animation loop
  • windowRegistry.js - window heartbeat, cleanup, and host election
  • physics.js - host-only ball physics
  • renderer.js - glowing trail renderer
  • viewport.js - shared screen-space window rectangle

Notes

This is intentionally dependency-free at runtime. It uses browser APIs, canvas, and localStorage.

The collision check probes the ball's leading edge, not its full swept circle. That is enough for normal window layouts. If you make tiny gaps or tight concave shapes, it may clip a corner.

Related repositories

Similar projects matched by category, topics, and programming language.

react
Featured
react GitHub avatar

react

React is a JavaScript library for building user interfaces with declarative, component-based, and cross-platform design.

Web DevelopmentFrontend Frameworks
246,741
tandpfun
Featured
tandpfun GitHub avatar

wardrobe

A GPT‑image powered app that extracts individual garment cutouts from photos, organizes them into a digital wardrobe, and generates modeled outfit previews.

JavaScript
1,570
mshumer
Featured
mshumer GitHub avatar

Claude-of-Duty

A browser-based first-person shooter built entirely with procedural generation and orchestrated AI agents, featuring 55k lines of Three.js/WebGL2 code and no art assets.

AI & Machine LearningAI Agents
1,234