Ardi
Ardi

Reputation: 161

How to prevent duplicate server calls on game logic (multiplayer)?

So I have a game that runs on runs on html5 canvas using a game engine (ImpactJS to be exact, yeah too old)

And I have this scenario where:

After a set time (i.e. 15 seconds), game will communicate to the server.

IF:

Player A made the call, player B should not be able to make another one. Vice versa.

What I tried to do is to set a flag whenever a player makes the call to try and prevent the other player to make a new one, but I am having a problem if both players make the call at the same time

Is my only option is to make the timing come from the server, not the client (players)?

Do note also that the engine's update function runs 60/s or depending on the fps capability of the device.

Upvotes: 1

Views: 61

Answers (0)

Related Questions