Documentation

Cloud Code

Sharing game rules

Let your client reason about game rules without maintaining two copies of your logic.
Read time 1 minuteLast updated 15 days ago

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.
CloudBehaviours keeps your authoritative game rules on the server, but your client often needs to know just enough to give good feedback, such as graying out a move a player can't legally make. Choose one of the following approaches, depending on how complex your rules are.

Topic

Description

Sync-metadata approachThe server works out the answer to a rule and syncs it down as plain data, and the client reacts to it without re-implementing the rule. This approach fits simple, discrete conditions.
Shared rules libraryThe client and cloud assemblies reference a common library, and the build bundles it automatically on deploy. This approach fits rules too complex for the sync-metadata approach.

Additional resources