Search Unity

"headless server" for testing multiplayer

Discussion in 'Multiplayer' started by sinisa, Oct 30, 2009.

?

Unity Pro will be avaliable for free in a

  1. 6 month

    71.4%
  2. 1 year

    0 vote(s)
    0.0%
  3. 2 years

    28.6%
  1. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    Hi there,
    I get headache from reading and searching about multiplayer solutions with unity.. too many and too complex for my old brain :)
    My questions are:(for a webplayer)

    1. Can i use unity (free ver) to make server from it (-nographic or whatever) and test multiplayer.
    As i understand, you can put it on a one computer and connect from others.

    2. If that can't work is it possible to make java socket server with xsocket and push x,y,z through it to move many characters in the scene. If anybody tested that, please tell something about.
    For a 10-20 characters it may be good enough?


    looking forward for reply,
    thank you for your amazing product

    Sinisa
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    1) Yupp its not a pro feature.
    The only thing required is a monobehaviour that sets all up because the server won't accept any input.
    Generally the code and active components though should be developped for this usage otherwise you burn through a lot of useless performance.

    2) You can use sockets or whatever you like. If you are a java fan, then SmartFoxServer (Pro) might be an interesting opportunity to use.
     
  3. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    it can be done inside unity or have to be created as external dll?.
    is this a reference for that (that pages)
    http://unity3d.com/support/documentation/ScriptReference/Network-isServer.html

    Im looking for simplest solution, creating socket server that can handle 20 connections and send data to everyone is far easier then learn and setup SFS.

    I dont need database on a backend, only x,y,z to be translated to all players and vica versa. So you dont feel alone in the scene :)
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    1) All in unity :)
    What you basically need is a script that just starts the server etc so others can connect.
    Normally you would have code that does that after a user request (UI commonly).
    Also there are some components and functionalities that are evil on server. One of the top killers is Animation that will break your performance with the glimpse of an eye

    The isServer variable is what you would use within the other components to detect if you are on the server and do things different / not do them at all. As such its a pretty important variable. but it won't be set just because you start in headless (at least I think so, would have to check that)


    2) hehe
    Well for 20 connections you can use unity, no problem :)

    My recommendation is that you download the Network Example from the resource section on the website and modify the master server script that is part of it (I copied it, renamed and enable / disable the player / server targeted one before builds right now - in a real production I would use the build processing scripts etc to build both sides in one go) until you have a working headless solution :)
     
  5. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    hm.. headless solution or not that is a question :)

    ok, you suggest to start unity on a server, set it like master server .

    I am little confused now :)

    a) master server
    b) headless server
    c) master script
    d) i will find something more :)

    webplayers, connecting to unity on a server and in that unity it will be good to do 1. take head off 2. use it like master server.

    i need coffie :)
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    no I said you should look into the master server script in there. that is not a master server or alike but part of the name of the script so you know what to rework for the headless server "startup script" that handles the start of the server etc
     
  7. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    ok, any ideas how much that kind of rework can hold, i mean multiple connections.

    I know that it depends on everything but I ask for sending receiving x,y,z on a single plane.

    later maybe to add ball and crowd around (kidding) :)
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Depending on how optimized your scripts etc are quite a lot.
    The network example itself isn't geared towards headless server just because there was none for windows when it was done, it was targeted at "in client" game hosting.

    But with correspondingly written server scripts, 60+ should be doable
    if you use the setscope to only sync objects close to each other, even easily more.
     
  9. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    ok, lets write down what we've learn today:)

    Unity free version can be started in a "headless" mode, without rendering and we can put script in it to tell it that it is a server.

    It can hold scripts for syncing players, send datas around and trace status of a player (connected or not).

    With a little luck, that nohead server can occasionally send and receive via WWW to some database data that are not so important for real time.

    If its made right, it can hold cca 60 clients.

    sounds good
     
  10. DrHotbunz

    DrHotbunz

    Joined:
    Feb 14, 2009
    Posts:
    315
    But how do you start Unity free version in a "headless" mode ?
     
  11. DrHotbunz

    DrHotbunz

    Joined:
    Feb 14, 2009
    Posts:
    315
    Well I think I understand it now.

    You make a game exe. Start it with the -batchmode command line argument.

    This then gives the following "error":

    So headless is a pro feature, contrary to other posts I have seen.
     
  12. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I didn't know that, sorry :(

    I've Pro + iPhone Advanced and the feature page doesn't list it on the comparision table
     
  13. Samb88

    Samb88

    Joined:
    Mar 26, 2009
    Posts:
    208
    yes, headless is pro... don't know why.. waited now over three month just for this feature, keep everyone saying "it's coming with the next patch at end of octobere, then you can play my game 24h a day!". now I have to say "you need to wait till december, I won't have the money for the pro version till then"...

    I just don't know why this is a pro feature... makes no sense to me :/
     
  14. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Until this point I totally kept myself out of the discussion about free unity, Indie / Pro features.

    Now I noticed, that more and more nice features are Pro only. Yes, I know, I may upgrade, if I get rich in the next two month.

    Thanks for giving us the possibility to vote for new features, hey there is a cool new Unity feedback page, where you can see, what new cool features we will implement.

    Woohoo, Profiler is coming, Yeah , new cool VCS Integration , hey headless Server Support !

    Well, most of them are Pro now, no words about that before 2.6 release. Very disappointing.

    I bet they would have made the Animation Editor Pro only, too, if it hasn't been part of 2.1.

    I fully understand that certain features will be Pro, ok , but headless server support ? Come on ...

    Last night I dreamed of the Unity console telling me :

    "Save Scene is a Pro feature only"

    --
    oxl
     
    CliffracerX likes this.
  15. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    dreamora,

    you said that headless is not a pro feature ..hmm.

    As I understand it now, you can make your game.exe, start it up on a server (like normal game) and put scripts to act like it is server and handle connections.

    That is good too but it will be nice if that game.exe dont render things (headless).

    If unity allow all nice features from pro to be avaliable in a free version so they can abandon pro and became global Red Cross.
    I dont think they are humanitarian organisation, they are company and company have to make money.. thats logical to me why its not to you thats another question :)

    As human beings are never satisfied (they always need and want more) some of your comments are understandable but not logical :)

    Make games with free version, sell it and after that buy pro version, so thats logical i will say.
    Maybe to ask people from unity to make games for us so we can sell it and after that buy a pro version?..:))))
     
  16. Samb88

    Samb88

    Joined:
    Mar 26, 2009
    Posts:
    208
    Running a game without its renderer doesn't seems to me like a "pro" feature... wasn't the batchmode for mac in the indie version?
    the only sad thing is... it was the only feature I was really waiting for.. take the animation editor and any other improvement back and just give me the batchmode for windows and I would be more than happy :)
     
  17. sinisa

    sinisa

    Joined:
    Oct 30, 2009
    Posts:
    18
    can someone from unity team explain is possible with free unity to start up with -nographics (or whatever command is) or not?
     
  18. runningbird

    runningbird

    Joined:
    Sep 3, 2009
    Posts:
    382
    headless mode should be in the free version I think.
     
    CliffracerX likes this.
  19. hogus

    hogus

    Joined:
    Jul 9, 2009
    Posts:
    145
    It was also my understanding that this would be part of the abandoned "Indy" version.

    Since I'm making windows games only and you pretty much have to do your own networking anyway due to poor support from Unity, XNA is starting to look like a more viable option again.
     
  20. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    I'm disheartened that headless mode is a pro feature only. But I guess a server can still work even though its rendering.

    If they ever make a linux version that can't run in console mode only, that would be almost useless since most linux server setups don't run an X.org server
     
  21. Ben1977

    Ben1977

    Joined:
    Feb 27, 2013
    Posts:
    8