4 libraries/frameworks I am using in my online RPG (with links and videos)

Published August 27, 2022
Advertisement

I often get asked about details of my project. Usually, it's about the networking, since it's so vital for a good experience.

But there are so many aspects to consider, that maybe a list of solutions I am using could make you look into libraries or assets you might not know otherwise. So in this post, I am going to name a few of the solutions I use to manage different aspects of the game.

Before going into details, I am using Unity for this project. It's an excellent engine that has all the capabilities I need to deliver the game. And with a very large community of game developers around it, it's easy to find support. That said, here are some of the assets and libraries I use in this project.

Animations

Early on, I was using Animation Controllers to create the states and flows between animations. But while it works, and it gives enough control, I felt the need to control the animations via code more easily. An old habit, perhaps, to programatically manage things, instead of configuring an animation controller and just set variables. I needed a way to have separate animations for the upper part of the body and the legs, do transitions for each of these and so on. I might be running while doing an axe swing, or jump and do an instant cast. So I looked around, and found Animancer. Animancer seemed to be exactly what I was looking for, and so I gave it a go. Since then, I have not looked back. All the animations for the characters are orchestrated by a class responsible for figuring out what the character should be doing from an animation stand point, and updates the animations as needed using Animancer.

Animancer: https://assetstore.unity.com/packages/tools/animation/animancer-pro-116514​

A video with animations and mixing animations:

Networking

There are a lot of solutions out there, and Photon appears to be popular. However, I wanted to keep my project lean when it comes to costs and fees. While using Photon would relief me from a lot of the technicalities around networking and let me focus on the game itself, on the long run it would be added costs and I wouldn't learn nearly as much as having to understand all the complexities around the networking, what I would need to solve to have a smooth game experience. Of course, it comes with risk. Not being a professional network developer, it could happen my solution wouldn't be good enough. But still, for the sake of educating myself, I went with a low level solution: LiteNetLib. It's focused on dealing with the transport aspect, and leaves out managing state, movement, area of interest management and more. It is a library with excellent performant and is packed with a lot of features. Here is a benchmark with just 3 libraries, LiteNetLib included: https://github.com/JohannesDeml/NetworkBenchmarkDotNet#benchmark-results​

Fortunately, I had experience with networking from the past, and so I had a ton of fun using LiteNetLib, and also learned a lot along the way, mostly on techniques to manage a larger amount of players.

LietNetLib: https://github.com/RevenantX/LiteNetLib​

A video about networking in the project, but not specifically about LiteNetLib's usage in the project:

Scripting (for quests and addons)

I wanted quests to be dynamic and flexible, as well as scripted boss encounters. Interactions with NPCs shouldn't be limited to dialogues or accepting / delivering quests. I could have looked at AI behaviour assets, or created interfaces to manage this, but it felt that it would take longer, and be more complex and perhaps less flexible, than just providing a scripting language. As a bonus, the same implementation could be used for addons, but with a different set of commands. Lua is a very popular scripting language, and I had used it in C++ projects, but not in C#. A quick search revealed MoonSharp, an implementation of Lua made purely in C#. Perfect. I added the files, and started playing with it, and the results were nearly instant. I just needed to add now enough commands to support scripted NPCs (for quests and encounters) and addons.

Here's a couple of videos I did where I show how I am using MoonSharp:

MoonSharp: https://www.moonsharp.org

Launcher

Given the type of project, and the need to continuously update the client, I needed a way to allow the players to easily update the game, even automatically. If I use Steam as a distribution platform, it would be taken care of, but selling through Steam comes with a 30% cut, which is a huge hit in the revenue. Of course, Steam has millions of players registered and using the platform, and so it has the potential to create a lot of attention and generate revenue that otherwise might not hapen. There is also Xsolla, which looked like a decent solution, with its' own fees, but I opted to create one myself, using Electron. Electron works in a very simple way: you write an app, a web page, and when you run it, it opens Chromium with that page. When you build an Electron app for distribution, the resulting application is a bundle of Chromium with your page inside. Electron also has ways to self-update, so updating the launcher itself can leverage those mechanisms. Discord and Slack are built with Electron! :-) As for the game files, they are hosted on Amazon S3 for now.

Electron: https://www.electronjs.org

And here is a video of the launcher in action:

Wrapping up

I hope that was useful, it anything to learn about different libraries, frameworks or assets. If you want to know what other technologies I use, drop me a comment!

Cheers

1 likes 1 comments

Comments

Asghard

Good stuff!!

How is going your project?

August 28, 2022 05:16 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement