Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Some questions from a networking beginner

Discussion in 'Multiplayer' started by Luke-Houlihan, Mar 8, 2008.

  1. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    I would like to use a client-server architecture with clients signing into and connecting to the server using a username and password. All calculations would then be handled by the server and the client would just sent requests.
    Now to my question, what would be the best way to implement this? Could I use unity to basically make two versions of the game, client and server. If I use that method (if its possible) I would need to somehow keep track of usernames and passwords even if the server crashes( is there any serialization in javascript?).
    I could use a MySQL server to track the accounts but I have no experience with them, and I would need to do a 'game state backup' on the server every half hour or so for if it crashed.
    Any other suggestions for server architecture are greatly encouraged.
    Sorry for the length, any help is appreciated!
    -Luke
     
  2. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    281
    You should be able to do all this with RPCs, although I have no idea of what kind of game you are actually doing ;) The client can use an RPC login function, the server processes the information and sends an RPC back with a success or failure message, etc. The client requests would be done in a similar manner. I think the Castles scene in the networking example project has something similar where a client first requests permission to instantiate his object with an RPC, gets an RPC reply, and so forth.


    Well, you can just make one application with server and client code shared. Thats how all the examples are done in the networking example project.

    Not sure I understand what you mean. You could easily keep user/passwd info in a file if thats what you want. It can be done with the usual .NET/mono routines to serialize to a file. Googling for it should result in tons of examples.

    MySQL keeps all its data persistent. There is no need to back up you stuff every half hour. If it crashes you should just lose data which was in mid transaction as the crash occurred (unless of course the database gets corrupted). If its very important data you could easily do backups in any case.
     
  3. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    Thank you very much for the informing answers!

    The game type is MMO so the server will constantly be running a continuous game, does that change anything?

    -Luke
     
  4. dirkk0

    dirkk0

    Joined:
    Nov 29, 2007
    Posts:
    16
  5. Luke-Houlihan

    Luke-Houlihan

    Joined:
    Jun 26, 2007
    Posts:
    303
    The concept is an MMORPG so a client with the no rights is almost crucial to prevent cheating.
    The thing is I want the server to handle almost everything so would I need to have a Game-Server project and a Game-Client project as seperate standalones? That would seem to give the client very limited abilities to hex-it game code.