GithubHelp home page GithubHelp logo

darkrift2_boilerplate's Introduction

DarkRift2_Boilerplate

This project is meant to give people an idea of how DarkRift 2 works. Feel free for use and change to suit your needs. For Authentication I'm using RSA and BCrypt. For an actual live project, unless you really know what you do, you might want to use token based authorization like f.e. OAuth/OpenID or 3rd party platforms like PlayFab, so you don't have to deal with sensible user data yourself. You can use any Database you like, just write a DbConnector (or use an existing one) and write your own queries into the DataLayer. Examples for MySQL and MongoDB are ready to use.

Type /join (name) or /leave (name) to join/leave a chatgroup and use tab/enter/esc to navigate in the chat window.

Example: https://www.youtube.com/watch?v=IvHqSiPhJiM

Update: Abstracted the database and added MySQL connector

Instructions:

  1. Clone/Download the project.
  2. Open the Unity folder with Unity.
  3. Download Darkrift 2 from the Asset Store.
  4. Extract the "DarkRift Server.zip" that got added with the Assets/DarkRift folder to a location outside of the Unity project.
  5. Inside the "DarkRift Server" folder, create a new folder called "Plugins".
  6. Open and run the Plugins/GenerateRsaKeys solution. This creates PrivateKey.xml and PublicKey.xml.
  7. Copy PrivateKey.xml into DarkRift Server/Plugins and PublicKey.xml into the Assets/Resources folder in the Unity project (might have to create the folder).
  8. In unity, open the "Launcher" scene, select the GameManager object and if one of the scripts is corrupted, replace it with "[YourDarkRiftFolder]\DarkRift\Plugins\Client\UnityClient.cs". You'll have to do this if your DarkRift version is more recent than the one used here.
  9. Open the Plugins/Plugins.sln solution.
  10. Add the DarkRift and DarkRift.Server references from DarkRiftServer/Lib to all projects
  11. Build the solution. Nuget Manager should be able to install the Nuget packages by itself.
  12. Copy Database.dll, Login.dll, Chat.dll, Rooms.dll and the DBConnector of your choice into DarkRiftServer/Plugins and the BCrypt .dll and all .dlls necessary for your database into DarkRiftServer/lib. You can find all of them in the Debug/bin folder of the Chat project and the respective DbConnector project.
  13. Run DarkRift.Server.Console.exe, which creates the xmls and adjust the connection string to yours.
  14. Start your Db, restart the server and either start the Launcher in your Unity scene or a build of it.

Hope this project is helpful. If you have any problems or find any bugs, let me know.

Big thanks to Wichenstaden for his help with the MySQL Connector and to Jamster for his input and ofc the awesome networking solution!

darkrift2_boilerplate's People

Contributors

mwage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

darkrift2_boilerplate's Issues

Errors on Unity 2018.1.4

First, i really appreciated for you sharing these boilerplater. After following the notes, and starting the Dark Rift 2 Pro server, i am getting the following when starting Login scene on Unity 2018.1.4 :

[Exception] NullReferenceException: Object reference not set to an instance of an object
LoginManager.Awake()    Assets/Scripts/Login/LoginManager.cs:28
26:   private void Awake()
27:   {
-->28:       GameControl.Client.MessageReceived += OnDataHandler;
29:   }

And my console being spammed by these error :

[Exception] NullReferenceException: Object reference not set to an instance of an object
Login.Update()    Assets/Scripts/Login/Login.cs:49
47:   private void Update()
48:   {
-->49:       var condition = GameControl.Client.Connected
50:                       && UsernameInput.text.Length >= 2 && PasswordInput.text.Length >= 2
51:                       && Rsa.Key != null;

Is there any change getting the compelete Runling project files (Arts, sounds,etc) ?.

not compatible with unity

when i import it into unity 2017.3 i have errors:

Feature `null propagating operator' cannot be used because it is not part of the C# 4.0 language specification

How do we use "GetUser"?

I am having trouble pulling data from the database using this method. Everything works but I cannot figure out how to return the data from that specific interface.

Going to main menu by itself without proper login

It seems that upon starting the launcher scene, the login scene changing itself into mainmenu without proper login, i have checked everywhere in awake or start function to properly checked it but it's still 'passthrough' itself into mainmenu scene :

            if (LoginManager.IsLoggedIn)
            {
                gameObject.SetActive(false);
            }
            else
            {
                SceneManager.LoadScene("Login");
            }

My console is spammed with the following :

Player not logged in!
FriendManager.OnDataHandler()    Assets/Scripts/Friends/FriendManager.cs:360

DarkRift.Client.Unity.<Client_MessageReceived>c__AnonStorey2.<>m__0()    Assets/DarkRift/Plugins/Client/UnityClient.cs:305

ActionDispatcherTask.Execute()

Dispatcher.ExecuteDispatcherTasks()

UnityClient.Update()    Assets/DarkRift/Plugins/Client/UnityClient.cs:214

Here is the gif showing off the issue :
error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.