Back to Spring 2026 Slide 1 / 11

What If You Didn't Have to Fight Alone?

You've been blasting enemies, defeating bosses, and climbing the leaderboard. But what if your friends could join the battle — from their own computers?

Today we're building multiplayer into the Vertical Shooter.

Multiplayer Modes

Types of Multiplayer

Split Screen

Same screen, same room — like Minecraft on a couch

Online Co-op

Play together over the internet — THIS is what we're building!

MMO

Thousands of players in one world — like Fortnite or Roblox

Local Co-op

Same device, different controllers — party games!

Remember Week 1? Browsers talk to servers!

Networking

How Do Computers Talk?

In Week 1 we learned browsers send requests to servers. For multiplayer, we need computers to talk directly to each other — no middleman!

1 A small server helps players FIND each other
2 Players exchange "phone numbers" (addresses)
3 Direct connection! Super fast, no server needed
WebRTC

WebRTC — The Secret Weapon

The same tech that powers Google Meet and Discord calls

WebRTC lets browsers connect directly to each other — no app needed! Google, Microsoft, and Apple all built it into their browsers.

1 "Hey, I want to connect!" (Offer)
2 "Sure, here's my info!" (Answer)
3 Connected! Data flows directly between you
Room System

Join with a Room Code

AXKF

One player creates a room and gets a 4-letter code. Friends type the code to join — just like Among Us!

Up to 8 players can join one room!

P1
P2
P3
P4
P5
P6
Architecture

The Host is the Referee

One player (the host) runs the REAL game. Everyone else sends their button presses to the host, and the host tells everyone what's happening.

Star topology — everyone connects to one center point.

This prevents cheating! The host decides what's real.

Game Balance

More Players = More Challenge

If we don't add more enemies, 8 players would breeze through the game! So the game scales up with more players.

1P
2P
4P
8P

Enemy Count

+50% per player

Enemy HP

+25% per player

Boss HP

+40% per player

4+ Players

DUAL BOSS!

Real Talk

What We Had to Debug

Multiplayer looks simple — until you realize how much state needs to sync!

Connection — Who creates the channel? (The offerer!)
Game Start — Wait for channels to open before sending!
Enemies — Guest had zero enemies (skipped simulation!)
Weapons — Powerups changed weapons only on host screen
Shields — Shield stuck at (0,0) on guest (position never synced)
Bosses — Appeared then vanished on guest (timer desync)
Powerup drops — Only host saw items fall from enemies
Bullets — P1 bullets invisible on P2’s screen
Wingmen — Never fired on other players’ screens
Enemy Jitter — Sprites jumped when one died (index shift!)
Flex Glasses — Only showed on the wearer’s own screen
Powerup Pickup — Collecting one removed ALL on guest
Boss HP Bar — Health bar stayed on screen after boss died
3+ Players — Player count was hardcoded to 2!
DEMO TIME

Let's see multiplayer in action!

Today's Mission Plan

15 min Slides — Learn how multiplayer works under the hood
15 min Live Demo — Watch two browsers connect and play together
10 min Connect — Everyone joins the same room
50 min Co-op Play — Play together, find bugs, test everything!
15 min Boss Battle — Full team vs the final boss!
15 min Wrap Up — What worked? What would you change next?

What Would YOU Add Next?

Now that we have multiplayer, the possibilities are endless. What feature would YOU add to make the game even better?

In-game chat
Team shields
PvP mode
Team leaderboard
Shared powerups
Custom ship colors

Your Mission

Think of a multiplayer feature that would be fun and possible. We might build it next week!