Kkochi Pocha is a real-time party game we built for phones. Two to eight friends join a room with one code, everyone gets the same order sheet, and the first person to skewer the ingredients in the right order wins the round. You play by swiping ingredients from four bowls toward a skewer, holding the grill to cook a piece, and rubbing left and right to add sauce.
A race like this has two requirements that pull against each other. Every swipe has to feel instant, because a quarter-second delay is the difference between first and second place. The result also has to be trustworthy, because the whole point is beating your friends. If each phone decided its own score, the fastest player would simply be whoever edited their client.
We settled on one rule early and kept it: the server decides judgments, rankings, and scores. The screen shows the result first and then lines up with the server's answer.
Quick takeaways
- The client applies every action immediately and sends it to the server with a sequence number.
- The server is the only place where a serve is judged, ranked, and scored.
- When the server acknowledges an action, the client only corrects itself once nothing else is in flight.
- Round rules travel with the round, so both sides compute the same twists from the same code.
What the phone does on its own
When you swipe an ingredient onto the skewer, the phone does not wait. It runs the same rule functions the server uses, updates the skewer you see, plays the sound, and only then sends the action over the WebSocket. Each action carries an increasing sequence number, and the client keeps a small set of sequence numbers that the server has not confirmed yet.
This keeps the feel local. On a slow mobile connection the network round trip can be several hundred milliseconds, and nobody wants to watch a piece of chicken hang in the air for that long.
What only the server decides
The server receives the same actions and applies them to its own copy of each player's skewer. When a player pushes the skewer up to serve, the server is the one that compares it with the order, assigns first, second, or third place by serving order, and gives out points.
A few rules only make sense when one authority owns them:
- In the default mode, a wrong skewer is not revealed while you build it. You find out at the end of the round, after the server has judged the serve.
- A round ends eight seconds after the first serve or when everyone has served. One clock has to decide that moment for all players.
- Leaderboards rank players by average serving time per round, and a rejected or timed-out round counts as thirty seconds. Those numbers come from server timestamps only.
Practice mode is the exception that proves the rule. While you wait for friends, you can practice against a clearly labeled practice opponent. Those rounds never reach the server or the leaderboard, so the phone is allowed to run them entirely on its own.
Reconciling without flicker
The tricky part is what happens when the server's answer arrives. A naive client would replace its state with every acknowledgment. If you swiped three pieces quickly, the acknowledgment for the first piece would arrive while the second and third were still in flight, and the skewer on screen would briefly jump backward.
Our client handles an acknowledgment in two steps. First it removes that sequence number from the pending set. Then, only if the pending set is empty, it compares the server's version of your skewer with its own. If they match, nothing happens. If they differ, the server's version wins and the screen redraws.
In practice they almost always match, because both sides run the same rule code from a shared module. The correction path exists for the rare cases where they do not, such as a dropped message or an action that arrived after the round closed.
Shipping the rules with the round
Later rounds add twists. Bowls can reshuffle after every piece, the order sheet can fold away after a few seconds, and in harder modes a fickle customer changes one ingredient partway through. If the client had to ask the server about each twist, every one of them would cost a round trip.
Instead, the server sends the full rule set for a round when the round starts. The client applies the twists the moment they trigger, and the server judges the serve with exactly the same rules. When we change a rule, we change the shared rule module and its tests together, so the two sides cannot drift apart without a failing test.
What we would tell another small team
You do not need a heavy netcode framework to get this right for a casual game. The pattern that worked for us is small:
- Put rules in a module both client and server import.
- Apply actions locally and tag them with a sequence number.
- Let the server own every outcome that affects scores or rankings.
- Correct the client only when nothing is pending.
That combination gave us a game that feels like it runs on your phone and still produces a leaderboard friends are willing to argue about.