# Implementing an efficient method of server-side checking [closed]

I'm making a web-based action RPG game. I don't want players to cheat, but I also don't want the game to constantly pause to wait for the server to respond. I made it so the game is played on the client-side (for responsiveness) and the server does routine checking to validate the game state. But the system is very cumbersome. The server has to calculate every single frame and compare the entire game state to the game state sent from the client. If anything in the game states are different form each other, the server kicks the player off. However, this means the game has to send 30 requests a second, and the server must calculate it all in time. If many people are playing the game, I don't think my one free Heroku dyno can handle that. How do I implement an efficient and elegant way of validating players' moves on the server side?

## closed as too broad by DMGregory♦May 3 '18 at 12:02

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• The server does not validate the state from the client, it receives the input from the client, perform the simulation and checks (while the client 'guesses' what the server will send) and sends the state back to the client, then the client validate its own state w.r.t. what it received from the server and subtly adjusts the game objects so that the simulation looks smooth. See articles such as Source Multiplayer Networking. – Alexandre Vaillancourt Apr 17 '17 at 2:18
• @AlexandreVaillancourt that is definitely the most popular design in gaming, though I would not agree other approaches, like the one in this question, to be invalid (that also doesnt it is a good idea). – wondra Apr 17 '17 at 10:27
• How big is the entire game state? – wondra Apr 17 '17 at 10:36
• Can you clarify, does your game include synchronous multiplayer, or are the frequent updates to the server solely for validating that each player is not cheating, rather than replicating player actions to other players? You can get away with even more minimal server involvement if you're not doing replication. – DMGregory Apr 17 '17 at 12:20
• However, this means the game has to send 30 requests a second, and the server must calculate it all in time.. Sounds like you're doing something terribly wrong here. Optimize your code so the client send all the data in 1 request. Do the check once every while (example every 5 min), not every second. Assume 99% of your game players are non-cheaters. If you really need to check the client state every second for every player, you should consider using "websockets" for real-time connection – evilReiko Oct 4 '17 at 5:48