Building a game for for multiplayer online use can be a challenge. A couple of months ago I started using Nakama, and it is a brilliant system for mp gaming and chats, etc. Its very well thought out and provides a very large array of features.
I want to be extremely clear about my use-case, Nakama wasnt really the right “fit” for the game I was making, and I really only found out that while building the game and using Nakama. The type of game I am building is a group discussion game where the webapp allows people to control the game flow and outcomes. In this manner I wanted a system that was extremely simple to join and create a game without all the login/handshaking/user management that alot of server systems have - Nakama has this. These systems are very important for things like realtime fps or high frequency controlled data sharing - but it isnt really suitable for the game I was making.
To explain, what I was looking for were the key following features:
- No login or signup process - the app handles the device login, and handshakes for the auth.
- Can easily generate a game from a name - the internal systems allow direct name lookup for the game.
- Players can drop/in out of game lobby easily (backend handles all of it)
- Modular game executions on backend (Ideally a luajit vm running it)
- Admin panels and control to monitor and modify modules, games, and user profiles.
- Wanted it to be properly open source(MIT)
- A nice Defold client API.
Its not an exhaustive list, but some of these things proved difficult to do in Nakama without spending alot of time building an RPC system to create the results I needed.
Additionally I wanted a simple SQLite based backend DB that allows me to snapshot state of the server if needed. I had built a number of luajit + Sqlite systems before so it seemed like a reasonable choice for the system type.
SWAMPY was born. Dont ask about the name, it was a tag I used and now its stuck
The aim of SWAMPY is to meet the above features using a luajit based environment entirely written in lua. Yes, this is going to get a bit weird from here on in. The entire server is written in lua using a great toolkit and framework I have used in the past called luvit (www.luvit.io). It should run on pretty much any platform - technically you could run a server on your phone, which would be a bit odd.
The only real dependency is the libsqlite library used. I may compile that into the exe at some stage if I get the urge to. The whole thing, website + admin + luvit + luascripts = 17MB. Yes. 17MB. And this is a debug build, so expect the release to be < 8MB. This is another reason why I am a big fan of luajit based systems - cross platform, extremely tiny, and extremely fast with low resource overheads ( Mem use < 48MB with debug ).
SWAMPY is in its early stages of alpha testing. Most of the features are good to use and I am building my game to use them and trial it. Once I have deemed it stable enough to use, I’ll put it up on github for people to do whatever they want with it (along with the Defold Client).
SWAMPY still needs many things done to be properly user friendly too (especially on the admin side):
- A decent UI theme. I need to spend some time on this and make it look nice.
- Remove the placeholder data and put the proper data in (I have it, but not a priority atm).
- Add a couple of nice admin login features - Google, Insta and FB auth as well 2FA would be good.
- Data editing for the Sqlite db - this is high on my list of todos. It will probably be done sooner than later.
- Many module and user related features…
I made this dev diary so that I can update here, and give some general idea about what I have been building to be used in this forum article at a later date: Peer 2 Peer Networking and State Buffers
(No I hadnt forgotten - life has gotten in the way).
My aim is to have this and the forum post all sorted over the next month (eta end of August) all things going well. I hope to have SWAMPY ready for consumption in the next two weeks along with my game Soul Survivor … that may be a little optimistic, but it should be doable.
For the time being, here are some screenshots of SWAMPY in the web admin, and a couple of screenshots from Soul Survivor. Thanks for reading this far!
SWAMPY Dash - ignore the stats, they are just placeholders
SWAMPY Profiles - users connected that are joining a module (game type).
SWAMPY Games - list of running games
Screenshots of Soul Survivor (wip)
Oh. Another interesting note. Soul Survivor is entirely written in Defold + imgui. There are no Defold ui elements used in this system. And its quite ui intensive - the game elements. I might write a whole dev diary on Soul Survivor and imgui - thats been a pretty interesting process, and its alot more powerful than I thought it would be.