Boring preamble
I have been interested in multiplayer gaming for a long time. I have dabbled a little with Photon (currently diving into that more) but have always wanted to be able to create my own worlds and bring them to life. While most of the projects I have in mind are certainly not on the scale of a traditional MMORPG they are all more than I can do on my own currently. In this series of posts I want to walk you through (and by extension build myself) the steps of creating a game that has:
- Login/Registration
- Smooth movement of other players and game entities
- Basic chat
- Basic interactions – one for each of the big 3 (combat, resource gathering, and crafting)
I have tried (and failed) several times to really get a full, working proof of concept built. It’s a big task. I am using “MMO” in the loosest sense of the word. A world, with state, exists. You can walk around, see other players, and chat. Ideally some form of interaction. The basics.
A problem I keep running into in my own projects is scope creep. It’s easy to say “I am going to make a proof of concept” and then keep adding things in until it becomes an unmaintainable (and unfinishable) mess. This series of posts is designed to educate/teach but also provide an incentive to myself to finally build a project out. With that out of the way, let’s talk tech.
DarkRift 2
Besides Photon the only networking tool I have really used at all is DarkRift 2 – A low(er) level networking library that handles the really low level stuff for you (sending messages, keeping track of connection internally, etc) and makes it “easy” to build out your own authoritative server (as a stand alone or as a Unity project). Beyond the fact that DarkRift 2 can be used to make a variety of game types (from FPS to MMO) it has a few key advantages over other solutions I have looked at:
- It’s free. Yes, there is a pro version which comes with source code and a few other nice extras but nothing that is needed to make any game you want to make.
- It is unlimited CCU – whereas solutions such as Photon have CCU caps, there is no fee associated with DR. The only thing you will be paying (besides your blood, sweat, and tears) for is whatever VM or such you choose to host your server on.
- Easy to use both UDP and TCP approaches with the same codebase (just set a Reliable flag on your message to send it TCP or Unreliable to do the opposite)
- It integrates *extremely* well with Unity – sure, you can have a standalone console server if you want but if you use Unity as your server you get all the built in goodies to work with for whatever you are simulating. Physics, pathfinding, etc is all there and works.
- The community is top notch. No really, check out the Discord – Great people, responsive dev, and just… a gold mine of experience and knowledge on the topic.
One downside to DR is a lack of learning resources (another reason for this series) – if you are interested in seeing what else exists in the world of DR tutorials I would *highly* suggest you check out the Embedded FPS Example project by Luke Stampfli ( lukesta on the discord) , and the official DR 2 tutorial. I plan to have a future post covering networking stuff in general but those are afaik the two best resources out there.
Now that I am done shilling for DR here is the plan…
The Plan
At the time of posting this is my current plan for what this series will cover. Plans may change and features may be added or removed.
First, lets start by going over what this is not going to be. This will not have production ready code. This is not going to have every feature you want to implement. This probably won’t even be coded in the best way.
Account/Login – TBD, leaning towards using a 3rd party provider, but I also want to keep this fairly simple. Account security is a complex topic and in general this is an area where “roll your own” isn’t often suggested.
Movement – I am going to use a click to move system that takes advantage of the Unity NavMesh. Smooth movement is hard enough without taking real-time input like an FPS.
Chat – Real-time chatbox like in every other MMO you have ever played. We will write this ourselves.
Interaction – I think just getting players to move around and talk, while certainly not nothing, doesn’t really qualify as a game. I am going to be taking some inspiration from Old School RuneScape and other click to move games like it for dealing with resources, combat, and crafting.
Out of scope but maybe in the future – A quest system, NPCs, an in-game store, player trading.. the list goes on.
Ok? Great. Lets do this.
In the next part of this series I will cover project setup and connecting to the server.
Hi Julien,
Sorry for the delayed response, I have been distracted with life and have neglected the blog a bit 🙂 I have not used Mirror but I have looked into it and helped people with it. I don’t personally care for the approach it takes but it may fit your use case. SmartFoxServer is something I have heard about on the periphery, I believe the MMO “Tem Tem” uses it. If you have Discord, you should join the DarkRift community, tag me @Ace if you do 🙂
Sorry for the late reply 🙂 Feel free to grab the RSS feed, I don’t know when exactly but I am hoping to write more tutorials soon.