How to make a dedicated server
So I've been making a game in unity that has multiplayer. The issue is that the host would have a lot of lag as it has to load a lot. As well has he has to stay afk on the server to keep it online. So I would like to know of you can make dedicated server and how to work with it. For example you can call rpc's to the host but what about to the dedicated server. Oh and some examples of what I have in mind is in game like: Ark, Minecraft, Garry's mod and Starbound. Also as well as being able to type in commands into the dedicated console. Thanks for your time!
Did u ever get this working if so I'll love look at it for I'm trying figure out same thing as well but having little issues getting codes work new update has messed with my stuff so doesn't all work 2 well
Answer by koriley · Oct 06, 2015 at 01:17 PM
I believe with the new Unet in 5.1 you can use the network manager to build one. I have stumbled across settings and such that would hint to that.
http://docs.unity3d.com/Manual/class-NetworkManagerUNet.html
A way I was thinking about doing it, warning this is theory that might help your thought process, is to write a script that handles all of your spawning of players, but does not do it on server launch. It would pretty much just be a server with a camera above your map, like a lobby. On the 'client' build, it would have a connection script, once it connected to the server, it would tell the server, hey I'm here and spawning at this transform, the server would then tell all the other clients where you are and update you as to where they are. You will have to do some scripting for smooth moving and syncing, but there are lots of tutorials on that. (if you need some let me know, Ill post links)
Essentially making the server just a relay that all the clients have to check in with.
Both the client and the server would be the same build, but when you launch your 'server' you would just tell it, you are the server, await connections, and it would render nothing, but what ever your main camera is looking at (lobby scene).
Answer by hsadler · Nov 26, 2021 at 09:31 PM
I wrote a proof-of-concept websocket server and Unity client. One implementation in Python and one in Golang. Maybe this will help!?
Your answer
Follow this Question
Related Questions
Multiplayer - Host can damage client, not vice versa? 1 Answer
Why is my GUI popup showing up for both host and client? 0 Answers
Unet - Where/How to start implementing Host Migration? 1 Answer
[uNET] Instantiated gameobjects not syncing for new clients 1 Answer
[PUN] All players control one object 0 Answers