- Home /
Too subjective and argumentative
.io style matchmaking (one button matchmaking)
I'm currently working on a 2D web shooter. I currently have a room based matchmaking (a client creates a room and becomes the host and other clients join this client/host's room) but I want to have an automated matchmaking. By this I mean that a player launches the game, he clicks on a button "Join game" it then puts him in a game where if he is the first person, he becomes the host, and if there is already someone he connects to that persons game. The problem is that my knowledge and experience with networking is very limited so I would like some help on how to do this properly.
PS : I want to have a client server because I don't want to put money in servers.
Answer by Bunny83 · Oct 25, 2018 at 10:41 AM
First of all you can not let a client host the game if your game is a webGL game. You have to have a dedicated server that you host. A WebGL application that runs inside the browser of a client can not receive incoming connections, at all. There is no way to directly connect two webGL applications through networking without having a server to which both clients connect to. Apart from the fact that the security sandbox of every browser doesn't provide a way to opening a listening socket, you would additionally have the problem that you can not circumvent firewall or NAPT routers in between.
All browser based multiplayer games have a central server (or several) to which all the clients connect to. Since it's a web application you actually have to host it on some kind of server. It's naturally that you implement the server on the same machine where you host your game, though it's not necessary. You could host the game content (the actual website) on github pages for free and provide your server on a seperate server. However you need a server where you have some sort of serverside scriting / programming so for example github pages can't be used as matchmaking / game server.
I don't want to put money in servers.
Well in this case you have to find a free webservice that allows you to run any sort of server side logic code. A lot web free hosters have quite strict regulations how you are allowed to use their service. A lot do not allow to use their service just as data service. The next issue with free hosting is, they can quit their service at any time. I recently moved from dropbox hosting to a freehoster since DB made it so tedious to host a webpage. However after less than a year that freehosting service has shutdown their service. So it's possible to use freehosters, however not very practical in the long term.
As for how to implement matchmaking, sorry but this topic as a whole is way too complex to answer here, especially if you're not experienced at least with the fundamentals of networking.
Alright so I guess that I'm pretty much stuck and should make this game a standalone. Could I implement a one button matchmaking like I originally planned to on a standalone game with a client hosting the game ?
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Network command is running on client? 1 Answer
How do I use Gamecenter to match-make on iOS? 0 Answers
Offline testing a player object? 0 Answers
Animation & sound over network 1 Answer