Answer the question
In order to leave comments, you need to log in
What is the best way to write the server part of an online browser game in HTML5?
I plan to create a browser game of the "online RPG" genre (something like nebogame.com/). The client part will be on html5 + Phaser engine. But I did not dare about the server part. It will be necessary to update the information on the page every at least every 300-500 ms. The database will be mysql. At first I thought to update the state using ajax requests to php scripts. but it seems to me that it will be very hard for the server and not efficient at all.
From languages I know only php, js.
Answer the question
In order to leave comments, you need to log in
Usually, a dedicated real-time server is used to update data, which does not contain game logic, but only sends messages via a web socket or another option. Look towards Socket.IO. The main game in PHP, from where events are only sent to clients. Redis (Pub/Sub) is used to communicate between them.
On whatever you want, in your case php/nodejs. php, socket.io + queues will do.
I decided to use a third-party service - gamesparks - as a server part. There are a bunch of other analogues of baas. True, I have Blend4Web as a client. At least there are no such problems as described by copal in the comment. The engine is being actively developed by our Russian programmers.
As for the server part, for me it is better to pay a small amount to professionals than to spend a lot of time and even more money on your server. Many baas also have free-tariffs, which are more than enough to run and launch the game.
update
Here are links to b4w games:
https://www.blend4web.com/ru/tag/47/1/
Or this author writes a lot about b4w:
habrahabr.ru/users/prand/topics
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question