Something to read on the development server for a browser game?

Hello!

Set a goal to write a browser-based online turn — based strategy game.
On the client, HTML5, JS. About the server not yet decided.
Advise the literature (articles, books) on the development of the backend for this task.

p.s. what technologies would you choose?
October 7th 19 at 15:36
5 answers
October 7th 19 at 15:38
VitaZheltyakov, no, I'm just saying that the server role is not to
The role of the server in the browser game is simple — make the customer request, to query the database and return the response to the client.

Just such reasoning, any problem will boil down to 1/2/5/50 queries to the database :) I'm not familiar with the structure of your game, but besides that I have written there are a number of tasks. For example, in my opinion, it makes no sense to store in the database the maximum level of lives of the player, I keep only the current one. And the maximum is calculated by various algorithms on the basis of other characteristics. And such aspect a whole bunch. The calculation on the client at best just duplicates the functionality of a server, in some cases, it's redundant. Above are Fally described a little structure to your game, I did the same thing. In my case, the client requested the state of an object, for example the enemy in battle, and received a json response with the desired characteristics, based on which the client would display the state of the object.
Sorry, this is a response to a comment to the previous answer. - Akeem.Murray commented on October 7th 19 at 15:41
"Just such reasoning, any problem will boil down to 1/2/5/50 queries to the database"
— No more than 5 requests. From turn-based games the logic is simple.

"In my case, the client requested the state of an object, for example the enemy in battle, and received a json response with the desired characteristics, based on which the client would display the state of the object"
Why? Why just before the battle, not to transfer all the necessary data and then transmit only the changes (if any)?

Regarding approaches:
See here the growing dispute "Thin client vs fat client". My arguments in favor of a fat client:
— Easy to debug and develop, because everything is visible on the client.
— Less queries.
— Double check the data.

I await your arguments in favor of thin client? - eloise_Hahn commented on October 7th 19 at 15:44
I think we have a little debate about the other goes :) I'm just inclined to think that the game mechanics pointless to count on the client. It is expensive and not safe. Let's consider a simple case: we have the duel between 2 players. When the page loads we have the data about both players.
In your case, after one player attacks another, we expect the resulting damage to the client, we expect the updated standard of living of the attacked player and send it to the server to update the database. At least I understand your position.
My position is that the player's attack produces the action by sending the server a request (let it be a POST /attack/userID). The server looks for the player with ID equal to userID, calculates the damage and updates the settings of both players, and then sends back the updated data of both players in json format. Well, even if it sends only the changed data for the request, this fact does not change :) Sorry, if you do not understand your arguments. - Akeem.Murray commented on October 7th 19 at 15:47
You do not understand me correctly.
Let's say we have a duel between 2 players. When the page loads we have the data about both players. One player attacks the other. The client calculates can he do and how he will do it. If he can do it, only then send the request to. The server receives the request, checks if a player can perform this action by using the same algorithms as on the client (as he does no matter), calculates the results, or confirms the action, puts the result in turn of a distribution to all players. Etc.
The difference is that:
Extra requests are made;
— Calculations on the server how to perform an action, no. - eloise_Hahn commented on October 7th 19 at 15:50
Then I really misunderstood. Actually I have work organized in a similar way. For example, the inventory items are collection backbone.js to drag and drop items use draggable/droppable from jquery ui. When you drag the object on the client are checked available slots are highlighted. After the player will drop the item in a certain slot, generate a call to the server. The server makes the necessary calculations and returns the updated features of the player (if necessary, for example we put predmet equipment), or a response code 200 (if we just moved the object in the neighboring slot of the inventory). - Akeem.Murray commented on October 7th 19 at 15:53
October 7th 19 at 15:40
sources to read, you have github.com/tlhunter/Cobalt-Calibur-3
I saw a few open
October 7th 19 at 15:42
I write on the tornado, if you want to process and output data in real time or on django, if such functionality is not required. In fact in the second case can come any other language/framework on which it is possible to create web applications.
October 7th 19 at 15:44
And what is there to read?

All basic calculations are on the client. The role of the server in the browser game is simple — make the customer request, to query the database and return the response to the client. If you understand how the client works, the server no problems.
This assertion is based on personal experience.

About the technology:
Now write turn-based MMORPG in PHP. In the future I plan to abandon the PHP side Node.js because of the sockets.
Please cons to justify their decision. - Akeem.Murray commented on October 7th 19 at 15:47
I do not agree with you for one reason — the server must always validate client data for validity. Without this cheating in your Kingdom will blossom and smell. - eloise_Hahn commented on October 7th 19 at 15:50
On the server the same data validation that client. Accordingly, the first written data validation on the client (because it is convenient to debug), and then duplicated on the server. Rewrite the code from one PL to another is not difficulty. Therefore, the complexity of server-side developing browser games low and reduced to elementary actions. - Akeem.Murray commented on October 7th 19 at 15:53
Well, let's say when we wrote the play, we had a thin client that implemented only the display of Informatii from the server and interfaces to different actions. All processing of agrologic happened and validatevalue on the server, so to say that the customer is basic, especially in MMORPGs — it's less weird - eloise_Hahn commented on October 7th 19 at 15:56
Fally, and your browser-based MMORPGs? Because the thin client is used, in my experience, only in games with individual applications, or people made these games. - Akeem.Murray commented on October 7th 19 at 15:59
Did a single-page browser-based RPG. I can confidently say that even a banal action "to put an item from inventory to equipment" leads to rather complex calculations. Required:
1. To check availability of item with specified ID in the player's inventory;
2. To verify the possibility of using this object by the player in the level/profession;
3. To update a record object to change the container in which it is placed;
4. To recalculate all the characteristics of the player based on the characteristics of the subject;
5. Send the player the updated features;
The fifth item can be canceled if we have the client there are characteristics of the subject, in other respects, will in any case need to check. - eloise_Hahn commented on October 7th 19 at 16:02
damirazo, You name complex: 2 database query, the results are compared with sessionname data and building the response based on that?
This elementary action. On the client occur (should occur) the same actions for + rendering. - Lester_Bogisich commented on October 7th 19 at 16:05
VitaZheltyakov, Yes, social programs at the time was doing calculations on the client is better not to, because you can get out of sync and other pleasures. What You and the users will add such hemorrhoids, that Mama do not cry.
Well our team has experience in the games before that wasn't so rake walk up enough, and found optimal methods for developing games and solving problems.
Well, of course, that's just my IMHO, backed up by real project, perhaps there were easier ways to solve our problems. - eloise_Hahn commented on October 7th 19 at 16:08
Very strange. Desyncs can be obtained if the client is acting without the confirmation of the server. I suspect that You have little idea how the thick client. - Grayce.Hudson commented on October 7th 19 at 16:11
October 7th 19 at 15:46
A very interesting option is the Smart Fox Server. A lot of problems there are solved. There is API for as3, unity 3d and a couple more. You can also extend the functionality of the rooms Java class names or Python. There is a convenient admin panel. Tutorials are included.

Find more questions by tags BrowsersBackendIT educationDevelopment of games