Unreal Editor 4 client for Nakama server.
Nakama is an open-source distributed server for social and realtime games. For more information have a look at the server documentation.
The client guide is available on the server documentation. The client reference documentation is deployed on gh-pages.
If you encounter any issues with the server you can generate diagnostics for us with nakama doctor
. Send these to [email protected] or open an issue. If you experience any issues with the client, it can be useful to enable trace (.Trace(true)
) to produce logs and open an issue.
To get started using Nakama in Unreal, you will need the following:
- Unreal Engine 4.15 or greater.
- A compiler for the platform you are developing on, such as Visual Studio on Windows or XCode on OSX.
- nakama-unreal
Also, please ensure your Unreal project is a C++ project. If it is Blueprint only, you can add a new C++ file to your project in Unreal Editor via "File -> New C++ Class". Set it private and name it whatever you like. Having this file in your project lets Unreal know to look for C++ code.
To use nakama-unreal in your Unreal project, you'll need to copy the nakama-unreal files you downloaded into the appropriate place. To do this:
- Open your Unreal project folder (for example, D:\MyUnrealProject\) in Explorer or Finder.
- If one does not already exist, create a Plugins folder here.
- Copy the Nakama folder from the nakama-unreal release you downloaded, into this Plugins folder.
- Now, edit your project's .Build.cs file, located in the project folder under Source\[ProjectFolder] (for example, D:\MyUnrealProject\Source\MyUnrealProject\MyUnrealProject.Build.cs). Add this line to the constructor:
PrivateDependencyModuleNames.AddRange(new string[] { "Nakama" });
So, you might end up with the file that looks something like this:
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class MyUnrealProject : ModuleRules
{
public MyUnrealProject(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PrivateDependencyModuleNames.AddRange(new string[] { "Nakama" });
}
}
At this point, you are done. Restart Unreal. After it compiles things, open Edit->Plugins and scroll to the bottom. If all went well, you should see HeroicLabs.Nakama listed as a plugin.
To create a client and connect to the Nakama server with the default settings:
#include "NClient.h"
NClient client = NClient::Default("defaultkey");