How to prevent players from brute forcing puzzles?

I'm making a classic Resident Evil / Silent Hill type game, so am currently in progress of writing a few puzzles.

Currently, I have a combination lock - 4 digits 0-9. Each digit of the combination is marked with a symbol, so that each position can be linked to a puzzle in which the correct number can be found.

Obviously, I'd like the player to solve all 4 puzzles, but there is nothing that stops them solving 3 puzzles then just brute force guessing the last one.

Is this something I should care about? Is it almost like a built in contingency / loophole if the player gets stuck? I've thought about having some sort of 'lives' system, where if you try too many times it locks you out - but that's far too extreme for just a puzzle.

Or the lazy way out I've considered, is maybe to just have 3 puzzles and the 4th one has some in-universe explanation that the correct answer has been lost to time, and the only way is to brute force it, but it just doesn't seem like the "right" solution.

This is my first game, so the first time I'm properly thinking about this kind of stuff, so just wanted to get some thoughts and opinions on how people have handled this in the past. Thanks!

• If people are stuck, the faster way is for them to look up online the solution compared to brute force the puzzle Nov 22, 2022 at 12:27
• Something that might help is asking yourself what you're hoping to achieve with the puzzle, and why you're including it in the game in the first place. Is the puzzle there so that players can enjoy the mechanics of the puzzle, or does it serve some external purpose like lore delivery or pacing? Nov 22, 2022 at 20:24
• So, what's stopping them from brute forcing the third and fourth? Nov 22, 2022 at 20:36
• Instead of four puzzles, each giving one digit, you can have only two puzzles, each giving two digits (maybe combining some of the four). Brute force would be harder. Or, if the puzzles are sequential, have three: one digit, one digit, two digits for the last one. Nov 23, 2022 at 7:47
• Just don't let them put in a code until they've seen every clue Nov 23, 2022 at 11:37

A couple of thoughts:

1. You can keep digit inputs blocked (in various ways) until player achieves the source of the digit. In other words, design your 4-combination lock as a 4-keys lock.

2. You can make the "digits" more complex, e.g. require 4 pairs of 2 letters (26^2 combinations per input) rather than 4 digits (10 combinations per input).

3. You can redesign the lock to require 4 independent but mutually required actions - e.g.: WD40 (to grease the mechanism) + Key (to unlock) + PIN-code (to unlock) + UV-lamp (to see markings in PIN input).

4. If the game is more interesting than boring - players will always choose to play it more rather than bruteforce/cheat - just give them that possibility even if they unlock by mistake/misclick/whim.

5. Try breaking the "lockpicking flow" if it starts. It can be as simple as a progressive delay after each try, or as complex as adding a cutscene and teleporting player out into the mobs swarm and resetting the whole combination (cruel but effective).

• As a rational character in the OP's game world, I'd definitely be spending some time guessing the fourth (and probably the third) digit before wandering off on some life-threatening side quest to find them written down on a post-it somewhere :-). Your bullets 1 & 3 make sense in-universe as well hitting the OP's goal of forcing the player to visit more story branches... Nov 22, 2022 at 23:33
• +1: Don't give out individual digits if you don't want the player to brute force it. Give out the entire combination as a single reward, and invent other locks and keys as required (i.e. your bullet #3). Nov 23, 2022 at 2:04
• Additionally to this, if you give your player some reward for solving each puzzle, it will inentivize them to solve as many as they can. Nov 23, 2022 at 10:11
• Inserting a delay between tries is a standard real-life technique against brute-forcing (e.g. when typing a password, or between connection attempts). :-) Nov 24, 2022 at 17:13
• Be careful about 1) not breaking immersion. If I randomly try a combination that is rejected for some reason and later learn it was the right one, this very much breaks immersion for me, as obviously the game was trying to force me into playing the "right" way. It's similarly frustrating as, say, adventure game characters having certain dialog options available only after getting the idea due to solving some other puzzle (i.e. the game kept the character artificially "stupid"), while to me, the player, the idea was obvious from the start. Nov 24, 2022 at 19:32

In general I won't worry about it.

First of all, don't think of brute forcing as cheating. Think of it as taking the fun out of the game (in particular if you make the combination longer). In general, you want to make finding/interpreting/following clues the fun part. You want players to enjoy doing that, so they want to do that instead of brute forcing※.

※: Zibelas has very good point in comments: if people can look it up online (or ask somebody who already completed the game), that is easier than brute forcing the combination lock, and thus more likely that people will do it. Some games will randomize the combinations to get around this.

To encourage people to find clues, give the player a clue early on. Preferably something that they can try right away, even if it is a misdirection. The point is to get them to interact with the mechanic, and to tell them that there is stuff they can find. It can also be an opportunity for some lore exposition (e.g. that was the old combination, but they changed it because reason).

About some penalty, in general I would be against. But if you really want to have a penalty, consider if this can prevent players to experience the game to the end. Permanently locking a part of the game is OK as long as it is optional. Otherwise, you might as well give them a game over. What happens on a game over? They have to start from a save/check point or the beginning? - Well, that is a set back. You can come up with a better set back... Just waiting some time is probably boring. But you could have the player do some task so they can get more attempts (e.g. get some consumible item).

As I said, I'm against a penalty. Instead, I suggest to change the puzzle more interesting. A combination lock is very similar to a key lock, except that you can either find the combination or guess it. If you want to remove the possibility of guessing, then make it a key lock. Otherwise, add a wrinkle to combination lock puzzle, for example that when you input some digit it changes others. So that it is not only figuring out what combination to input, but also how to input it. And you can always combine it with some other kind of puzzle.

• "Otherwise, you might as well give them a game over." +100 to that. If some of your puzzles require thinking that you assume to be obvious it may actually mean unsolvable for significant chunk of players (looking at the problem as player faced such puzzles often enough). The games/quests that let me just try all combinations stayed in "I'll play again/recommend", the rest no so much. Nov 22, 2022 at 23:18

This is something I accidentally play-tested and it works surprisingly well -- give a medium-length delay after an incorrect answer. Don't make them click past anything and watch something interesting ... just give a delay. It doesn't have to be that long before people naturally take that time to think about the next try. Maybe they add up the delays in their head and decide to take a little longer solving the puzzle. Or maybe they were going to zip through 0,1,2,3... but decide to go with their gut and try 7 after 0. They can still brute force it, but the delays are telling them "come-on, you're waiting anyway -- you may as well think about it some more".

Mine was educational so I didn't want to be too cutsie (and I also secretly graded them on missed guesses). But for a game you could make the delays a little longer each time -- maybe guessing as soon as possible makes the delay even longer. One time a wrong guess could reset the previous answer (which isn't all that bad -- they remember the old puzzle and feel good about solving it faster this time). Even if they brute force it, they at least feel as if they've earned it.

Then, if you can, repeat that sort of puzzle. Game puzzles are easy to not take seriously -- many are boring afterthoughts. But after a few of the same type they realize you're serious about the puzzle, maybe it is fun, so they may as well work on a strategy.

• I am surprised that OP didn't though of this solution, since he mentioned classic Resident Evil. Trying to brute-force music box in RE3 was not the smartest move even with only 32 combinations total. Nov 22, 2022 at 21:30
• I think a good game should be designed so that it's obvious that a faster solution exists than brute forcing the puzzle, but brute forcing would be available as an alternative to having to use a "solution guide" or other such means of acquiring the solution. A similar approach would be to design a game so that solving 90% of the puzzles would yield enough money to finish the game conveniently, solving 80% would allow the player to finish the game with a moderate amount of "grinding", 70% would allow the player to finish the game, albeit with an excessive amount of grinding, etc. Nov 22, 2022 at 23:30
• To make the puzzle more natural (rather than immersion breaking anti-cheat mechanism), you can justify the delay by showing the (unskippable) animation of the character rotating the wheels of the combination lock. Nov 23, 2022 at 8:48
• @TrangOul and then tugging on the lock for a short while trying to get it to open Nov 23, 2022 at 13:35
• @user253751 This is "will it open" lock-pull animation? My experience has been that a delay after showing it didn't work is what matters. Then players have nothing to do except think of the next try. But something like a few seconds of slowly resetting seems fine. Nov 23, 2022 at 15:48

Don't. As a game developer, it is not your job to "force" players to do anything. There are several reasons a player might want to "solve" your puzzle in a non-traditional way:

1. The player is playing the entire game in a non-traditional way, such as a speedrun or other player-defined challenge run. You should not impose barriers to prevent people from enjoying the game in the way they want to enjoy it. These players tend to be among your game's most devoted fans, and spiting them is not going to make them like you as a developer.
2. The player is not in your target audience and will not enjoy the game no matter what you do. No matter what your target audience is, it will never include everybody, and worrying about people outside that audience will lead to no good outcome.
3. The puzzle is not fun or interesting to your target audience. If you have a bad puzzle, the last thing you want to do is force people to solve it. Would you rather have a player skip a bad puzzle or give up on the game entirely? That said, this is a real problem that you should worry about. You should be able to tell from playtesting if this is going to be a problem with your puzzle, and if it is, you should redesign the puzzle to be more suitable or remove it entirely.

There are, of course, exceptions, for example:

• You are making an educational game, and the puzzle is important to show mastery of the subject matter.
• You are making a multiplayer game, AND a player could receive some unfair advantage by brute-forcing the solution.
• You're making a gatcha game or similar and you're charging people to attempt the puzzle or some such nonsense.

In this case, you could just make it a ten-digit code and have the puzzles each give two digits.

I've been thinking for a bit and I came with a possible solution. Have a combination lock of 5 digits and give two digits when completing the last puzzle. Having to brute force ~50 combinations on average is enough to discourage most reasonable players from doing this. This solution is less satisfying perhaps because the last digit is different from the other 3. You could also have a combination lock with 8 digits to make each puzzle the same again (so you would get 2 digits each puzzle).

Another solution would be to have the positions of the digits be unknown and to give the positions with the last puzzle. You could also give the position of the first digit and the last digit, after which the player would have to guess the positions of the middle two digits. In the game the positions of the middle two digits could be displayed as damaged/unreadable because of wear. I show an example of this last solution below to make it more clear. On average this solution would take 3*2*10/2 = 30 tries to guess before the last digit is known. This is on the low side but might just be enough to discourage brute forcing, especially when it takes some time to enter each digit.

_ _ _ _  ()      digit: 6, position: 2
_ 6 _ _  ()      digit: 7, position: ?
_ 6 _ _  (7)     digit: 8, position: ?
_ 6 _ _  (7,8)   digit: 9, position: 4
_ 6 _ 9  (7,8)
7 6 8 9  ()      INCORRECT
8 6 7 9  ()      CORRECT

• If the player may complete the puzzles in any order you don't know which one is last. Nov 23, 2022 at 13:36
• @user253751 that's an easy fix. Just keep an internal counter of the number of puzzles that have been solved. Nov 23, 2022 at 13:38
• then every puzzle needs a 1-digit and 2-digit possibility and the final puzzle may need up to 4 different display styles depending on which clue is a 2-digit clue Nov 23, 2022 at 13:53

Other answers have covered an idea that I'll paraphrase here as:

Instead of having a puzzle which requires the player to find pieces of information from the world, have them find items. If the thing the player needs is some information then they can guess it, but if it's some items then it makes sense for the player not to be allowed to proceed until they have acquired those items within the game.

However, sometimes you might still want the puzzle to be information-based rather than item-based, for narrative or aesthetic reasons. In that case, the problem is that you want the puzzle to require the player to acquire information within the game, but you don't want the puzzle to be solvable by a player who has the exact same information acquired from outside the game, e.g. by guessing or looking it up on a wiki.

Here's a possible solution: make the player's character need a justification for why the information is correct. For example, suppose the player's character has been hired by a wealthy family to find where their deceased matriarch has hidden a particularly rare and valuable coin. In this case, the player needs to solve the puzzle by acquiring information, i.e. the location of the coin. In fact, the coin is hidden inside a porcelain ornament in the family's home, and the only way to get it out is to break the ornament into pieces.

Now suppose the player knows the required information (i.e. the coin's location) because they looked it up online, or they guessed. They can just go and break the ornament and get the coin, right? Not so fast, because the ornament itself is somewhat valuable and the family won't just let the player character break the ornament for no reason. So, the player actually needs to play the game and find the information about the coin's location in the intended way, because the player's character needs to be able to convince the family that that's where the coin is.

So, the goal is for there to be a narrative reason that the player's character must know the information, in order for the player to be mechanically allowed to have the character act on that information. Here's a few more shorter examples:

• You are disarming a bomb and if you enter the wrong code, it will explode; you can't just enter a code they looked up outside of the game, because the other characters aren't willing to risk the bomb blowing up without having some reason to believe you know the correct code.
• You are solving a mystery to find out who should be arrested for a crime that has been committed. You cannot have that person arrested without some evidence that they are indeed the culprit.
• There is treasure buried somewhere on this island, but it's going to take a lot of work to dig for it even once you know where it is. Your crewmates aren't going to dig in some random location that the player guessed, you need to find the treasure map so you can be sure that's where it's really buried.

The easiest way to have the player's character justify the information to other characters is to have them find an item which proves it. That may be fine for your purposes since the narrative of the puzzle is still about acquiring information rather than acquiring the item. But you can also have it work without an item; just have the dialogue play out differently (or, give different dialogue choices) depending on if the player's character has acquired the information.

Four locks.

Each lock requires 4 characters.

1st is digits. Second is a 4 letter word. Third puzzle is a riddle and tells how to combine first and second solutions to get the third.

4th lock is old. It does not look right. It might be rusty.

4th puzzle solution is not a number, but a boltcutter.

Consider what is the purpose of finding the numbers - couldn't the player just pick up items, or press switches to unlock the puzzle? Take a good look at Andrew Ray's answer, he has a good point.

If you really really want it, the truly impenetrable way of doing it is multiplication. Consider a puzzle like this:

In this version, the player needs to multiply the numbers, on a calculator, and then enter the result.

I was too lazy to draw more than 3 digits, but you can have 5. Good luck figuring the factors. The order does not matter in this puzzle. With two digit factors, this is frustrating to brute force. You can still do it the same way, but it's way to annoying since you'd have to calculate all the possible factors for the last number. It's also something I haven't quite seen in a game.

That said, these number "puzzles" don't really entertain me. Just give me 4 keys I need to collect and be done with it.

The core issue is that you are, at the same time:

• Giving the players the freedom to work with (and unlock) the lock without any prior requirements
• Have some requirements in mind that you want players to engage with before handling the lock.

One of these has to give. Either you remove the ability to unlock the lock, or you accept that your players are able to circumvent your puzzle content.

It might seem railroady to disallow using the lock until the entire code is known, but railroading players is precisely what you are intending to do here.

If instead it is important to you to not railroad your players in any way, then that renders the question itself moot.