Fenrir is a platform for building server-authoritative real-time multiplayer games with C# and .NET.
This library provides supports for building multiplayer games using Unity on the client-side and .NET and Docker on the server-side.
It is optimized for real-time multiplayer and provides fast reliable UDP layer and a basic serialization engine. It also supports various serialization engines and plug-ins.
Fenrir provides a great balance between performance and ease of development and makes it extremely quick to build multiplayer games of any genre.
Table of Contents:
- Documentation Home
- Installation
- Quick Start
- Networking
- Serialization
- Room Management
- Logging
- Docker Setup
- Thread Safety
- Client and Server Lifecycle
- FAQ
This package can be installed using Unity Package from https://upm.fenrirserver.org
registry.
- In Unity, open Edit → Project Settings → Package Manager and add a Scoped Registry using URL:
https://upm.fenrirserver.org
- Open Window → Package Manager and switch to Packages: My Registries. Select Fenrir Multiplayer and click Install
Fenrir Multiplayer Unity Package comes with a server template that is recommended (but is not strictly required) to use.
To generate a server project, click Window → Fenrir → Open Server Project.
If a project server has never been generated, dialogue window will open asking to generate the package. Select Generate.
Editor script will generate and open a .NET Solution in the folder next to Assets:
📂MyGame
┣ 📂Assets
┣ 📂Packages
┣ 📂Library
┣ 📂ProjectSettings
┣ 📁Server ← Generated Server folder
┣ 📂 MyGame.Server ← Server .NET Project
┣ 📂 MyGame.Shared ← Server and Client Shared Library
┣ 📄 ServerApplication.sln ← Server solution file
┗ 📄 Dockerfile ← Dockerfile that defines how the docker image for your server is built
Once the solution file is open, you can build and run the server.
Fenrir Multiplayer allows you to build server-authoritative multiplayer games with Unity and .NET.
Unlike most networking solutions for Unity, Fenrir allows (and encourages) to separate client and server logic. Data contracts and common code can be shared between client and server.
Example Server:
Note: Server template that comes with Unity Package includes basic hello world example for the server, which is also provided here.
using var networkServer = new NetworkServer() { BindPort = 27016 };
networkServer.Start();
Example Client:
using var networkClient = new NetworkClient();
var connectionResponse = await networkClient.Connect("http://localhost:27016");
if(connectionResponse.Success)
Debug.Log("Connected!");
else
Debug.Log("Failed to connect:" + connectionResponse.Reason);
Please check out TicTacToe repository for more examples!
For problems with this library, please open a GitHub issue or a pull-request.
For issues with Fenrir Cloud, please contact customer support or your account manager.
Fenrir.Multiplayer is an open source software, licensed under the terms of MIT license. See LICENSE.txt for details.