Salutations ! I am posting this because I have a logic problem.
Let’s say I have a game where you have to guess which number is in a square that is inside an array of 9 squares, based on the numbers in other squares. Whenever you click on a square, it reveals a number. One of the squares is bad, and if you reveal it, you lose.
You need to generate the array, make the player answer, then return the number or make the player lose.
My question is, what is the best way to achieve the thing you need to do above?
I have 2 options:
Generate the array on the server, create squares on client, get the square client clicked, check if square is bad on server, return number that was inside that square.
Generate array on client, check on client, and return on client.
My worries are that:
Exploiters can see the array if it is generated on client, and cheat.
The process of generating an array will consume too much processing power on the server.
That game was just an example. I am in need of a solution for a game with much more squares, and not just guessing based off other squares, and more than 35 players.
I also have a third option:
Generate array on a random client, generate squares on another client for it to give answers, and check them on the random client.
I’m not sure if it is possible.
So, should I go with option 1,2 or 3 (if it works) ?
Thanks for your time.
Create array on server, so the exploiter can’t see the results nor see them! And you don’t wanna fire them to the clients, here is a better solution
When the client clicks on one of the squares that square’s number (or placement) will be fired to the server! We don’t wanna fire the results to the client and check if the met square is bad in the client beacuse then an exploiter will be able to check it out.
You recieve the square’s number from the server and check there if it was bad, if it was bad you fire back again to the client to display that he lost, if it wasn’t bad, you can fire the square’s number.
It is always wise to check values and generate them on the server! The server is like a wall that no exploiter can pass, anything done there ins invisible for exploiters.
I forgot to add the the checking is done on the server in the first solution, sorry.
I will consider this the solution unless I get a solution that cuts down on the performance of the servers, as that’s my main concern, thanks !
And also you did mention “performance” which is an important part! Chosing to do things in the server or the client is basically the choice of either chosing security or performance.
If you handle on client, instant performance, bad security
If you handle on server, less responsivness, great security
In your case, 100% go for doing things on the server! You don’t really need performance here it’s just comparing values + you need some good security for this
Latency can definitely be annoying, but there are clever ways to hide latency and make the experience just as responsive for the player as if the checking was done ton the client.
The point is to provide instant feedback to the player. This could be as simple as playing a sound when you click the square, or an animation like the square flipping (like a card) to reveal the number. By providing instant feedback through things like animations, you could also quite easily turn the latency into suspense as the players waits to see if their answer was correct or not, if the rewards/punishments are engaging enough.
Latency should not be very limiting at all for something like this if you provide instant feedback.