Jump to content

phaser for real time multi-player game?


smallon08
 Share

Recommended Posts

is it possible for different player to look at different part of the game world at the same time?

Well, I think your question is semantically unclear. My gut is telling me that what you are asking about is whether a player on a different computer can join in a game made with phaser and socket.io and whether that player's camera can focus on a different point in the game world than another player's. If this is the case, then the answer would be yes, absolutely.

Link to comment
Share on other sites

Yes you can. To try it open your game in two browsers and move one way in one and another way in the other. If you program your own server you can hook it right into Phaser. I use ajax to a php server from within phaser with no problems.

Link to comment
Share on other sites

THANK you all.

Well, I think your question is semantically unclear. My gut is telling me that what you are asking about is whether a player on a different computer can join in a game made with phaser and socket.io and whether that player's camera can focus on a different point in the game world than another player's. If this is the case, then the answer would be yes, absolutely.

Mariusz: yes , i mean that, but  in http://www.html5gamedevs.com/topic/1384-syntax-for-adding-camera/  Rich said that multiple camera is not supported, is that what i want to do?

 

 

It is possible if you use RenderTexture.

enpu : can u explain more , i am a newb

 

 

Many thanks!!

Link to comment
Share on other sites

I don't think that whether Phaser supports multi-cameras or not has any relevance to your question. And I don't understand what relevance the reference above to "render texture" has to your question (sorry if I'm just too dumb). But I think some others above have said (i.e. Mariusz) that it is possible and I would agree.  Because:

 

Each player is on a seperate computer on a seperate browser using it's own Phaser environment, right? Each of those browsers has a Phaser.Game (and camera with it). Each browser uses sockets or whatever to send messages back and forth to communicate the locations of the players (or whatever other states are needed to be shared). It is only the messaging between the seperate browsers (players) that makes it become multiplayer. 

Link to comment
Share on other sites

Yes you can do this and it works great. You will not be able to get lag free movements though using serb sockets unfortunately. They use TCP connections which are really quite bad for latency effected real time applications.

 

If you are making an rpg, or another game where a little bit of lag doesn't matter too much, you can store a buffer of the other players last positions and then tween between them. This can help to smooth out the movement quite nicely as it helps prevent position jumps caused by suddenly receiving a burst of TCP packets. 

Link to comment
Share on other sites

Yes, you can do it, though you'll have to be able to make a lot of the interconnecting game/server parts yourself.

Furthermore, I strongly recommend primus as opposed to Socket.io. (Primus has better support, works better, is faster, is actually updated, etc.)


I am currently working on a multiplayer project, and I hope to be able to extract a good amount of it into a library, or at least a very comprehensive tutorial, in the future.

Link to comment
Share on other sites

  • 8 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...