smallon08

phaser for real time multi-player game?

Recommended Posts

Is it possible for me to build a real time multi-player game together with something like socket.io(node.js)?

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

Share this post


Link to post
Share on other sites

As @photonstorm said once it's not possible yet as pixi.js doesn't include this feature, but maybe in the future it will be possible to manage multiple cameras.

 

It is possible if you use RenderTexture.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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!!

Share this post


Link to post
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. 

Share this post


Link to post
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. 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.