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:
- Clients: the browser page and the mobile apps that draw the table and send the player's moves.
- Game server: owns the tables and seats, shuffles, deals, checks moves and runs the turn timers.
- Accounts: sign-in, profiles and chip balances.
- Storage: results, balances and logs you can check later.
- Admin: tools to see players and tables and act when something goes wrong.
- Website or embed: the lobby where players arrive, often on more than one site.
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.
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.
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.
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:
- Reconnection: phones drop connections all the time. A player who comes back should get the same seat and the full current state.
- Turn timers on the server: if the timer lives on the client, a player can stop it. When time runs out, the server makes a defined automatic move.
- Heartbeats: detect dead connections and free or hold seats by a clear, written rule.
Mobile apps usually talk to the same server over the same protocol, which is how browser and app players can sit at one table.
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:
- In ordinary okey, 12-13-1 is a valid run. In 101 okey it is not, because the 1 can only be the low end.
- In 101 okey, an opening of 7-8-9, 11-11-11, 4-5-6 and 11-12-13 is worth 108 and therefore valid.
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.
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:
- Which games are included, and are their rules documented?
- Is the game server included, or only the front end?
- Is there a mobile app, and does it share tables with the browser?
- Is it a one-time licence you install yourself, or a hosted monthly plan?
- Who fixes bugs, and for how long?
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.
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.
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):
- Tile games: okey, 101 okey, partner 101 okey, 51 and konken. Card games: batak, partner batak, pişti, tombala and yanık. Board games: tavla, dama, mangala and chess. All games run on virtual chips.
- Browser and Android app on the same tables with one account; sign-in with a WhatsApp number. The site says an iPhone version is in App Store review.
- Virtual chips only: 10,000 to start, a free bonus every 8 hours when the balance is low, no purchase and no cash-out; for players aged 18 and over. No real-money gambling.
- Server-side dealing and results; closed cards and tiles are never sent to opponents.
- Written rules readable inside each game.
- Embed tool: choose games and appearance, preview, copy a script or iframe code; the game window opens only on domains registered as resellers, and daily openings and sign-ins are counted per reseller code without sharing who the players are.
- Game server and admin infrastructure.
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.
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.
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