DarkRift 2 Tutorial for Unity 3D – Part 2 – Get DarkRift2

Reminder : You can find all the DarkRift2 related articles here 
You can find the entire project on my official GitHub

Create an empty scene and download the asset

So, let’s start with a step by step to create the environnement that will be used for the whole entire tutorial.

For this tutorial, i’m using the 2018.3.1f1 version of Unity.

  • Open Unity, and create a new empty project, Go to the asset store, and look for DarkRift2 :

As explainded into my first article , the PRO version is not free, so we’ll use the free version of DR2, wich perfectly fits our needs in this context.

  • Get it, Import it and in the “Import Unity Package” windows, let all checkbox checked :

You can now see in the Asset folder a lot of you content. Let’s describe them just below :

  • DarkRift : Contains a .ZIP wich embbed the .DLL to develop a console server outside Unity. In our case, it will be useless because we’ll make an Unity Embedded Server.
  • 1 ChatDemo, 2 DragDemo, 3BlockDemo : These folders are examples provided by DarkRift. Feel free to open them and take a look. They are very basics, but very instructives too !
  • DarkRift / DarkRift / Plugins : this folder contains all unity components that we need to create our server / client.

DarkRift2 Unity Components

Server side

XmlUnityServer

  • This is THE component that, attached to a GameObject, will act as a server. When attached and game launched, the server will be automatically created and will listen for each connections, messages, … and so on.
Note : UnityServer component is deprecated, don't use it

UnityConsoleWriter

  • This component is used to create message visible through the console on unity and enable us to debug more easely.

UnityServerHelper

  • Static classes/methods wich are helpers and used by DarkRift2. You can use them too.

Client side

UnityClient

  • As you can see, there is only one unity component for the client : UnityClient. Attacehd to a GameObject, this component will allow you to communicate with a DarkRift2 server.

As the server, the client is automatically created and connects to the server (with a specific [IP:PORT], by default it’s the lookup adress wich is : 127.0.0.1 and port 4296)

What’s next article about ?

The overview of the content of the DR2 asset is finished. The scene to be worked. The next steps are

  • create the scene that will embbed the server
  • Test the server
  • Get output to the console
  • Build our server in both normal & headless mode (Whitout graphics)

Stay connected !

Posted in Dark Rift 2 and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *