Comments on: How to make a multiplayer online game with Phaser, Socket.io and Node.js https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/ Tue, 13 Feb 2018 13:38:00 +0000 hourly 1 https://wordpress.org/?v=5.8.10 By: whiteadi https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-84 Tue, 13 Feb 2018 13:38:00 +0000 http://35.156.160.236/?p=52#comment-84 Nice base!

]]>
By: Geoffrey Mégardon https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-81 Thu, 14 Dec 2017 11:59:00 +0000 http://35.156.160.236/?p=52#comment-81 In reply to Jérôme Rx.

Ok, I see now 🙂
I also found this useful video here:

if that can help someone else 🙂

I am now wondering if, for small coop games, there is a way to use one of the client as the server.

Good luck with your game 🙂 !

]]>
By: Jérôme Rx https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-80 Thu, 14 Dec 2017 11:50:00 +0000 http://35.156.160.236/?p=52#comment-80 In reply to Geoffrey Mégardon.

Nope I didn’t modify anything, but indeed I had to run server.js on Heroku for the networking aspect. On Itch.io, you can indeed host an HTML5 game, but it’ll simply load in your browser the files for the client, making your browser the “client desktop app” I was referring to earlier. It’s fine for solo games, but if you want multiplayer you need a central server to handle it, and I see no indication that Itch.io handles it itself. So on in the case of Itch.io, you would need to upload the client to Itch and the server to something else (Amazon, Heroku…).
I’m quite busy with my own game at the moment but a tutorial on this would be quite a good idea so I’ll try to find time for that!

]]>
By: Geoffrey Mégardon https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-79 Thu, 14 Dec 2017 11:19:00 +0000 http://35.156.160.236/?p=52#comment-79 In reply to Jérôme Rx.

Thanks for your answer!

So, in fact, it seems that Itch can host HTML5 games that you can play in the browser:
https://itch.io/docs/creators/html5
So my question was more about how to make the game in this tutorial works when hosted online?

For instance, when I clicked on your link: https://basic-mmo-phaser.herokuapp.com, your game works. Did you add/modify anything to the code in this tutorial to make it work?
I think, this is something to do with running ‘server.js’ before to run the game. I guess ‘server.js’ could be run either on a remote server or on one of the client machines.

So indeed, a tutorial on how to host a Node.js game on Heroku would definitely help 😀

]]>
By: Jérôme Rx https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-78 Wed, 13 Dec 2017 22:19:00 +0000 http://35.156.160.236/?p=52#comment-78 In reply to Geoffrey Mégardon.

I don’t have experience yet with Itch, but my understanding is that they distribute their games as desktop apps. In the case of online games, these desktop apps would correspond to the client apps, who then have to connect to the server. It seems very likely to me that Itch has nothing to do with the server-side, and that the game dev has to maintain it by himself (I expect it to be the same with Steam). If that’s indeed the case, then any solution could work, including using a Heroku server like I do. I could make a tutorial about how to host a Node.js game on Heroku, that would probably be useful! But then you still need to provide a desktop client app to Itch/Steam. About that, I invite you to read this post I wrote: https://www.dynetisgames.com/2017/08/21/westward-dev-log-3-making-desktop-app/ . This may help you see better how to package a Phaser game as a desktop app. Maybe I should make a tutorial about that as well in the future!
Let me know if this doesn’t answer your question, or if you think I got it wrong about how multiplayer games are handled by Itch! 😉

]]>
By: Geoffrey Mégardon https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-77 Wed, 13 Dec 2017 20:18:00 +0000 http://35.156.160.236/?p=52#comment-77 Hi,
Really good tutorial, I learnt a lot!

I tried to upload the result on itch.io to see if it could run while being hosted online, but it does not work: the game and the map are loaded, but no players are created. My guess is that, when the game is on an online server (on itch.io in this case), the server.js script is not started (nobody is there to run ‘node server.js’ in the terminal of the online server). Plus, I guess that if the game is hosted online, I also need to change the port at which server.js is listening?

In short, I think it could be a nice addition to this tutorial if you could explain how to make the game run when hosted on an actual web server (maybe itch.io is not a good one?).

Thank you again for the tutorial 🙂

]]>
By: Nicolas Naranjo https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-74 Wed, 08 Nov 2017 05:12:00 +0000 http://35.156.160.236/?p=52#comment-74 In reply to Jérôme Rx.

It was a parsing problem with the json file but a friend of mine already solved it. Thanks for the aid. Great tutorial

]]>
By: Jérôme Rx https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-73 Tue, 07 Nov 2017 13:29:00 +0000 http://35.156.160.236/?p=52#comment-73 In reply to Nicolas Naranjo.

Yes I’m using the minified version, hence the extension .min.js.Minified libraries are more compact and thus load faster, but are very inconvenient to debug. Instead you can grab from the Phaser repo the non-minified version of Phaser and use it instead. This is the preferred thing to do in development. Let me know if you don’t find the right files or don’t manage to do the swap. 😉

]]>
By: Nicolas Naranjo https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-72 Tue, 07 Nov 2017 01:05:00 +0000 http://35.156.160.236/?p=52#comment-72 In reply to Jérôme Rx.

Okay thanks. I’ll post as soon as I get back in town. I’m not that familiar with Phaser. What do you mean by non-minified Phaser file? I’m currently using the one you have on your Github link

]]>
By: Jérôme Rx https://www.dynetisgames.com/2017/03/06/how-to-make-a-multiplayer-online-game-with-phaser-socket-io-and-node-js/#comment-71 Mon, 06 Nov 2017 09:48:00 +0000 http://35.156.160.236/?p=52#comment-71 In reply to Nicolas Naranjo.

Hi Nicolas,
Could you try using the non-minified Phaser file? That way we can see on what line something goes wrong.
But normally it should go well, Tiled exports valid JSON files so the parsing should be ok. We’ll know more with the error line.

]]>