0

I have a game I am working on that is client/server (fully authoritative). The game is not FPS or MMORPG. More like Clash of Clans where you can see other people's attacks, chat, manage your resources etc but no real-time players in the same battle/attack.

Nothing is saved on the client's phone (other than its uniqueID). So when it logs in, the server sends the player's current state/data.

Now, if the client wants to do something (move a unit, collect coins, start building something, etc)

The server will validate everything, of course, to prevent cheating.

However, I see 2 approaches:

1: No acknowledgment from the server

  • The client decides to do something, it is automatically applied on the client's side and it sends this information to the server.
  • The server validates the action. If it is legal, store the new information and do nothing.
  • No acknowledgment is sent to the client
  • The client was not waiting for acknowledgment either.
  • If the action was not valid (it means the client was cheating). The server does not save the state and close the connection.

2: Fully acknowledged

  • The client decides to do something, it sends this information to the server and waits (nothing happens on the client at the moment)
  • The server validates the action. If it is legal, store the new information.
  • Server sends the acknowledgment + the new state to the client.
  • The client then applies the new state.
  • If the action was not valid, it does not store the new information and sends an "invalid action" to the client. It can also decide to close the connection.

Option 1 reduces considerably the traffic between the client and server, plus the player does not feel "lags" when doing an action. And it does not remove the authoritative validation of the server.

Option 2 makes it more "legit" in the sense the client can never "see" an illegal move and the server always acknowledge something before the client can see it.

I assume most FPS will use something closer to option 2, but since it is not real-time I would assume option 1 would be ideal.

Any reason option 1 would cause an issue and I should go for option 2?

Bew Games
  • 11
  • 2

0 Answers0