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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Discussion Node JS and Server-Side Physics

Discussion in 'Multiplayer' started by travis2008, May 11, 2015.

  1. travis2008

    travis2008

    Joined:
    Jan 28, 2013
    Posts:
    3
    I'm converting my Asteroids MMO over from OpenGL/C++ to Unity. I've considered using Node.js as my server, where the client would just send player input commands to the server. The server's job would be to handle movement, collision, etc, and send the results back to all users. Would it be a good idea to build my server-side simulation in Unity using its physics engine, and use Node.js as a mediator between that and my Unity-based client?

    EDIT: After thinking about it, I might just drop either Node.js or Unity on the server-side, and just other whatever I don't drop exclusively. I've decided that the servers don't need to scale, and the game is supposed to be simple anyway. I'll probably just go with Unity since it's workflow would boost productivity, and at least both the client and server are using consistent tech... I'd use Socket IO in my client and server Unity projects. Clients would connect to the server, and only send player input to the server. Servers would authenticate (kinda, lol...) connections, and create corresponding GameObjects to represent each player server-side which will have all the rigid body properties configured. The only drawback is now my server would need resources to render the game, unless I can turn rendering off when in production. I only need the Unity-built server to run as a daemon. I would prefer it if the server didn't need to display anything. I could write a Unity-based admin tool that could securely log into the server, and render what the server is processing. Seems redundant, but I don't want the server processing graphics if it largely doesn't have to. Worst-case, I guess I could render my Unity server at a really low resolution, and raise the resolution when I log in. Problem is, now my server needs a window server (I'm going to go with Ubuntu).
     
    Last edited: May 11, 2015
  2. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    There's a headless mode for Unity where it won't render anything, sounds like that you are looking for. Check out the command line arguments in the docs.
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,798
    yourstandalonebuild.exe -batchmode
     
  4. digimbyte

    digimbyte

    Joined:
    Jun 23, 2012
    Posts:
    58
    I am interested in a scalable solution, since using a raw scene in Unity is not possible for my project as its procedurally generated and the world "spans" 6 mill meters and 12 mill meters respectfully.
    something that if calculated in a raw headless state would be cumbersome since we also have team sharding/masking

    not looking for anything too serious but a basic arcade style physics that is repeatable /predicable is important
     
  5. qbvbsite

    qbvbsite

    Joined:
    Feb 19, 2013
    Posts:
    83
    You can check out my thread here on creating a MMO (earl stages) as I create a standalone server that is not Unity.

    https://forum.unity.com/threads/creating-an-isometric-2d-rpg-mmo-ongoing-series.998851/

    The server mimics very basic movement that is predicable and easy to reconcile on the client.