Hi! Welcome to the Developer Forum!
Okay, so in your post you’ve given two options to consider. Let’s look at the pros and cons of both!
Everything on the server:
- Client can’t easily manipulate the game to reward themselves (not easy to exploit)
- Less confusing as you don’t have to worry about sending data between the client and server
- Could put more stress on the server, and this could cause negative effects depending on how much the server is doing.
Client handles game, reports back to server
- Less work for the server to do
- Can add more effects on a single player’s screen
- Involves logic behind controlling both server and client
- Could be easily exploitable
Right. These sound like great options but they both have negatives, which we don’t want.
I think the best option here is a variant of the second option - let the server handle when each order is made and finishes, and let the client handle everything like animations. The most important thing here is to keep your mind thinking about how you structure your code. You want to minimize the amount of vulnerabilities that a theoretical exploiter could take advantage of.
I would generate orders on the server, send the necessary information to the client, have the client send a message to the server to say it’s done and then have the server validate this to check for exploiters. For example, the server could check if a certain amount of time has passed and determine if the client performed the minigame too fast. If they have, they have exploited.
If the player has to pick different ingredients then consider letting the server know everytime the client picks up a new ingredient so it can keep a track of the food each player has. If the client tells the server it has finished making a hamburger, but the player hasn’t picked up the burger or the bun (or the… ham? ) then they are exploiting.
To conclude, letting the client handle some of the work isn’t a horrible idea and can lesson the work done by the server. But, you should also double check everything the client tells the server (Dont trust anything the client says!). You could check a certain amount of time has passed or the player has the right ingredients to proceed.
Hope you find a good solution, good luck!