Creating multiplayer games with Phaser & Socket IO - a good idea?

I am thinking of creating a fighting game using Phaser 3. Something inspired by Mortal Kombat. I was thinking of using Socket IO for the multiplayer functionality.

Is using Socket IO for this scenario a good idea in 2020? I read somewhere that it “uses WebRTC internally”, thereby using UDP instead of TCP. Does it mean that latency will be minimal?

I would really like creating this kind of a multiplayer game for the web (instead of standalone versions), but I don’t want to end up building something that is unplayable (owing to lag).

I have used Socket IO before for creating simple chat based web apps & turn based games. This will be the first time I will use it in a game that requires real time updates.

What do you think? Should I proceed with creating such a game?

Btw, I don’t have a background in computer science; hence my knowledge on computer networking is minimal.

Some of the stuff that I read -

No, Socket IO does not use WebRTC. Socket IO can be used for WebRTC peer signaling (I guess this is what you have read). Means using Socket IO, you will always use TCP.

If TCP latency it not an issue for you game, you can of course use Socket IO.

If latency matters try geckos.io, a library (I’ve built) that uses client/server WebRTC connections.

Here an overview when to use which library.

2 Likes

Thank you. I’ll check out Geckos.

I have been doing some reading on multiplayer game development.

I may be mistaken, but it seems to me that it does not matter what library I use (Socket or Geckos) - as much as choosing the right architecture does. No matter what protocol I use, I cannot make the game lag go away completely.

I read about something called “authoritative server architecture”; I think I need that in order to achieve what I have in mind (real time multiplayer fighting game - like MK or Brawlhalla). This type of architecture will probably help me create a good (and “seemingly lag-free”) experience for my players.

What do you think? If anyone has some experience in this matter, please share your thoughts with me. :slight_smile: