Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

So I want to start adding online multiplayer support... on the cheap...

Discussion in 'Getting Started' started by Tset_Tsyung, Apr 5, 2016.

  1. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    Hey all,

    (Felt this was a 'beginner' question - will re-post to networking if you guys 'n' girls think it'd be more appropriate there.)

    So I've still got a LOT of things to add to my game (not to mention bug squashing). And since this is my first game I'm prob going to release it for free (don't think anyone would pay for this, lol).

    The thing is that it's designed to be be multiplayer, via ye' old internet. Now I've just done the Merry Fragmas 2.0 tutorial, and this is really cool! The high level coding/design process needed to get a basic online multiplayer game up and running is very minimal, nice! I've already got ideas for how to add the various features my game to this. The problem for me is the price.

    If I'm only getting 200 players a month, that will cost me approx. $10 a month in Unity services costs (just for the multiplayer). If I ever make a ginormous game as part of a team it can cost several thousand a month in Unity charges.

    So, for the sake of argument, let's say I want to start learning how to make my OWN multiplayer code/API's for future projects (I have NO illusions about learning ALL of this by the time I'm done with my current project) where should I start looking? Is it even possible to write your own low/mid-level networking code in Unity? Are there any books or online resources that any of you can think of?

    Please note, I was thinking of going back to the original, 3 part Merry Fragmas tutorials to learn Photon, as that required some interpolation code to be written - thought that MIGHT be a good introduction... thoughts?

    As always, it's great hear the advice from my wiser coding peers. Thanks in advance for any comments.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    It's certainly possible to write all the networking yourself; Unity is built on Mono, which includes TCP and UDP sockets.

    But you'll need a server too, unless your game is strictly peer-to-peer (which is problematic since most people these days don't know how to open a hole in their firewall to receive incoming connections). So, you'll also have to set up a server somewhere (I have had good experience with Rackspace) and write code to run on that, too. Unfortunately it's hard to find a server already set up to run Mono code, so you'll need to also be a Linux sys admin, or use a Windows server (ick) so you can run .NET. Or, right your server in a language other than .NET.

    So, all doable, but quite a lot of work.
     
    Ryiah likes this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    Unity's Multiplayer service isn't strictly required to use Unity's Networking API. All it does is provide matchmaking and relay servers. Rather than completely build your own solution you could just build your own matchmaking and relay servers. Or use those provided by a platform like Steam.
     
    hippocoder likes this.
  4. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406
    @JoeStrout , many thanks. It's good to know that's an avenue of research/study I can go down. As with all parts of Game development I would like to understand the foundations of what I'm working with - I feel that merely standing on the shoulders of giants wouldn't be very professional or respectful of me (I know, I have some funny ideas sometimes, lol). Any particular subject/book I should look into for my first steps that you would recommend?

    @Ryiah , yeah, I noticed something about that on the services page but wasn't sure that I was understanding it correctly. I guess that it'll become a lot clearer as I delve into the Unity Networking (Unet?) documentation and start fiddling with it all [Hmm, what happens if I change this? {BOOM} Okay, don't change that!].

    Steam is one thing I would like to work with eventually, however I don't think this project would get through Greenlight... would be nice, but not probable at the moment... THANKS AGAIN YOUZ BEAUTIFUL PEEPZ!!!
     
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,026
    Honestly Greenlight has gotten to the point where just about anything can get on it given enough time.
     
    Tset_Tsyung likes this.
  6. Tset_Tsyung

    Tset_Tsyung

    Joined:
    Jan 12, 2016
    Posts:
    406