Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is phaser capable of large multiplayer games?

Newbie here. I am working with phaser, specifically with the isometric plugin.

I would like to know if it is possible to create games in phaser similar to agar.io, in terms of handling real-time multiple connections, generating a enormous map with about 300 players in it and all this without having too much impact in game performance. I seriously don't know how to handle the multiplayer part (probably sockets, node.js) for it to work really well. And as for generating a really big map I am quite blank too.

  • Is it possible, in phaser, to create a isometric-type game that handles multiples real time multiplayer and HUGE maps that are generated when the user gets to the edges of the visible "map"? How?
  • If not, what should I opt for (game engine in js and other applications) in order to achieve what I want?
like image 796
Kunis Avatar asked Aug 29 '16 11:08

Kunis


2 Answers

You're not asking the right question, but you're close!

Your first guess is correct. You wouldn't handle multiplayer with Phaser, you'd use web sockets, or nodejs, or some other backend. So Phaser does not really limit you in what you can create with regards to multiplayer, since none of the networking code has anything to do with Phaser.

The idea of handling a huge map also just depends on how you optimize your graphics, regardless of what platform or framework you're using. For example, if you have huge or infinite maps, you can always just only show what's on screen, or around the edges of the screen, and use object pooling to show the rest of the map as the players move.

For multiplayer in Nodejs, check out Socket.io. It's really easy to use. I've set up a barebones example using it here. And in case you might find it helpful, here's an open source game I made for Ludum Dare in Phaser, with networking (this one is only p2p, so it's only made to handled 2 players connected to each other, but like I said, that's only a limitation of the multiplayer framework I used, in this case peerjs.com, and has nothing to do with Phaser itself, which can take care of all your rendering and game logic needs.)

Hopefully this helped answer some of your questions!

like image 126
Omar Shehata Avatar answered Oct 13 '22 01:10

Omar Shehata


Phaser (at least in its 2.0 version) is not a good candidate for implementation of real time game networking as explained here.

If you're looking for a Javascript Multiplayer game engine you should check out Lance, which was written specifically for this purpose. You can then choose a renderer of your choice (Pixi.js, for example, if you're aiming to implement something like Agar.io. It's the same Renderer Phaser uses)

Regarding PhasedEvolution's comment above - Firebase is a nice tool if you're doing turn based games. It's not up to par for real-time game development as it doesn't allow low level access for any game-critical features that mitigate latency like client-size prediction, bending, interpolation and extrapolation.

Proper disclosure: I'm one of the co-creators of Lance :)

like image 45
OpherV Avatar answered Oct 13 '22 00:10

OpherV