- Home /
How often should a webplayer communicate with the server?
I am making a game that involves players having an account on a website that keeps track of their credits, which can be used to purchase items in the game. I want to know How to go about this as far as how often the game checks the database to see if the player really does have the items that the webplayer thinks they have. Should I just download the database variables at the start of the game? Or at the beginning of each level? I would like some advice on this please.
Thank you guys for your input. So i assume that the same rule applies to verifying that the player really does own the weapons he says he does? So that should also be verified everytime a level starts and they attempt to wield the new weapon they just bought.
Answer by LPGaming-Company · Jan 20, 2013 at 09:03 AM
You should ask the server every time that a transaction is trying to be made, make sure to verify the amount of credits the client says he has. If you don't..... Well tell me where I can play your game and I will have infinite credits in 2 minutes. :3
Answer by Loius · Jan 20, 2013 at 08:15 AM
Not really Unity-specific, but you have to always check the server. Rule of thumb is: the client is ALWAYS lying. Only the server is telling the truth. If the client says it has 800 credits, that is a lie. Ask the server for the truth.