Search Unity

Arguments for the server.bat?

Discussion in 'FPS.Sample Game' started by sullaysur, Dec 26, 2018.

  1. sullaysur

    sullaysur

    Joined:
    Dec 26, 2018
    Posts:
    8
    Hello Community,

    I'm searching for all Arguments from the "server.bat".
    I would like to set the Servername & Max Player in the "server.bat"
    How can i do this or witch Arguments do i need for this?

    I tried it with this:

    Code (.bat):
    1.     FPSSample.exe -nographics -batchmode -noboot +serve level_01 +servername TestServer +game.modename assault
    2.     FPSSample.exe -nographics -batchmode -noboot +serve level_01 +servername "TestServer" +game.modename assault
    3.     FPSSample.exe -nographics -batchmode -noboot +serve level_01 -servername TestServer +game.modename assault

    But it didn't work.

    Thanks for the help!

    sullaysur
     
    Last edited: Dec 26, 2018
  2. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    206
    boot.cfg is ran first, you could put a line in the server's boot.cfg that references your server.bat or does those calls. Just don't include it in the client files, or build in a "is client" "is server" check some how.
     
    sorkoxd likes this.
  3. sorkoxd

    sorkoxd

    Joined:
    Apr 4, 2018
    Posts:
    23
    I assume you did obtain that code from MainMenu.cs .
    There this is thrown into some class that looks like it does only provide info for diagnosis.
    Well somehow this have to be processed somewhere but i dont know where i would guess somewhere in process.Start().
    What i would guess is that the ones with a + in front are commands of the buildin console.
    If you want to set these at startup use one of the files the system reads at the beginning like user.cfg or boot.cfg.
    Dont know is there a server.cfg or something? I think you have to do some research where you should place these.

    Unit do what you want when using the Project Tools Quick Start section you might be able to investigate how they do this.

    If you definitely want this as arguments on the executable you might be able to hook them up in game.cs.
    Something like
    if(!commandLineArgs.Contains("-yourflag"){})
    to give you a hint on how this can be done.
    I dont know how these arguments are parsed so it might be difficult to get the names in but for sure you can find a way.