- Home /
How to run a dedicated server?
Hey, so I've got my multiplayer FPS, but I'm trying to make a dedicated server were no rendering or low rendering is being done because its not necessary as theres no player. How can I network instantiate objects and make the server process all their actions without requiring the rendering?
Answer by LeopardX · Sep 17, 2015 at 12:13 PM
As of Unity 5.2, and if you want to run your dedicated server on say a VPS server, then -batchmode -nographics as the command line arguments are needed, HOWEVER!, unity has sadly not suported a proper console window dedicated server and as a result, when you use bachmode, there is NO window or any indication other than looking at task manager to see if the server is running.. i find this totally insane by Unity..
However what I would sugest, is to code your own launcher, pass the arguments to it, then monitor the proccess, and give the option to shut the proccess down by sending the proccess handel a PostMessage(app, WM_CLOSE, 0, 0); or similar like:
[DllImport("user32.dll", EntryPoint = "PostMessageA", SetLastError = true)] private static extern bool PostMessage(IntPtr hwnd, uint Msg, long wParam, long lParam);
For more info google: send message to close process c#, or things like how to embed a proccess into a window would give you a good start also, not that you need to do that, but it dose show how to run programs and get there handel.
Then you can give your users some kind of professional look when running your dedicated server, unlike how Unity dose it.
Answer by ScroodgeM · Aug 06, 2012 at 10:53 PM
Hey, is there a mac solution? I see there is no -nographics option for mac.
Will I need to run the start server code first. Or can batch mode be typed after starting.
Answer by Dr.Yueh · May 07, 2014 at 03:36 PM
Hello ! some time has passed since the last posts. does a game server in Unity 4 really run without gui or directx installation when purchasing a pro license ? And if so - are rigidbody movement and collisions on server for examples doen correctly without rendering ? I have found concurrent information about this topic and before purchasing pro just to get a feature that will not work out would make me pretty angry .... I really would appreciate a comment from a pro user or a unity mod. Thank you all ....