Making Multiplayer Game Without UNET

I want to make a multiplayer game. In my game I am planning 4 or 5 players per game. Iwant to do it without UNET, Firebase or Photon. How can I do that? Can you recommend sth. for me? What is the right database to use for me? MySQL? Or any source for UNET ?

You can just use C# sockets to connect to the other players - but you will need some way of telling each of the players where the other ones are, which usually involves some sort of matchmaking server. That could be done with a website. The database you choose doesn’t really matter, and most 4/5 player games don’t need one at all.

2 Likes

In this case you can create your own C# server. As Kylotan mentioned it involves using sockets. If it’s only 4/5 players per game then a JSON serialization might be suitable for data transfer, if you are looking for more performance you can have a look at flatbuffers, they have built-in RPC serialization.

https://google.github.io/flatbuffers/

If you’re going for a C# server then a very viable option is .Net standard 2.0. This lets you create a shared library for protocol / DTOs, and also enables you to use .Net Core serverside which works well on Linux (and as far as I know it performs better than Mono).
You can of course also run Unity as a headless server. In that case you would probably want to export condensed versions of your scenes with everything that isn’t relevant to game logic removed/disabled.

I took the route of writing my own network solution on top of the socket class, and run the server as a linux headless Unity build. As far as database, MySQL is probably the go to standard, and you should consider it unless you have a reason not to use it.

For me as far as database I created a special Unity server scene that acts as a front end for the database, so none of my other servers have to deal with it. This will allow me to not use a database server at all and just load from flat files, switch to different database solutions, etc, without it affecting anything else beyond the database front end server. This makes for a lot less retesting when things change regarding how I access the database.

YMMV

2 Likes