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

In almost every game I've come across that includes a dark situation designed to change the way a user interacts with the environment, there are always some players who turn up their monitor's gamma correction in order to negate the desired effect.

Is there a way to prevent users from adjusting their gamma correction to 'cheat' their way out of a challenge? (the darkness)

I'd imagine if you could reliably retrieve the current gamma correction of the user's monitor, you could use that to more or less prevent the advantage it would otherwise grant without causing the normal users any inconvenience.

share|improve this question
Is this for a multiplayer game where I could gain an unfair advantage? If not, as a player, I'd much rather you left my display settings alone, thanks. – user15805 Jun 18 '13 at 0:24
Just as Cong Xu stated, you get minimal effect adjusting the gamma because it only changes the brightness of what's actually visible. If you don't want something seen, draw it completely black and there will be virtually no way for the player to cheat by adjusting the gamma. – LiquidFeline Jun 18 '13 at 2:09
up vote 44 down vote accepted

If you absolutely need to control whether the player can see something or not, possibly for multiplayer anti-cheat or if it's key to your game mechanics, then completely obscure them. This way no amount of gamma correction will make them visible.

Not the best example, but in Closure, areas not being lit are in complete darkness:

enter image description here

... if you could reliably retrieve the current gamma correction of the user's monitor ...

Please don't go down this path; there are many reasons - other than cheating - for correcting gamma; maybe the player has poor eyesight, or a bad monitor, or is playing during the day. Please respect your users! Don't let a few cheaters/pirates/what-have-you ruin the experience for everyone else.

share|improve this answer

What I'd suggest is adding a small amount of white noise to the rendered output. In bright scenes this won't be visible, in dark scenes with ordinary gamma setting it's similar to what cameras or the human eye actually do in reality. But for someone who cranks up the gamma, this noise would be a strong nuisance. Not only won't dark objects become properly visible, the boost of the low-range noise will then also distract from bright objects; so it should sufficiently discourage people from doing that.

(Of course, very clever guys might still come up with sophisticated de-noising techniques, but those are at least not available in ordinary monitors)

share|improve this answer
an example of this technique is the flash game don't escape – user1937198 Jun 20 '13 at 15:25
If you additively blend the white noise (instead of averaging/overlaying), then dark areas will be very noisy while highlights and midtones will have barely noticeable noise. You might need larger dots for the noise depending on the resolution of the game, too - higher resolutions make the noise less effective. – Logan Pickup Nov 12 '15 at 0:10

There are a couple of Windows API functions that might do the trick: SetMonitorBrightness and SetDeviceGammaRamp. However, this will be hardware-dependent; probably not all monitors support setting the brightness programmatically, and different monitors may produce different results, etc.

Moreover, it doesn't sound like a very good idea. Locking the gamma/brightness to some fixed value will surely annoy your players, and very probably render the game unplayable for some, because it happens to come out too dark (or too bright) on their setup.

Ultimately, if it's a singleplayer game and the player wants to make the game easier for themselves, that's their right. Why should you stop them? If it's a multiplayer game, then other strategies are needed, such as only sending the player information about events close enough for them to see or within their flashlight beam, or something of that nature.

share|improve this answer

Given the random brightness/contrast/gamma of the user's screens, not the mention the room lighting where the user sits, there's no reliable way to make something that will be "just visible enough" or "just invisible enough". If you want something to be invisible, make it black. If you want to make something ambiguously perceptable, you have to accept that some players will have a better opportunity to see it.

share|improve this answer

If its single player it doesn't really matter.

In multiplayer what about just having a collision box showing what they can view. If they are in a dark area tell the client to not draw other players/stage objects/etc at all until they are in field view collision box.

share|improve this answer

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.