V
V
Victor P.2018-06-28 17:26:36
JavaScript
Victor P., 2018-06-28 17:26:36

How are dynamic multiplayer games written in html5?

Good afternoon!
I have always been involved in web programming and, as it seems to me, my brain has already turned into the "request-response" logic. That is, in fact, I can make any game in the browser, but only if it is STEP-BY-STEP.
When html5 appeared, I saw some simple sketches, like tanks. And everything seems to be clear, and the idea has already come that the old console games (dandy, now) can now be safely transferred to html5. But all these games are for one.
And then I realized with horror that I don’t even have ideas how to make dynamic multiplayer games.
Here's an example: there's a map that fits the size of the screen. On it in the center is your island and some mobs are scattered around the map. You can send a ship after some mob and it sails in real time, let's say 2 minutes there and 2 minutes back. While your ship is sailing, another player can view other people's cards and, if he opens your card, he will see your ship sailing somewhere.
I don’t understand the timing here, that is, the second player, when opening your map, should receive information from the server about which ship left the harbor on which tick, what speed it has. And on the second client, recalculate the route and draw it? Is that how it works?
Then, the second player can attack your fleet, he has his own ship and he can select your ship and press the "attack" button, then his ship is also not very fast, say, swim for a minute, it will swim across.
These actions must be sent back to the server and display to you that they want to attack the ship.
You can cancel the navigation of your ship, then the enemy ship will not be able to chase you, it will turn around and swim back.
If it was a solo game, no problem, but there are a lot of timings (plus there may still be other players who will also look at it and who can also send their ships). And how to synchronize all this, given that there are lags in time, is completely incomprehensible to me.
Not so long ago I got acquainted with Angular. But, I repeat, I have no idea how to start doing all this.
The question is, is it possible to make such a game in Angular (well, or another client framework)? Is it possible in principle? And in what direction do you dig? It will be magical if there are any examples or tutorial sites in this particular vein?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Stroykin, 2018-06-28
@Jeer

Here is an example of the implementation of the game for two - link using Angular and Pusher

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question