0
\$\begingroup\$

I am creating a RTS with Unity/C#, and have noticed a problem synchronising build queues. Is there an ideal solution to handle button prediction?

I think I may have overengineered the solution... Presently when the client clicks a button, it sends a request to the server. The server validates the request (cost if applicable) and then returns the order to create the build queue item. Consequently, when the client clicks a button there's a noticeable lag.

Is server validation for button presses, like build queues, in a client-server model overkill? What would be the ideal solution?

\$\endgroup\$
6
  • \$\begingroup\$ Can you give an example of a case when a queue operation should fail, based on information the client doesn't yet know? \$\endgroup\$ Commented Aug 28, 2018 at 16:09
  • \$\begingroup\$ @DMGregory I would assume if someone tried to cheat on a client. Are you saying practically speaking there really shouldn't be any fail cases? \$\endgroup\$ Commented Aug 28, 2018 at 16:11
  • 1
    \$\begingroup\$ If the player has modified the client to cheat, they can modify it to show whatever the heck they want on their screen — including showing the item in queue even if the server says no. So your validation isn't there for the cheaters' benefit. It's for the benefit of the ones who are playing by the rules, ensuring they see a consistent game state and that other players' cheating attempts can't impact their game. So, for client-side features, your main concern is that your data may be out of date (eg. if another player recently stole resources from me so I can't afford the item I'm queuing) \$\endgroup\$ Commented Aug 28, 2018 at 16:26
  • \$\begingroup\$ @DMGregory It seems like what you're saying could be an answer? \$\endgroup\$ Commented Aug 28, 2018 at 18:00
  • \$\begingroup\$ It's meant to be a question. What situations do you have in your game where a non-cheating client might fail to queue an item? Knowing that, we can help you design a system that correctly handles those failure cases. \$\endgroup\$ Commented Aug 28, 2018 at 18:09

0

You must log in to answer this question.