Search Unity

Unity Headless Server missbehaving on linux?

Discussion in 'Multiplayer' started by Rafael-Barbosa, Jan 9, 2019.

  1. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    Hey,

    So I've been developing a nodejs server for a game. This server is using an instance of unity (that is not a player but connects as a client) in order to simulate physics and be aware of the game world.

    So essentially I have a node.js server runing alongside a unity linux headless client.

    Unity clients then connect to this server and play the game.

    This works perfectly on my machine, I can even place the node server on my remote server but keep all of the unity instances on my machine (the first player that connects is used as the player-less client one). This works great, but as soon as I try to launch it on ubuntu, everything starts missbehaving.

    This is what it looks like on the client


    I did some debugging and found out that the Unity client on linux is sending wierd values, values like 202031310.0, on windows, this doesn't occur. I tested this on my own machine and on a rented server from digitalocean.

    I'm a bit lost as to what could be causing this, I've tried -batchmode, -nographics and also -force-opengl but nothing up until now. Unity (server) log seems normal, no errors nor anything.

    upload_2019-1-9_15-43-0.png
     
  2. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    A little update:
    I've tested -headless on windows and while it doesn't get crazy like that, it becomes extremely laggy, as in, completely unplayable.
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You haven't given much information to go on. What value was 202031310.0 supposed to represent, and how does that differ from your expectations? Are you doing something that is frame rate dependent and not setting a reasonable frame rate for the headless server?
     
  4. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    Hey Joe,
    Thanks for the reply, you helped me fix one of the problems, I checked the fps and it was at 10k, this was creating a bottleneck which was essentially stopping communications! I limited the fps and now the window's headless mode is working correctly. No issues there.

    However, after checking that, I have built for linux and sent it over to my server to test it out there, the connection seemed faster, which is great, but the issue is still there, it seems like it's sending wrong values to my client, I'm not quite sure. The log still seems fine. So essentially, it seems that the linux build is somehow broken, if it had something to do with lag, it would have just made things be still or rubberbanding, not going haywire.

    What I'm going to do is: I'm going to install ubuntu on my notebook and try to run the build locally, if there is anything wrong with the build, I'll be able to assume that it's linux related.
     
  5. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Just a blind guess, but that's one of the points that's majorly different on Unity's Linux build ... Are you working with strings for data values, e.g. by reading data as strings from a config file? What locale is the server running? If it's not running a locale with "." as the decimal separator it will behave different than other Unity platforms whenever you do ToString, Parse etc with decimal types (float, double, Vector*, ...).
     
  6. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    Hey,

    That was actually true, I changed the way I did it to not use only strings and with that, I got to reproduce the error on windows, so at least I can debug it easier now. I also got to see what was changing. I tried it with the character's Y pos, which is 1.5, and node is receiving 2, it seems to be rounding the number.
     
  7. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    woof, I got it working, it looks like you were right Alloc, it was the way linux and windows were parsing the values.

    I didn't find a fix for my current system so I tried changing plugins, instead I used bestHTTP and it worked flawlessly!

    Thank you both for helping me out :)
     
    Joe-Censored likes this.