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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Question about server/code

Discussion in 'General Discussion' started by squigglyo, Mar 13, 2018.

  1. squigglyo

    squigglyo

    Joined:
    May 21, 2012
    Posts:
    107
    Hey guys

    Logistics and scope aside, what would be the best approach for an online multiplayer game in Unity?

    Ideally, you dont want the games code being pulled apart. There are secrets to uncover, math you want hidden, exploits to be found, etc.

    So if I was to be looking into creating an online multiplayer game as a side project, essentially would the best approach be to have all of the 'thinking' done server side in hidden functions?

    So the game would send to the server
    'Use item X from the Inventory'
    and the server would send back
    'Error, you don't have that. So No.'
    or
    'Item Used, remove it from bag. Also gained 25 experience. Also got this message in chat about it.'



    So essentially, anything that changes values or calculates values should be server side, while the Unity game is then essentially just a shell that is only capable of sending and receiving information, never changing it.

    So Unity would essentially contain nothing about how the game works, it would just be the visual interpretation of the data.


    Am i on the right track with all of this at all?
    And would something like Gamesparks be reliable enough for at least the begining phases, or would it be best to use my own server (in which case, any recommendations for a starting point).

    *I have the time, team, funding and means to do something of this scope (its more of a fun excercise anyway), so please dont post about feasibility in that regard. Im just trying to figure out the best steps to start with*
     
  2. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    You need to find a balance between client side prediction and server authoritative. A game that does everything on server first feels clunky. If your game only have RPCs its pretty easy, its variable syncing thats the hard part.
     
  3. zoran404

    zoran404

    Joined:
    Jan 11, 2015
    Posts:
    520
    As anders said, you should have logic in the game as well.
    A popular approach is to execute the action right away and rollback if the server says you can't do it.

    For example if a user uses a healing potion you'll show his health grow back instantly instead of waiting for the server to update your health.
    You would only rollback if for example the server sends you info that you were stunned or died, in which cases you wouldn't be able to use the potion, so you would rollback the health and return the potion to the inventory.

    This would especially be important for abilities, since users will expect to see their character play an animation as soon as they press a button.
     
  4. castlesidegamestudio

    castlesidegamestudio

    Joined:
    Oct 16, 2013
    Posts:
    36
    Hi Squigglyo,

    Since I am waiting for what seems like forever for UltimateUnwrap3d to do its thing. I will take a shot at this.

    CAVEAT EMPTOR

    Being 19 years into a lifelong software development career I have come to the revelation that I do not have the lifespan to rewrite every single line of code on the planet.

    Therefore, for me, the past few years or development have been about finding and integrating existing solutions into my projects.

    I mean, you have already chosen unity?

    Some people would rather write their own game engine, write their own operating system, and then create the hardware from scratch for all that to run on..

    Oh no Brotha!

    A successful project has 10 percent new stuff in it..

    So, don't go off re-inventing the wheel if you don't have to.

    To me, your choices for writing an mmorpg using unity as a client are slim pickins.

    So, without writing a treatise on all the bad options that you do have, I will just stick to a single recommendation.

    My current recommendation is that you look into using PENNMUSH for you backend server.

    https://www.pennmush.org/

    Pennmush was cleanly moved over to the artistic license in 1995 having its roots in tinymud.

    https://tldrlegal.com/license/artistic-license-2.0-(artistic)

    It is still in active development and will do everything that you have mentioned in a authoritative way...

    with a few modifications..

    you will have to write some code to overcome the impedance mismatch between a 1970's style multiplayer game and a 2018 style multiplayer game.

    fortunately, not too much.

    anyway, If you follow this route you will be in good company.

    Everquest used a MUSH.

    Heard of them?

    Um, UltimateUnwrap is done!

    Okay, everyone flame away. Here I am, wearing my flame retardant Gandalf outfit.

    Thanks!
    :)
    Brian

    http://www.hallsofcamelot.com/


    some corrections:

    *Everquest was inspired by DikuMUD
    *RanvierMud might be a better option as it is newer and has a MIT License - http://ranviermud.com/
     
    Last edited: Mar 14, 2018
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There is a difference between making a server authoritative game, where everything important happens on the server, and ensuring even unused server side code doesn't at all exist in the client build so as to not be dissected for whatever secrets you think it may contain about how the game works.

    Making a server authoritative game where nothing important to the server is calculated or trusted from the clients, just requires that you design the game that way. Unity's UNET networking API fully supports that, as well as several other 3rd party API's.

    Preventing server side code from even existing in the client side build will make your project considerably more complicated though. You'd need 2 separate projects, and lose a lot of higher level functionality since the UNET high level API is built around the idea that both the client and server are running the same scene in the same project with the same set of scripts, so they can both basically talk the same language. Otherwise you'd need to build your own higher level functionality on top of low level basic send/receive commands. For someone just getting into multiplayer game dev, I don't think it is effort well spent.

    GameSparks isn't a game server by the way. Its a peer to peer platform with various database related services. Completely the opposite of what you were wanting.
     
  6. grimunk

    grimunk

    Joined:
    Oct 3, 2014
    Posts:
    270
    We might have something that is of interest to you. Send me a PM.