Multiplayer Testing
Last updated
Last updated
Running your server locally and allowing friends or testers to connect to it is a great way to get feedback on your game or debug it with multiple players. You can quickly allow players to connect by using cloudflare's free tunneling service, cloudflared
.
First, install cloudflared on your the computer or server that will run your game server.
Follow this guide to install cloudflared.
Local development by default uses SSL with a self-signed certificate, but a cloudflare tunnel will provision it's own SSL certificate. We need to disable the one our server uses to prevent conflicts.
We can do this and run our game at the same time by running the following command in our terminal. Setting NODE_ENV=production
will signal the server to not use it's own SSL certificate.
Next, open another terminal window and run the following command to start your cloudflared tunnel. This assumes your game is running on the default port, which is 8080.
Once started, you should see something like this:
Copy your tunnel link from your terminal. Your tunnel link will be different, but for context, in our previous example our example link was:
Your tunnel link will be different each time you start your tunnel!
You and others can now connect to your server by going to https://play.hytopia.com and entering your tunnel link when prompted to enter a server to connect to.
You can alternatively make players auto-join your server with a link by using the ?join=
query parameter like this:
Just make sure you replace the value of join
with your own tunnel url!