Networking Question about Activating/Deactivating Server, I need a logic path

Hello everyone.

I need someone to explain some specific points about networking for me to proceed on my project. First of all, I want to explain that it’s been years I’m scripting C# in Unity, so I know the stuff. But I have never ever dealt with networking before and have no idea about it, and now my clients asked me to write a networking system for our upcoming project. Don’t get me wrong, of course I am not asking for someone to tell me what to do step by step, but networking is a huge thing and I don’t have enough time to learn it all, so I need to know what to learn, where to proceed in order to write the system I need to write. Here is the thing:

It’s going to be a mobile Unity game, the game will be active only on specific dates, for a limited time. For example 17th of August, between 2-4 pm. This date will be controlled by me. As I researched, I think something called Webservice might help me to control the data?

When the game is enabled, players will play the game. The mechanics will be different each time, so each time when the game is activated, users will have a different scene to solve. (Do I need to update the game from Google Play/iOS or can I update the scene from a webservice or a server?)

As said before, the game won’t be active forever, only for a limited time, and in that limited time, I need to know the highest scores of the users that had played the game.

That’s all, I explained the game to you, not because I am asking “how to do this”, but I am asking someone to tell me which web/networking subjects do I need to study and use in order to achieve the system that I am looking for.

It looks like what you need to learn is:

  • How to setup a server (to provide web services)
  • How to request and send info from and to the server (i.e. using the web services)
  • How to use AssetBundles (to change what the player will play)

What you might need if you want players to interact between them:

  • UNET or Photon or something like that (to allow player interaction)

The server part is not done in Unity and probably won’t be C# either. You can use some modern frameworks like node.js, RubyOnRails, etc. You’ll need to set your server to expect different HTTP requests (request to a URL you must define) for different things such as:

  • Querying the current time of the server
  • Querying the current AssetBundle (with the current game)
  • Sending a score and saving it into some database

Your Unity game would do HTTP requests (with the old WWW class or the new UnityWebRequest) to those webservices and do things with the responses it get. It’ll validate there’s a game available at that time on the server and download the AssetBundle for that game, then after playing it’ll send the result back.

The server has to be hosted somewhere so it’s accesible through internet. Either you pay for a hosting service of setup your own server. Once you have a working URL (a domain or an IP address) your game should request things to that URL. Meanwhile you can setup the server locally in your development PC or another in the same LAN with a fixed IP, and request to localhost or the server IP respectively.

Note that iOS doesn’t support new code inside AssetBundles, so you’re really limited if you want to provide different games with new logic. If this is a problem you’ll have to update the game on the store and make sure people has the correct version before allowing them to play.