Forums

Client-Server communication

Hello,

I'm making an online snake game where each user should have a separate game instance. The game itself runs on the server. However, I've run into a roadblock:

How do I update the client data (that is kept updated on the server) efficiently? As web sockets are not available, I can only use the HTTP communication. However, I have to make a request every .5 seconds, as that's how fast the game updates. The server sometimes doesn't keep up as it's also making changes to the games simultaneously.

The reason why I'm running the game on the server is to keep it safe as it's intended for a product launch/giveaway.

Should I just resort to writing the game on the client and obfuscating it to "secure" it?

Thanks.

Maybe you could keep the game state on the server to avoid manipulations of it, but still decrease the frequency of requests. For example, you could batch data and only make a request every X steps. Then you could have some validation on the server side to make sure that it's legitimate.