# Unity - Handling AI & Game System in Match

**URL:** <https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475>\
**Category:** Game Design\
**Tags:** server-framework, sdk-unity\
**Created:** [December 21, 2025, 8:24am UTC](https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475 "2025-12-21T08:24:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoenTNT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/joentnt/32/2708_2.png) [@JoenTNT](https://forum.heroiclabs.com/u/JoenTNT)\
**Post date:** [December 21, 2025, 8:24am UTC](https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475/1 "2025-12-21T08:24:21Z")

</div>

Hi, I’m a bit confuse how to sync AI or Custom Game System in a server-side. I’m talking about the architecture of how does OpCode and Match State works to make sure that non-client-side objects are running logically in Server (For example to prevent Cheating).

Is this must be coded in Runtime Module or can I just code everything in the Game Engine? Can developer only works with the gameplay without touching the server code in this case?

- I’m using Linux - Fedora 43, Nakama Unity SDK version 3.19.0
- Nakama Server running in local using Docker Compose, version Nakama 3.34.1

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 21, 2025, 2:33pm UTC](https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475/2 "2025-12-21T14:33:50Z")

</div>

@JoenTNT The match handler system in Nakama is designed to be completely decoupled from game object lifecycles and Netcode implementation. It’s a low level system for complete control over how game state is represented server-side.

If your goal is to utilize it like Netcode for Game Objects in Unity or the Unreal Netcode you’ll be better off with their builtin system run as headless game instances on a Fleet manager service.

Ultimately it depends on what kind of multiplayer game you’re working on and what your requirements are for game object synchronization, world system replication, and entity interpolation. What kind of multiplayer game are you building?

---

<div class="post-metadata">

**Author:** ![JoenTNT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/joentnt/32/2708_2.png) [@JoenTNT](https://forum.heroiclabs.com/u/JoenTNT)\
**Post date:** [December 21, 2025, 3:09pm UTC](https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475/3 "2025-12-21T15:09:28Z")

</div>

It’s more like a Cooperative Game and can be Competitive in the future where there will be Enemy AI lingering in the game and sync the transform and states for all Client.

I’m doing experiment using Lua Code as API Runtime Modules for testing server logic. I run my own server which I have control in the Console and it’s Runtime Module. I have followed the documentation about Match Handling but I’m not sure if I do it right.

> **[Match handler - Authoritative Multiplayer](https://heroiclabs.com/docs/nakama/concepts/multiplayer/authoritative/#match-handler)**
>
> In addition to relayed multiplayer, Nakama also supports the server-authoritative multiplayer model, giving you the freedom and flexibility to decide which approach is best for your game. | Authoritative multiplayer is suited for gameplay which...

So I created a game\_match and register it in Server-side.

```lua
-- main.lua
local nk = require("nakama")
local gm = require("rpcs.game_match")

nk.register_match(gm, "sample_match");

```

The closes example of game that I’m currently try to make it’s Multiplayer system is [mo.co](http://mo.co) from supercell. The system will have 2-3 room for each mode that will run 24/7.

---

<div class="post-metadata">

**Author:** ![JoenTNT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/joentnt/32/2708_2.png) [@JoenTNT](https://forum.heroiclabs.com/u/JoenTNT)\
**Post date:** [December 23, 2025, 2:03pm UTC](https://forum.heroiclabs.com/t/unity-handling-ai-game-system-in-match/6475/4 "2025-12-23T14:03:15Z")

</div>

Nevermind, I decided to follow the Authoritative Server code template. I guess it’s required to code for server-side to handle network game logic, specifically Matchmaking System.

> **[GitHub - defold/game-xoxo-nakama-server: Nakama server for a Tic Tac Toe game](https://github.com/defold/game-xoxo-nakama-server/)**
>
> Nakama server for a Tic Tac Toe game
