Skip to main content
added 897 characters in body
Source Link
Vaughan Hilts
  • 5.5k
  • 1
  • 34
  • 58

Generally, this advice is given not because of abstraction or code cleanliness but rather because gameplay logic that is sensitive must be simulated by an authorative server to prevent cheating and hacking. Long story short: If you don't particularly care about players hacking their score - don't bother.

If your game is multiplayer, then you should looking into making the client nothing but a "dumb terminal" and display for the game. Generally, this involves the client only sending inputs and actions to the server, and the server sends the results back to the entities that may be interested in his result. You can look at this article for getting started with socket.io.

It's a broad topic and tough to cover in this answer but the gist of the idea is that. For example, instead of just moving and telling every other player "I got 100 points"... you instead send "I shot", and the server simulates your shot. Then, when the server sees someone was "shot" then it sends a result back to all other players who may be interested that this object was shot, so something can explode, the killer can get points etc.

Generally, this advice is given not because of abstraction or code cleanliness but rather because gameplay logic that is sensitive must be simulated by an authorative server to prevent cheating and hacking. Long story short: If you don't particularly care about players hacking their score - don't bother.

Generally, this advice is given not because of abstraction or code cleanliness but rather because gameplay logic that is sensitive must be simulated by an authorative server to prevent cheating and hacking. Long story short: If you don't particularly care about players hacking their score - don't bother.

If your game is multiplayer, then you should looking into making the client nothing but a "dumb terminal" and display for the game. Generally, this involves the client only sending inputs and actions to the server, and the server sends the results back to the entities that may be interested in his result. You can look at this article for getting started with socket.io.

It's a broad topic and tough to cover in this answer but the gist of the idea is that. For example, instead of just moving and telling every other player "I got 100 points"... you instead send "I shot", and the server simulates your shot. Then, when the server sees someone was "shot" then it sends a result back to all other players who may be interested that this object was shot, so something can explode, the killer can get points etc.

Source Link
Vaughan Hilts
  • 5.5k
  • 1
  • 34
  • 58

Generally, this advice is given not because of abstraction or code cleanliness but rather because gameplay logic that is sensitive must be simulated by an authorative server to prevent cheating and hacking. Long story short: If you don't particularly care about players hacking their score - don't bother.