Docs

Make a multiplayer game on friendslop and play it with your friends tonight. This page gets you from nothing to a room link. The game guide on GitHub has every detail.

Try the demo

Control Points is a ten a side shooter built on friendslop, and the quickest way to see what a game gets for free: the lobby, teams, bots, the scoreboard, chat and the Esc menu. Open it, pick a name and press Host this game, then Start match. Bots fill both teams, and friends can join from the room link. You need a keyboard and mouse.

Play the demo

Its code is in games/cp, so you can see how a bigger game is put together.

Getting started

You need a free GitHub account, Git and Node.js 20 or newer. Your game lives in your own copy (a fork) of the friendslop repo, because a game reaches the kit by relative paths and needs the repo around it.

  1. Fork it

    Press Fork on the friendslop repo, then copy your fork to your computer.

    git clone https://github.com/YOU/friendslop cd friendslop
  2. Start a game

    This copies the starter to games/my-game: a room where everyone is a dot that walks around, and a bot that wanders. It has no rules yet.

    npm run new-game -- my-game "My Game"
  3. Play it

    This installs what it needs the first time, starts a server on your PC and opens your browser at localhost:8080. Create a room, then join it from a second window to play against yourself.

    npm run play
  4. Change it

    Edit the files in games/my-game. With npm run dev the server restarts when you save, and a browser refresh picks up screen changes and keeps your seat.

    npm run dev

With your AI agent

Paste this into Claude Code, Cursor or any coding agent that can run commands. It sets everything up, then asks you what game you want.

Set me up to make a multiplayer game with friendslop.

1. Fork https://github.com/joshhickson/friendslop to my GitHub
   account and clone my fork. With the GitHub CLI that's:
   gh repo fork joshhickson/friendslop --clone
   If you can't fork it, tell me to press Fork on GitHub.
2. Read docs/making-a-game.md before writing any code.
3. In the clone, run: npm run new-game -- my-game "My Game"
4. Ask me what game I want to make, and ask follow-up
   questions until you know how it plays. Then build it
   in games/my-game.
5. Run npm run play and check it in two browser windows.
6. Commit and push to my fork.
7. Give me the link to the game folder. It looks like
   https://github.com/MY-USERNAME/friendslop/tree/main/games/my-game

Once it's going, a few things help:

  • Describe how the game plays, more than how to code it. The agent knows where the code goes from the guide.
  • Ask for one change at a time and play it in two windows after each one.
  • When something breaks, paste the error from the browser console or the terminal back to the agent.
  • Ask it to add a bot.js early, so you have someone to play against.

A game folder

A game is one folder in games/. The server finds it when it starts.

games/my-game/ server.js rules and game state (required) client/index.js what players see and do (required) bot.js a bot player (optional) shared/ code both sides use, such as maps assets/ images, sounds and models

Use relative imports in server.js, bot.js and shared/, such as ../../server/kit/index.js or ./shared/map.js. A game shared by link runs those files in a Web Worker, where other paths don't resolve. Build asset addresses with new URL('../assets/ship.png', import.meta.url).

Where your rules go

Rooms, passwords, the lobby, teams, team scores, the Tab scoreboard, chat, the Esc menu, reconnects and late joiners are done for you. You write two files.

server.js decides

It describes the game with defineGame: name, player counts, teams, lobby settings, scoreboard columns and controls. Its create(ctx) runs when the host starts a match and returns the hooks:

  • onPlayerJoin and onPlayerLeave
  • onMessage(player, type, data) for what a player sends
  • tick(dt), called many times a second
  • onEnd to clean up

Send state with ctx.broadcast, keep score with ctx.addTeamScore and ctx.addStat, and finish with ctx.endMatch. Check everything a player sends: isNum, isVec and clamp are in the kit.

client/index.js shows

It draws the game and reads input with defineClientGame. Its mount(api) gets:

  • api.root for your canvas and api.hud for your overlay
  • api.send(type, data), which arrives in onMessage
  • api.on(type, fn) for what the server broadcasts
  • api.players(), api.me, teams and scores

The client kit has keyboard and mouse input, sounds with no files, and a three.js kit for low-poly 3D worlds, characters and effects.

Every hook, ctx and api call, plus patterns for turn-based games, fast shooters and custom endings, are in the guide.

Share it with a link

Friends don't install anything, and you don't need a server.

  1. Push your game to your fork.
  2. Open the game's folder on GitHub and copy the address, such as https://github.com/you/friendslop/tree/main/games/my-game.
  3. Paste it into Got a game on GitHub? on the homepage, or the Host a game from GitHub box on play.friendslop.us, and press Host this game.
  4. Send your friends the room link.

For the link to work, the repo has to be public, no file can be over 20 MB, and the commit has to be under 150 MB in all. The files load from jsDelivr, a free public CDN for GitHub repos. If the kit has changed since you forked, the room tells you to update your fork.

The link is pinned to the commit you pasted, so the host and every friend run the same code. Push a fix, then paste the link again to play the new version. The first visit after a push can take half a minute while the files are fetched for the first time.

Try the link path before you push

Start the server with the dev CDN, which serves your checkout's files the way jsDelivr would. In PowerShell:

$env:DEV_CDN = "1"; npm start

On macOS or Linux it's DEV_CDN=1 npm start. Then type a folder such as games/my-game into the link box, or press Try the starter game.

Bots

Add a bot.js and the host gets a Bots panel in the lobby: how many, which team, and easy, normal or hard. A bot gets the same messages as a player's screen and sends the same ones, so your rules need no special cases. The starter's bot.js is the smallest one that works.

A team game can also fill both teams with bots when the match starts, the way the demo does, with autoFill in defineGame.

To join a room from another program or computer, use the bot runner with the room code and password:

npm run bot -- --room ABC123 --password pizza --count 2 --difficulty hard

More on the bots page and in the guide.

Hosting from your PC

npm run play runs the game on a server on your own PC, which only your computer can reach. To let friends on other networks in, run:

npm run tunnel

It prints a public address ending in trycloudflare.com. Send that and the room password to your friends. It needs no account and opens no ports: your PC only connects out to Cloudflare, and friends never see your IP address. The address changes every run and stops when you press Ctrl+C, so it suits a night of playing. To keep a server up for good, see hosting it for everyone in the README.

Who keeps score

For a game shared by link, the host's browser runs the rules and friendslop's server passes the messages along, checking each one. So the host could change the score, and the host controls the lobby bots. The game wears a banner that says so. A game that has to stop a cheating host needs a server you trust, which means running friendslop yourself.

Game code runs in a sandboxed frame that can't read friendslop's storage or pages or make ordinary network requests. The fence is best effort: a game can still show anything on screen, or reach an outside server that sees a player's IP address. Players are warned once per repo before an unreviewed game loads.

What the fence stops and what it doesn't, in the guide.

Going further