How to Load a Game using Netcode in Unity DOTS

This will take you about 20 minutes in prep time if you don't have Unity set-up, and 30 minutes in coding and debug time.

Click Here for DOTS Tutorial

Stop struggling with the limited documentation. Follow this step-by-step tutorial: "How to Load a Game using Netcode in Unity DOTS."

Full workflows and code to send server game data to client with client confirmation using Netcode

Click Here for DOTS Tutorial

This gitbook takes you through step-by-step full workflows and code to send server game data to client with client confirmation using Netcode. Once you've coded along and fully finished the "How To Load a Game using Netcode" tutorial, you will be able to send server game data to client with client confirmation using Netcode.

Click Here for DOTS Tutorial

High-Level steps to Load a Game using Netcode:

Number 01

Create two RPCs and two systems for the Client and the Server

Number 02

Use NetworkStreamInGame to begin sending game data

Number 03

Send an RPC from server to newly connected client

FAQ

What is Netcode in Unity DOTS?

Unity's DOTS NetCode is a dedicated server with client prediction networking model. Overview of Unity's decision to move to this type of network architecture, "Navigating Unity's multiplayer Netcode transition": https://blogs.unity3d.com/2019/06/13/navigating-unitys-multiplayer-netcode-transition/

What is the Server World and the Client World in Unity DOTS?

NetCode has a separation of client and server logic, and both the client and server logic are in separate Worlds (the client World, and the server World), based on the hierarchical update system of Unity’s Entity Component System (ECS). In Unity's authoritative server client-predicted network architecture, the server is the authoritative source of the game. So if the client "predicts" a response to an input and the server disagrees, the server wins.

What are Ghost entities in Unity DOTS?

"Ghost" is the Unity term for entities whose state the server sends to the client (a networked object). The server keeps track of all Ghosts and then sends "snapshots" of their Component's "Ghost Fields". In Moetsi's sample project, Players, asteroid entities, and bullet entities will all be ghosts. Their state will be sent by the server to the clients by what unity calls "snapshots". Once the clients receive the snapshots the asteroids entities will have their state updated.

Haven’t begun learning Unity DOTS yet, and need to start at the very beginning?

If you haven't yet dipped your toes into learning Unity's new multithreaded Data-Oriented Technology Stack (DOTS), now is the time. You can start at the very beginning with Moetsi’s tutorial, which culminates in your very own deployable sample project. You’ll be guided by full workflows, code-alongs, videos, and GIFs along the way.

Get Started