Skip to content
Batuhan Fırat

How to build an online multiplayer card game players trust

To build a multiplayer card game that people keep playing, you need more than a good-looking table: a server that deals and judges every move, a real-time connection, written rules and a plan for chips and age limits. This guide walks through each part and shows where a ready-made platform saves you the work.

1- What a multiplayer card game online needs

A single-player card game can live entirely on the player's device. A multiplayer card game online cannot: several people sit at one table, each sees a different hand, and all of them must agree on what happened. That forces a client–server design with these parts:

Each part is ordinary web engineering, but together they are a real project. The rest of this page goes through the parts that are specific to games. If you only want the rules of the games themselves, the okey rules guide and the 101 okey scoring guide cover them in detail.

build a multiplayer card game — architecture
The six parts of an online multiplayer card game and how they connect.

2- Make the server the referee

The most important design rule is that the server is the single source of truth. The client never decides what a player holds or whether a move is legal; it only asks. The server keeps the deck, every hand and the table, and answers each request with the new public state.

This has a direct security benefit. If the full deck or an opponent's hand ever reaches a client, someone will find it in the browser's developer tools. So send each player only their own tiles or cards plus what is face up on the table. CokluOyna follows this rule: its site states that deals are produced on the server and closed cards are never sent to opponents.

Every move is validated on the server against the rules, even if the client already checked it. A modified client can send anything, and the server has to reject it.

build a multiplayer card game — server as referee
The server deals and validates; clients receive only their own hand and the public table.

3- Shuffle fairly: algorithm and randomness

A fair deal needs two things: an unbiased shuffle algorithm and a good random source. The standard algorithm is the Fisher–Yates shuffle: walk the deck from one end, swap each position with a randomly chosen position from the part not yet shuffled, and every ordering becomes equally likely. Home-made shortcuts, such as sorting by a random key, are a common source of bias.

The random numbers should come from a cryptographically secure generator on the server. In PHP, for example, random_int() is documented as producing cryptographically secure, uniformly selected integers. Browsers have a comparable function, but as section 2 explains, the shuffle belongs on the server, not on the client.

build a multiplayer card game — fair shuffle
The four steps of the Fisher–Yates shuffle, run on the server with a secure random source.

4- Real-time play: WebSockets, timers and reconnection

Card games are turn-based, but players expect to see each discard the moment it happens. Polling the server every second works badly at scale. The usual tool is a WebSocket, a long-lived two-way connection between the browser and the server; the MDN documentation for the WebSocket API describes it, and the protocol itself is specified in RFC 6455.

Three details decide whether players trust the table:

Mobile apps usually talk to the same server over the same protocol, which is how browser and app players can sit at one table.

build a multiplayer card game — real-time connection
Moves go up, state comes down; reconnection, turn timer and heartbeat keep the table alive.

5- Write the rules down, then code the rules engine

Traditional games like okey are played with many house rules. Before writing code, write the rules you will enforce in plain language and link the source you followed, for example the okey rules on pagat.com. Then turn every rule into a test case. Two examples from our own guides:

Keep the house rules you allow (for example scoring variants) as settings, not as copies of the code. And show the written rules inside the game, so players can settle an argument without leaving the table. CokluOyna does this: its rules are written down and can be read in each game.

build a multiplayer card game — rules engine
Written rules feed the rules engine, which is checked by test cases taken from the rules.

6- Card game script or build it yourself?

Searching for a card game script usually means you want a running system sooner than a full build allows. Building from scratch gives you full control, but you also write and maintain the server, the apps, the admin and the rules for every game. A ready-made script or platform starts working on day one, but check what you are actually buying:

Answer these against your launch date, the number of games you need and who will maintain the system. The game platforms category lists the platform offered here, and the wider catalogue of ready-made software shows the other products.

build a multiplayer card game — script versus build
What you take on when you build, and what to check when you buy a script.

7- Virtual chips, age limits and the law

Most card and tile games use chips to keep score. Keep them virtual: given free by the game, not for sale and impossible to cash out. As soon as chips can be bought or turned into money, you enter the rules on gambling, which differ by country and usually require a licence. This guide does not cover real-money play; if you plan anything in that direction, ask a lawyer in your market first.

Even with virtual chips, some practical checks apply: show the age limit you choose, read the app store policies before you publish, and provide privacy, terms and account deletion pages. CokluOyna shows these links in its footer and states that its chips are virtual, cannot be bought or cashed out and that the game is for players aged 18 and over.

build a multiplayer card game — virtual chips
Virtual chips stay inside the game; real-money play is a separate legal matter.

8- Okey game for sale: the CokluOyna platform

If you have read this far and would rather not build all of it, CokluOyna is a ready-made multiplayer table and card game platform by Batuhan Fırat, running live at cokluoyna.com and sold as a white-label system. The CokluOyna okey and card game platform page has the full details and the buy buttons.

Who it is for: game portals, community sites and publishers who want okey and other Turkish table games under their own name, and owners of existing sites who want to add game rooms.

What it includes (as shown on the live site):

How it works: pick the licence or the hosted plan → installation on your server, or hosting by Batuhan → add your site or embed code → players sign in on the web or Android → they sit at tables run by the server.

Delivery and prices: one-time licence $2,990 for perpetual use on one installation, with setup and usage documentation, initial setup support and 3 months of free bug fixes; or the hosted plan at $149 a month on Batuhan's server, with updates, maintenance and email support included and cancellation in any month. Payment is taken by Stripe.

build a multiplayer card game — CokluOyna platform
CokluOyna at a glance: games, platform, virtual chips and the two delivery options.

Other guides are listed on the guides page, the figure style comes from the brand kit, and the developer is introduced on the about page.

Skip the build. CokluOyna gives you okey, 101 okey and card game tables with server, apps and admin, on virtual chips only.

Compare the CokluOyna licence and hosted plan

Frequently asked questions

What do I need to build a multiplayer card game?

A game server that shuffles, deals and validates every move, clients for the browser and phones, a real-time connection such as WebSockets, accounts with chip balances, storage, an admin panel and written rules for each game.

Should the shuffle run on the client or the server?

On the server. Use an unbiased algorithm such as the Fisher–Yates shuffle with a cryptographically secure random source, and never send the deck order or other players' hidden cards to a client.

Is a card game script cheaper than building one?

It depends on your scope. A script removes the build work but you should check which games, server, apps and bug fixes are included. CokluOyna costs $2,990 one-time or $149 a month hosted.

Can I use real money in a game built on CokluOyna?

No. CokluOyna works with virtual chips only. They cannot be bought, cannot be cashed out and have no money value. Real-money gaming is a separate legal matter not covered here.

Written by Batuhan Fırat, software developer · Updated 30 November 2026