8Observer8

Phaser and mutiplayer

Recommended Posts

On 27.09.2016 at 3:05 PM, megmut said:

Here's one that appears to be a good read. http://rainingchain.com/tutorial/nodejs

This is very nice lectures!

I found this book: Multiplayer Game Development with HTML5 and Node.js

The book has 180 sheets only, but I think this book is one of the best.

I will create multiplayer Snake Game in Phaser and Node.js

Share this post


Link to post
Share on other sites

I think it is useful book: Multiplayer Game Programming: Architecting Networked Games (Game Design)

How do you think maybe Phaser is not good for multiplayer games? Maybe PixiJS is better? Because the client must only draws things and sends key press messages.

Must I check collision detections only on the server? Is there a gameLoop only on the server? How do you think?

Share this post


Link to post
Share on other sites

It will probably depend on the complexity of your game, but I don't think you will find much difference between Phaser and PixiJS on this front. In other words, I doubt Phaser or PixiJS will be your bottleneck.

A game loop would still exist on your clients (again depending on the complexity of your game). The server should also act as a form of input validation - should that user really be travelling 10x the normal speed? etc

 

 

 

Share this post


Link to post
Share on other sites
On 29/12/2016 at 5:25 AM, cjke said:

I don't think you will find much difference between Phaser and PixiJS on this front

I think so too, because Phaser has the update function for the synchronization.

On 29/12/2016 at 5:25 AM, cjke said:

It will probably depend on the complexity of your game

I started to make a game that based on Battle City. I will make it only for learning the programming of the real time multiplayer games. It is not simple like Checkers, TicTacToe and so on. It is a real time multiplayer with shooting. Maybe this article will help me to start: http://buildnewgames.com/real-time-multiplayer/

Share this post


Link to post
Share on other sites

not sure if it helps, but I am using the phaser signals as a publish/subscriber type pattern. I setup a subscriber to handle specific event types and then in the websocket I have a switch that triggers these events.

//Inside of my login state
Signal.add(function (type, data) {
  if (type != Events.LoginEvent) return;
  //do stuff here like check data message to see if login was successful
  //switch the state
  //show validation message
});


//Inside of my onmessage websocket function
switch(messagetype){
  case 1:
  var obj = JSON.parse(event.data);
  Signal.dispatch(Events.LoginEvent, obj);
  break;
}

 

Share this post


Link to post
Share on other sites

No need for real synchronization if actions are all standardized. For movement have your client update its position on the server every tick in the update funciton, have the server send that to all other clients, and all other clients just keep setting that players position. (Just set it, rather than set velocities and such). If you have a function to say shoot. Have the function that handle's it for your client be the same thing that handles it when another client shoots. So its all standardized and you dont ahve to worry about syncing it up perfectly. 

Really this question is just too broad for a good answer. Read some tutorials and think logically about how you could have the same thing happen on multiple screens. All the tools you need are there. 

Share this post


Link to post
Share on other sites
On 12/24/2016 at 11:24 AM, 8Observer8 said:

How do you think maybe Phaser is not good for multiplayer games? Maybe PixiJS is better? Because the client must only draws things and sends key press messages.

In all honesty, I've moved away from Phaser to PixiJS for all my game dev projects. The performance increase is phenomenal! I still use Phaser for prototyping as it's very quick to dev. With regards to phaser vs pixi for multiplayer, it really doesn't matter. Your bottleneck will always be the latency between the client and your server. If you are aiming for low end devices, then you can always install box2d on your server, and let the server handle the physics, but that could always end badly if client has ery poor connection. 

Your best bet, is probably prototype something quickly in phaser knowing full well it's not going to production build. Get to grips with the multiplayer and then take what you learnt and build a development process / schedule.

On 2/2/2017 at 9:58 AM, 8Observer8 said:

What do you think about this example? I deployed it on heroku.

Live demo: http://battle-world.herokuapp.com/?debug

Source: https://github.com/FuzzYspo0N/realtime-multiplayer-in-html5

Can I use this server for my Tanks2D game in Phaser?

That's a really good demo on heroku! I love that you can actually check to see what the server position is!

with regards to the github repo you linked, I think you are better off creating your own. The core lib hasn't been updated for 5 years and the chances of you finding something that's 100% suited to your needs is slim to none.

If you want something with a lot more stability and features, you can always have a look at Heroic Labs - https://heroiclabs.com/ It's open source and I've heard great things about it. Can't say I've used it myself though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.