Using WebSockets to develop HTML5 multiplayer games. What to choose, Node.js, or Ratchet, or another?

I did some research before asking this question, but I could not find a concrete answer to my situation. I'm still new to developing WebSockets and games, so I can't explain some details very well, and if so, tell me so that I can try to explain it better.

I am currently developing a web application using CakePHP that will provide several types of multiplayer HTML5 games. In some situations, these games will need to send data to the database. The problem is that I want to use Node.js to implement the logic on the server side of the game, but I'm not sure that I can transfer data to the database. I think the best approach would be to send data from Node.js to a PHP action, which will then store it in the database, but I also don't know if this will be possible.

I found something about this DNode , but I'm not sure if this is the answer to my problem, and besides, it seems to be in beta, which I would like to avoid.

As an alternative, I thought about using Ratchet to implement logic on the server side of the games. At least I know that I can get him to communicate with my application, but since I cannot find a link to it in game development, I'm not sure if this is a good idea.

I do not know any other frameworks, so if I have better options than these two, tell me :)

Please give me your opinion. Thanks!

+6
source share
2 answers

I ran into a similar problem a year ago while trying to develop a multiplayer online game. I ended up using Node.js for the server and Socket.io for websites

If you are new to Node.js, I recommend that you read this short and good basic tutorial first:

http://www.nodebeginner.org/

I use Node.js every day, and I really find it very useful and productive. When you're done reading the basics, read this nice tutorial on developing html5 multiplayer games using node and sockets: http://smus.com/multiplayer-html5-games-with-node/

At the end, there is a link to an open source game that may be useful to you.

And you can check the .io docs socket here: http://socket.io/

Hope this helps, so you can get started. This is the hardest part.

+6
source

Did you consider Node.js + Lightstreamer instead of socket.io? Simone Fabiano recently released an apple-to-apple data transfer comparison with socket.io (messages created on the server side and sent to more than 4 thousand clients worked on two Amazon EC2 Machines), and it turned out that it is able to scale better than regular web ports with socket.io in CPU usage, latency and bandwidth consumption, as well as some other useful features to improve overall performance.

In particular, Lightstreamer can be used with great advantages for any multi-player games: see also this article ( Optimizing a multi-player game of a 3D game over the Internet ), you can take an online demo of a simple multi-player 3D world in which Lightstreamer is integrated to synchronize in real time. The demo allows you to configure each script parameter and simulate any taste of data delivery, checking the actual bandwidth consumption.

A complete set of code for test suite and demos are available for free on GitHub.

[full disclosure: I work for Lightstreamer]

0
source

All Articles