I’m considering a project where I think we would want to write a custom server. It would run persistently and do all the data storage & crunching, and clients (written in Unity) would connect to it over TCP/IP as players play.
Any suggestions on where I could host such a server? I’d prefer a Linux host (or OS X, if such things exist), but could do Windows if necessary. And I’d rather not spend more time playing sysadmin (especially with regard to security) than absolutely necessary. AWS? Rackspace? Somewhere else?
A possible alternative would be to restructure the server as a REST app (though man, that sounds painful). In that case I’d probably host it at SmartASP.NET for $3/month… but do more experienced folks have a better suggestion?
Note that I don’t think I can use Unity Multiplayer because the server isn’t just a matchmaking service or relay. I need the game to continue to exist and persist data when no clients are connected. But I’m really new to multiplayer development in Unity, so if I’m missing some obvious solution, please educate me!
If you’re just writing a Linux server any VPS will work, and headless Unity servers are probably able to do what you need.
AWS would be good for starters, as they have a free level that should be good for internal testing. When running any sort of VPS where you have control of the installed software, you just need to ensure you don’t run anything you don’t need. So that means you just run a minimal Linux installation with SSH and your game server to keep admin work to an absolute minimum.
The world server (your Unity-based server, presumably) could be spun off in another EC2 instance if you need to. I’m not entirely sure how Amazon’s server stuff works, so there’s a bit of research required there. You generally need fewer server resources than you think, and more bandwidth/traffic than expected
I’ve made a little matchmaker I mess around with, written in Go. It uses mere megabytes of memory, no real CPU and can be compiled for damn near anything now (from Raspberry Pi to fancy IBM systems). You may be happy with just a web script, but I think (near-)native apps will be most efficient, particularly compared to PHP.
If you can share some more details on your ideal server-client setup, and what the server(s) will be doing, perhaps some better advice will appear here
Well, any Linux VPS with Mono installed. That is, among all the ones I looked into a little while ago, exactly zero of them.
But yeah, I guess I can install mono myself if it’s a private server. But so far, any setup that allows me to do that, also makes me responsible for all the sysadmin tasks — in particular, keeping the machine secure, which is difficult and time-consuming. I’d much prefer a host that does that for me, but somehow also provides .NET support.
That sounds like good advice.
Ideally I’d contract with a host provider who manages everything on the machine except where I put my files and launch my server, which takes the form of a compiled C# command-line program (like this). This thing would have some sort of database or files for keeping the game state across restarts, but most of the time it would just have all its data in memory, as it’s running all the time. Clients (written in Unity) connect to it and exchange messages over TCP.
I don’t think linux is a good choice given the information you posted. FYI it’s not nearly as difficult to maintain as you describe, but you don’t know it, and I’m assuming you do know windows. That in itself for a simple 1 or 2 server setup is a good enough reason to stick with windows.
The red flag I see is you don’t want to learn linux. You have been fed some bad information on the time/resources/knowledge it takes to keep linux secure. But I think it’s insane to choose an OS you don’t know and don’t want to learn over one you do to at least some degree, if both will work well for the task at hand.
That’s my suggestion based on considerable domain experience here.
I don’t think it’s bad information - the less you run, the safer you are, and a VPS is a little less responsibility than maintaining a whole server. I’m not saying there is zero admin work, but keeping a VPS that you can reset in a control panel WHEN you screw up is far easier than managing real hardware. But you must be willing to at least learn some basics if you don’t want a fully managed server, of course. Fail2ban is your friend too
If you want to run Mono on Linux the packages are just an apt-get away on Ubuntu, for instance, but if the real port of .NET is further along that might be better. This involves compiling it yourself, and I’m not sure that they have all support assemblies you’d want for ease of programming. You might as well write it in Unity!
If you want maximum .NET compatibility the option is to rent a Windows server. It looks like Asp.NET even builds on FreeBSD now, but I don’t know about the level of compatibility for all components.
Anyway, whichever OS you decide on for the server, you might be looking for a managed VPS or managed server, depending on scale. Something along the lines of just dropping in a Docker container, or a single piece of software that it keeps running. I’m not sure what options there are of that sort out there though.
No, no, you’ve got it backwards. I do know Linux; I don’t (much) know Windows, and would much prefer to stay away from Windows if possible — though I’m willing to hold my nose and use it if it really is the best solution.
I currently have half a dozen Linux servers for work-related projects, but most of them are shared servers where the hosting company completely runs them for me, and I just have to install my PHP scripts and configure my MySQL databases etc. But it’s not possible to run mono code on any of these.
[QUOTE[You have been fed some bad information on the time/resources/knowledge it takes to keep linux secure.[/QUOTE]
No I haven’t; my information on time/resources/knowledge to keep a linux (or BSD Unix) box on the internet secure comes from experience over the course of the last 20 years. My information on keeping a Windows box secure is second-hand, as I’ve never tried that… but it’s pretty notorious, isn’t it?
Agreed, if both will work, I’ll certainly choose Linux. But my question remains: where to host that? Is there any host that has a standard config for running mono code, and does a good job of handling most of the sysadmin for me?
Is it possible to run a Unity app in a headless environment on a server somewhere? That seems a bit heavy-handed, but it would ensure maximum compatibility with the client code…
At any rate, I don’t need maximum or most modern .NET compatibility; I mainly use C# with Unity, which as we all know is running an old version of mono, so I’m used to that.
Sounds like a Linux VPS with apt-get mono might be the way to go.
Sure - headless export is one of the options for Linux Unity binaries. No rendering, idles at (next to) no CPU usage. I’m not sure how well it scales as a plain TCP server though, so that’s something you’d have to test. I don’t expect it to be much different than plain Mono, but the Mono runtime in apt could be more evolved by now. Unity’s strength is really in the IL2CPP system now, I suspect.
If you can manage with that, any VPS works, but if you go all-Unity you don’t need a Mono installation at all. The exported servers are self-contained.