Turn-Based Multiplayer Without a Websocket Server

Leader 1 3 17
calendar_today agoschedule2 min read

Most multiplayer tutorials on here jump straight to websockets, and for a real-time shooter that is the right call. For a turn-based game it is usually more machinery than the problem needs, so here is the plain HTTP version for anyone who has been putting multiplayer off.

The Three Problems A Turn-Based Game Actually Has

Every turn-based multiplayer game needs the same three things: players have to find each other, friends have to be able to play on purpose, and every player has to see every move in the same order. None of those three require a persistent connection. A queue can be polled, a join code is a lookup, and move ordering is what a database does for a living.

The usual reason people reach for websockets is push. In a turn-based game the push is worth very little, because a human is going to take several seconds to decide anyway. A two second poll while it is the opponent's turn feels identical to the player and costs you nothing operationally.

What The Server Should Not Know

The design decision that saves the most work is keeping game rules out of the server. Treat a move as an action with a type and a few opaque data fields, and let your clients decide what the fields mean. Chess notation, a card play, a dice roll, a word submission, a chat line, a surrender flag, they are all the same shape to the server.

Once the server holds no rules, one deployment serves every game you write. You do not stand up new infrastructure for each project, and a rules change never means a server deploy.

A Working Reference

If you want to read a small implementation rather than a diagram, AbraTabia Game Server is one PHP application with a single SQLite file, five HTTPS endpoints, MIT licensed. Queue entries and finished matches expire on their own, and an admin view shows the live queue, active matches, and the full action log for each match.

It runs on shared hosting, a VPS, a container, or a laptop during development, which is the real point: for turn-based games the infrastructure bill for multiplayer can be zero.

Where This Stops Working

Be honest about the boundary. Anything with continuous state, physics, or sub-second reaction time wants a real-time transport and probably an authoritative simulation. The polling model covers turn-based, asynchronous, and most board and card game designs, and it stops being a good idea the moment your game has a frame rate that both players share.

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

Sovereign Intelligence: The Complete 25,000 Word Blueprint (Download)

Pocket Portfolio - Apr 1
chevron_left
1.3k Points21 Badges
United Statest.co/5LlztlB5C5
17Posts
4Comments
8Connections
Our AI Apps are a self expanding AI SaaS ecosystem used to create the custom web application of your... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!