Hello all!
I am rather new to unity and the networking system of unity so please bear with me!
I have coded a multiplayer game that has different code for server and client (separate projects) and uses the Transport Layer API. It works fine on my computer when I run both the server.exe and client.exe
May I know how can I host the server.exe online? Do I use a window cloud VPS? If I do, do i need to port forward or anything of that sort?
If it is a dedicated server project, yes you can rent a server from one of various providers and host it there. If you do that you should have your own static IP address, so won’t need to do any port forwarding.
Where port forwarding comes into play is when you are hosting the server behind a NAT router, such as with a typical home network. In that case your computer’s IP address would be a private address not routable on the internet (192.16.x.x, 10.x.x.x, etc) so you log into your router and setup port forwarding from the router to your server. Then you have clients connect to your router’s IP address. This is very useful for testing your game during development.
Hello! Thank you very much for your reply! Yes, it is a dedicated server project. By renting a server, what kind of server do u mean? My server is an exe compiled and written in unity! Go i need a window cloud VPS?
What type of server you rent really depends on the requirements for your game. The requirements for your game typically come down to just a few factors.
How demanding the game is on hardware
– For a dedicated server you’re usually not needing any graphics, so this is usually CPU and memory resources, and sometimes disk or even a database
– A virtual private server can work for some games, but others may require direct access to the hardware requiring you to rent an entire server instead of a virtual server that shares resources with other customers
How much network throughput your game needs
– A slow turn based game will have vastly different networking requirements from a fast paced real time game
Server platform
– Yes you can go with Windows, but Linux is generally the go to platform for a dedicated server
Windows has a GUI which is an unneeded and wasteful feature for a server. Windows has licensing costs which increases the price compared to Linux. Unity has a headless build check box when making builds for Linux, which doesn’t include any of that unneeded graphics stuff in the build, where for Windows builds you can launch them with commandline options to prevent loading graphics but the graphics stuff is still included in the build unnecessarily.