Developer Documentation
Announcing ODIN Networking
Back to Blog

Announcing ODIN Networking

Written by Phillip Schuster
04 Sep 2022

Today we are releasing what we have been working on for a couple of months now: ODIN Networking. Unity until today lacks a good and easy stack to build multiplayer games and applications. The old Unity Networking has been deprecated years ago and the follow-up solution is still not ready and seems to be quite complicated. So we used Photon or Mirror Networking to build multiplayer examples.

So, we went out to solve that, and we came up with ODIN Networking. This is our first public iteration, and although there is a lot of work to be done, we are quite confident that we can contribute and help developers to more easily build multiplayer applications of any scale.

What is ODIN Networking?

ODIN Networking is built on top of the ODIN Unity SDK and provides easy to use methods to built virtual experiences with ease that allow you to connect users with virtual characters and real-time 3D voice. A 3D virtual conferencing application can be built in no time, as ODIN Networking provides components that automatically synchronize position, animation of all characters over the ODIN servers.

Users can spawn objects in the world and can interact with the provided world in real-time. ODIN Networking also integrates ODIN Audio so your virtual world will automatically integrate audio occlusion (users cannot hear each other if walls are in between) and even direction.

One important aspect: While ODIN Networking is a powerful and easy to use system, it’s mainly targeted for real-world like applications for the metaverse, board games, virtual conferences and conventions. If you want to build a fast competitive first person shooter or real-time physics racing game ODIN Network might not be the best solution. Choose other solutions like Mirror Networking or Photon for that use case. You should still use ODIN for voice support, and we have many guides on how to integrate ODIN into Mirror or Photon.

How does it work?

The ODIN SDK supports sending arbitrary data over the network and this data is automatically synced with all peers connected to the same room. Each user can have its own data (PeerUserData), each room can have its own data (RoomUserData) and each peer can send messages with arbitrary data to all or selected peers.

ODIN Networking packages the current state of a player into the players PeerUserData. It includes the transform (position, location and scale), the animation state and sync vars that allow you to easily mark local variables to be packaged into the state. This updated state is sent multiple times per second (right now every 10th of a second) to other peers that recreate that state in their own world. If a peer is moving, every peer in the network gets an update 10 times a second and updates (tweens) the position locally for that peer.

Every player can also spawn objects into the world. The state of these objects are added to the PeerUserData and are thus updated as well. If a peer spawns an object, all other peers will get an update and spawn the object locally and subsequently update its position as part of the network update cycle.

Of course, players should be part of a living world, so how do you handle objects that are “owned” by the world you might ask? It’s easy. With a deterministic algorithm, all peers in the same room select the same peer to be the host. This is done dynamically, so if the host disconnects a new peer might become host. The host owns the worlds objects and updates the worls state as well as its own state in the RoomUserData. This way, peers entering later will become the same state of the world as every one else, and it’s kept persisted even if the current host disconnects, as every peer in the network has a copy of that world. This way, every peer can instantly become the host.

As it’s decentralized you don’t need to worry about a central server that might go down, and you also don’t need to have all that typical development cycle of sending messages to a server that updates the world and sends the results back as remote procedure calls, which make the whole development process extremely complicated. Now you might understand, why we don’t think ODIN Networking is good for competitive games, as its not easy to build a reliable anti-cheat system into this kind of architecture. We might explore that later, but right now we concentrate on building metaverse applications and all those games that don’t want to be the next eSports hit.

But, ODIN Networking, and the ODIN Unity SDK are open-source. We are happy to merge your contributions!

How do I get started?

All you have to do is to derive your “Player” script (i.e. that script that controls your local player object) from OdinPlayer instead of MonoBehaviour. Distribute at least one OdinNetworkSpawnPosition game object in the scene. Next, join a room, and you are ready to go! Build your application and send it a friend. Once you guys start the application, each user will spawn its own player at one of the spawn positions, and you can see the other players running around, seeing the characters animation, and you can talk to each other in 3D audio - i.e. the voice will come from the direction you see the other player and volume will be adjusted depending on the distance and direction.

How much does it cost?

As ODIN Networking uses the ODIN stack under the hood, the same pricing applies. So no extra costs if you use ODIN Networking!.

Interested?

We released ODIN Networking as a Unity project today. You can download it, fire up Unity and click Play to see it and to examine the source code. In the next couple of weeks we’ll be doing some tests and will then integrate the project into the ODIN Unity SDK.

Download ODIN Networking SDK