---
title: Turn-based game workflow
product: Cloud Code
version: 3.0.0
latest_version: 3.0.0
status: This page documents version 3.0.0. The latest version is 3.0.0.
canonical: https://docs.unity.com/en-us/cloud-code/3.0.0/cloudbehaviours/turn-based-game-workflow
latest_url: https://docs.unity.com/en-us/cloud-code/3.0.0/cloudbehaviours/turn-based-game-workflow.md
last_updated: 2026-10-23
generated_at: 2026-11-04T18:04:14.978Z
locale: en-us
---

# Turn-based game workflow

> Follow this workflow to create a turn-based multiplayer game with CloudBehaviours.

> **Important:**
>
> This page describes an experimental feature that might change significantly before release. It's not recommended to use or rely on experimental features in production environments due to potential instability.

A `MultiplayerSession`-scoped CloudBehaviour suits a turn-based game. One instance holds the shared match state, and every player in the session receives its updates. Start from a `MultiplayerSession`-scoped CloudBehaviour, then add turn notifications, a turn clock, and hidden information.

To create a turn-based game with CloudBehaviours, complete the following tasks:

* [Notify players when a turn changes](#notify-players-when-a-turn-changes)
* [Time out an unresponsive player](#time-out-an-unresponsive-player)
* [Show each player only their own hidden information](#show-each-player-only-their-own-hidden-information)

## Prerequisites

Before you start, complete [Get started with CloudBehaviours](./get-started.md) with a `MultiplayerSession`-scoped CloudBehaviour.

## Notify players when a turn changes

Declare a public event on your cloud class, and invoke the event when a turn ends. Each time the event fires, every client in the session receives a message, so each player's game reacts as soon as a turn changes, without polling. For how to declare a push channel and listen for it in your game, refer to [Push channels in CloudBehaviours](./push-channels.md).

## Time out an unresponsive player

Schedule a server-authoritative timer when a turn starts, so a player who closes the game can't hold up the match. Mark the endpoint that the timer calls with `[CloudCodeAccess(Access.Service)]`, so no player can call the endpoint directly. The timer can still call it. For how to schedule and cancel the timer, refer to [Timers in CloudBehaviours](./timers.md). For how to restrict the endpoint, refer to [Access control in CloudBehaviours](./access-control.md).

> **Note:**
>
> A timer callback runs with no player identity. If your timeout logic needs to know which player it's timing out, pass the player ID as an argument to the scheduled endpoint, rather than reading the player ID from the calling context.

## Show each player only their own hidden information

For a game with hidden information, such as a card game, define a per-player view of the state that each player can access. Cloud Code builds each player's view and keeps it up to date automatically. For how to define the view, refer to [Per-player state views in CloudBehaviours](./per-player-state-views.md).

## Additional resources

* [Get started with CloudBehaviours](./get-started.md)
* [Game organization in CloudBehaviours](./organize-your-game-into-behaviours.md)
* [RPCs in CloudBehaviours](./rpcs.md)
* [Synchronized state in CloudBehaviours](./synchronized-state.md)
