iToverDose/Software· 19 MAY 2026 · 12:18

Turn Any Smartphone into a Game Controller with Open-Source Air Jam

AI-assisted development meets multiplayer gaming in Air Jam, a new open-source framework that transforms every smartphone into a universal game controller. With no apps to install or accounts to create, players join games instantly via QR codes, while developers focus purely on creativity.

DEV Community6 min read0 Comments

In a room full of people, every smartphone is already a powerful game controller waiting to be used. Most devices come with gyroscopes, touchscreens, speakers, and vibration motors—components that rival dedicated gaming peripherals. Yet, despite this potential, multiplayer gaming still often relies on proprietary hardware or cumbersome setup processes. Enter Air Jam, an open-source framework that reimagines how we play together by turning smartphones into instant, no-install game controllers.

What if joining a multiplayer game was as simple as scanning a QR code? No downloads. No Bluetooth pairing. No account creation. Just point your phone’s camera, tap to join, and start playing. That’s the core idea behind Air Jam, a project built to remove the friction between having a game idea and seeing it come to life with friends in real time.

The Problem Air Jam Solves

Multiplayer gaming on phones isn’t a new concept. Platforms like AirConsole have demonstrated how effective smartphones can be as controllers for party games. However, these platforms operate as closed ecosystems, requiring developers to build within their frameworks and follow their rules. Air Jam changes that by offering an open-source alternative—one that anyone can use, modify, and deploy anywhere.

But the real innovation lies in its timing. With AI assistants now capable of writing large portions of code, Air Jam is designed to complement this shift. It handles the infrastructure so developers can focus entirely on creativity.

There are two critical challenges in building a multiplayer game with phone controllers:

  • The infrastructure layer: This includes WebSocket connections, room management, input synchronization, state replication, handling disconnections, and ensuring inputs aren’t lost between network ticks and game frames. This is complex, repetitive, and error-prone system-level code that remains largely the same regardless of the game being built.
  • The creative layer: This involves designing game rules, visuals, controller layouts, and gameplay mechanics that make people laugh, shout, or lean forward in their seats. This is where AI excels—iterating on ideas, refining aesthetics, and prototyping quickly.

Air Jam addresses the first challenge comprehensively. It provides a pre-built infrastructure so developers can focus solely on making something fun. If you’re working with an AI assistant, it can concentrate entirely on crafting the player experience rather than wrestling with networking code.

How Air Jam’s Architecture Works

Setting up a game with Air Jam is straightforward. The framework is built around a React application with two distinct views: one for the host screen (typically a computer or TV running the game) and another for the controller (the player’s smartphone). The communication between them is defined by a Zod schema, which acts as a contract ensuring data consistency.

Let’s look at the input schema from the Pong template, one of the starter examples included with Air Jam:

import { z } from "zod";

export const gameInputSchema = z.object({
  direction: z.number().min(-1).max(1),
});

Here, only one value is required: the paddle’s direction, ranging from -1 (left) to 1 (right). This schema ensures that all controllers send data in a predictable format, eliminating parsing errors and synchronization issues.

The configuration is wrapped into a single airjam object that exposes host and controller components. Here’s a simplified example:

import { createAirJamApp, env } from "@air-jam/sdk";
import { gameInputSchema } from "./game/contracts/input";

export const airjam = createAirJamApp({
  runtime: env.vite(import.meta.env),
  controllerPath: "/controller",
  input: {
    schema: gameInputSchema,
  },
});

In your routing setup, you integrate these components seamlessly:

import { airjam } from "./airjam.config";

<Routes>
  <Route path="/" element={
    <airjam.Host>
      <HostView />
    </airjam.Host>
  } />
  <Route path={airjam.paths.controller} element={
    <airjam.Controller>
      <ControllerView />
    </airjam.Controller>
  } />
</Routes>

On the host side, you access player data and game state with useAirJamHost(), while validated controller inputs are retrieved using useGetInput(). On the controller side, useInputWriter() and useControllerTick() form the entire input publishing interface. The framework abstracts the networking entirely, so you don’t have to write a single line of WebSocket logic.

Shared State Management Without the Hassle

For features like scores, team assignments, and game phases, Air Jam includes createAirJamStore, a Zustand-based state management system with built-in synchronization. The host acts as the source of truth, and all controllers interact with this shared state as if it were local.

Here’s an example of a store for tracking scores and team assignments in a simplified Pong implementation:

import { createAirJamStore } from "@air-jam/sdk";

export const usePongStore = createAirJamStore<PongState>((set) => ({
  scores: { team1: 0, team2: 0 },
  teamAssignments: {},
  actions: {
    joinTeam: ({ actorId, connectedPlayerIds }, { team }) => {
      set((state) => reduceJoinTeam(state, { actorId, connectedPlayerIds, team }));
    },
    scorePoint: (_ctx, { team }) => 
      set((state) => ({
        scores: { ...state.scores, [team]: state.scores[team] + 1 },
      })),
  },
}));

Both the host and controller components can use this store. When the host updates the state, the change is broadcast to all connected controllers. When a controller triggers an action, it’s transparently sent as a remote procedure call (RPC) to the host, executed there, and the result is propagated back to all devices. Action handlers receive context about the actor and connected players, ensuring that authorization and logic remain centralized.

This architecture makes it possible for AI assistants to focus entirely on game design rather than networking complexities. They can write Zustand-shaped stores and Zod schemas, confident that Air Jam will handle the rest.

From Idea to Playable Game in Four Steps

Building a game with Air Jam follows a streamlined workflow that emphasizes speed and simplicity. Here’s how it works in practice:

  1. Scaffold the project

Start with a single command to generate your game structure:

   npx create-airjam my-game

Choose a template—Pong for simplicity or Air Capture for a more complex experience—and install dependencies using pnpm install. In minutes, you’ll have a fully functional game ready for customization.

  1. Define the game logic

Open the project in an AI-assisted coding environment like Claude Code and describe the gameplay you envision. The AI can generate the initial structure, including the Zod schema for inputs and the Zustand store for shared state. For example, you might say:

  • "Create a game where players tilt their phones to move a paddle and score points."
  • "Use a single input: a number between -1 and 1 representing tilt direction."

The AI can draft the schema and store code, which you can then refine or expand.

  1. Design the UI

Build the host view (for the big screen) and the controller view (for smartphones) using React. Air Jam provides components and hooks to simplify this process. The host view might display the game state, while the controller view renders a simple touch or tilt-based interface.

  1. Test and iterate

Launch the game locally or deploy it to a server. Players join by scanning a QR code on the host screen. Since Air Jam handles networking and synchronization automatically, you can focus on tweaking the gameplay, adjusting difficulty, or adding new features without worrying about backend issues.

Air Jam’s design philosophy aligns perfectly with modern AI-assisted development. By abstracting away infrastructure, it empowers developers—whether human or AI—to concentrate on what matters most: creating engaging, memorable experiences.

The Future of Play

Air Jam represents more than just a technical achievement. It’s a glimpse into the future of collaborative gaming, where the barriers to entry are minimal and the focus is on creativity. As AI continues to evolve, tools like Air Jam will become even more powerful, enabling rapid prototyping and experimentation.

Imagine classrooms where students build simple multiplayer games to learn physics concepts. Picture family gatherings where a quick game of digital charades or trivia is launched in seconds. With Air Jam, the tools to make these moments possible are now in anyone’s hands—literally.

The framework is open-source, extensible, and ready for contributors. Whether you’re a solo developer experimenting with AI co-pilots or a team looking to streamline multiplayer game development, Air Jam offers a compelling starting point. The next great party game might already be a few lines of code away.

AI summary

Discover Air Jam, the open-source framework that turns every smartphone into an instant game controller. No apps, no accounts—just QR codes and creativity, optimized for AI-assisted development.

Comments

00
LEAVE A COMMENT
ID #YH1SZQ

0 / 1200 CHARACTERS

Human check

4 + 3 = ?

Will appear after editor review

Moderation · Spam protection active

No approved comments yet. Be first.