Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been thinking about a game which would have an AI, and the AI would ideally do extensive calculations thinking many turns in advance. I am curious if there is some way to put most of the burden of the AI calculations on the client while still preventing cheating. Obviously some processing has to be done on the server, but is there a way to find some happy middle?

share|improve this question
Is it a multiplayer or a singleplayer game? Is there one AI which plays against all players, or does each player compete against another AI instance? When it's a multiplayer game, how close do the players interact? – Philipp Dec 7 '12 at 9:19
up vote 4 down vote accepted

You are right that when a client does the AI calculations for its own player, it's an invitation for cheating. But what you could do, is make each client do the AI computations for randomly chosen other players.

Players could then still screw with the games of others, but as long as the computation tasks are sufficiently anonymized, there would be no incentive for them to do so. Should this still be a problem, you could send each computation task to three different random clients, and kick the one which returns a result different from the two others. That way a cheater needs at least two clients which cooperate AND be lucky enough that the server randomly assigns them the same computation task which ALSO happens to be worth manipulating.

share|improve this answer
+1 So, essentially, peer-to-peer. – Arcane Engineer Dec 7 '12 at 9:55
On the logical layer, yes. But on the physical layer, I would still do all the communication over the server. Having the clients connect to each other directly means a lot of additional problems to solve. NAT, Firewalls, privacy issues due to players knowing each others IP addresses etc. – Philipp Dec 7 '12 at 10:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.