Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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:
    277
    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.