Search Unity

About UnityEngine.dll on server

Discussion in 'Multiplayer' started by Rellfy, Nov 27, 2016.

  1. Rellfy

    Rellfy

    Joined:
    Feb 17, 2014
    Posts:
    5
    Hello everyone,

    I'm developing an UDP server for a multiplayer game (obviously?) and I had the idea to reference UnityEngine.dll to use objects such as Vector3 and Quartenion, so I could transfer them directly between server and client. Although it might be simpler to develop the server this way, I'm not sure if it's worth it. Could it be too much to transfer compared to a simple double/int/string, and creating the Vector3 on the client side?
    The server updates data per 8ms (nearly 120 times/second).
     
  2. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    404
    Are you planning to send data at the rate of 120 times per second?
    How big is the data packet and how many connections need to receive the data packet - times that by 120 and again by 60 and your per minute bandwidth is going to be massive
     
  3. Rellfy

    Rellfy

    Joined:
    Feb 17, 2014
    Posts:
    5
    I'm actually using that for testing, I will change the rate later on. And the packet size is pretty small, hehe
     
  4. fredrikholmstrom

    fredrikholmstrom

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    8
    You can reference and use the UnityEngine.dll as long as you don't call any methods that depends on things that only exists inside the Unity runtime (components, gameobjects, physics, a lot of the math functions, etc.). However if you only need a few select struct types, such as Vector3, Quaternion, etc. I would recommend just adding your own version of them to the server code to make them easier to work with, or just treat them as float arrays of size 2, 3 and 4 on the server.
     
    Rellfy likes this.
  5. Rellfy

    Rellfy

    Joined:
    Feb 17, 2014
    Posts:
    5
    Thanks for clearing it up, @fredrikholmstrom :)
    I think I will just go with running the server as an Unity standalone game, so I will be able to simulate everything I need, and then run it as batchmode.

    By the way, I'm not aware about a way that I could output logs in the console window (on batchmode) on Linux. I might just make something that reads output_log.txt from the data folder and outputs that to console.