- Home /
Can I use php as matchmaking server ?
Hi, I would like to know if you think this is possible and get your suggestions.
I have a game in development and I am thinking of a multiplayer for 1v1 sessions with people joining as soon as someone else looks for a game.
My idea to CUT OFF the cost of a matchmaking server by using php myadmin instead.
I think this have been done in the past but I can't find where.
I do not need to save the player information yet and I will have less then 30 players for the development phase so I think php would be a good free alternative for a while, what do you thing?
My Idea is that in Unity the player would actually hit the button matchmaking and get a response from php myadmin real quickly.
The php page would return a string that either contains a player server information OR nothing.
If there are some player information it means a server is running, this way the player is sent in the already hosted game and begin playing.
If there are no player information the player host a game and calls back the php page to SET the string using his hosted server information.
Answer by phil_me_up · Mar 16, 2016 at 02:01 PM
To be clear, PHP is the language, PHP MyAdmin is a system written in PHP and used to manage a MySQL database - two VERY different things.
Could you do it? Yep! Should you do it? Sure, give it a try! Would I do it? Only after a lot of testing to prove it's appropriate.
If you want to go down this route then you will really want to look at efficiecy. Consider using NodeJS rather than PHP where possible, and you might want to look at using a NoSQL database like MongoDB rather than MySQL.
This does of course depend on what you're doing / how much load you expect to see etc but I will say this one, very important thing: Maintaining web services is time consuming! You might find that you set it up and never have to touch the system again! Brilliant but there will still be costs involved to host the servers and maintenance to those severs to keep them secure and efficient. If you get loads of traffic, without a suitable scaling plan your sever might fall over and appear 'broken' to the players, so you need to be ready for that.
Cost wise, take a look at the AWS free tier, or the Azure BizSpark program. Both might cover your needs and give you a more stable, feature rich system.
Bottom line, feel free to try. It's certainly possible but it's not necessarily the technology I'd use.
Answer by _Mathias · Jul 10, 2017 at 12:34 AM
Hello ! Phil_me_up explained important things very clearly. I'm currently developing a multiplayer game using this kind lf multiplayer system: I get player position, rotation, username through php and MySQL. My game isn't done yet but I tried out my system on local network then over the internet and both work pretty well ! You don't really have to care about traffic since responses from the server will be only about a KB. The most important thing is server latency to ensure a smooth game. Even when we were 10 players connected in the same room the request was only about 500B. I don't know how many times per second you have to check the server, but that's also a thing you need to think about. Just an important point: I used a "click to move" system so checking the server 5 times per second is enough. Depending on how many requests a player sends to the server in one second the server load can rise as the bandwitdth usage. Experiment, but keep in mind that TCP is slower than UDP so you have to limit the amount of informations to pass through your system to avoid a too big latency in your multiplayer system. Good luck !