Verifying User Input – Thinking Outside The Box

Now I’m not going to talk about user input validation, no that’s something that’s been covered a lot around the web, I’m going to talk about something else.

Let’s imagine you are designing a game, where the user can create a puzzle, for example a maze, and you want to verify that what the user has input is a valid maze, that if played by another player that player will have a chance of winning it. Normally the solution that would come to your (and mine) mind is to try to solve that maze automatically – also we’re not going to talk about the different algorithms for solving mazes – but there is another way to do it that no one told us about in Algorithms 101!

Guess what! You can verify it manually! Yes Yes I know this is super smart right? No one thought about it!

So smart ... duh

Come one enough kidding, but yes verifying it manually will save you a lot of work and complexity, and will also mean that other people will have a good chance (not very high necessarily) of solving the puzzle, let’s face it, if a backtracking algorithm is able to solve a puzzle it doesn’t mean that people will be able to do so too, it might be very hard for people to find that solution, so the point here is that by verifying the puzzle manually you can ensure you give people a better and fair chance.

Ain't nobody got time for dat

Of course I’m not telling you to verify it yourself, that would be nonsense, this is not 1990s, when you would afford verifying user input yourself after you throw it in some queue, now everything seems to be built for the masses and you can’t afford sparing your time or buying someone else’s time to do so. Then what am I talking about?!

Well the idea is not mine unfortunately, I saw the idea in the latest game by Zeptolab, an MMO strategy game called King Of Thieves.

King Of Thieves Splash Screen
King Of Thieves Splash Screen © 2015 Zeptolab

In this game you have a dungeon and a chest of gold and some gems, and like all the other strategy games, you get to design your defences to work the best way against your enemies (every other player out there!), and the goal of your design is to make reaching the chest of gold very hard for other thieves (players) who enter your dungeon, but not impossible or super hard, and that’s the catch; how do you verify that the user doesn’t make it extremely hard if not impossible for other players to reach his/her gems and gold?

The way the game creators solved it is a creative way – I’m not sure where it comes from and whether it is their original idea or it’s known in the game industry, but personally I only saw it in their game so far -, and this idea is to ask the user who designs the dungeon to prove that he/she can reach the chest within this design, if the user can’t solve the puzzle (reach the chest here), don’t allow him/her to save the design, and don’t run complex algorithms to check if the design is not an impossible design or a very hard design.

King Of Thieves Splash Screen
King Of Thieves Screenshot © 2015 Zeptolab

By doing this the user would have to play in his/her own dungeon trying to defeat his/her defences to reach the chest, and by doing so twice in a row we can be sure that other players stand a good and fair chance of solving this puzzle. One thing that might be of a problem is when the user can actually design a good puzzle but he/she is not yet experienced in this game to solve it, then he/she might need to make their designs easier so that they can save them; but for that the game creators saw a chance where they can make money and they would offer you a proven design that works and is hard in exchange of some valuable resource in the game or you can purchase that design for real money.

The other major benefit of this approach is that you end up with a solution to the puzzle – or more than one solution if the user tried two different approaches -, with detailed steps (because you tracked the user while he/she was trying to solve the puzzle). You can use this data to do two important things; 1. You can sell the solution to the players who are trying to solve this puzzle (and betray the user but that’s another moral story), 2. You got yourself a training set for your machine learning algorithms that will be able to mimic the human’s way of solving such puzzles after studying all these massive solutions (and the other ones that users come up with when solving other users’ puzzles themselves).

I find this very genius, don’t you think?!

You can apply this idea to other games where the user creates defences against intruders and still you want to give the intruders a chance not allowing the user to make it impossible for them, and you can generalize the idea to many puzzle games where the user sets up the puzzle for other users.

With this idea the creators of that game spared a lot of time, effort and money from being spent on verifying the user’s input, and I think it’s something that’s worth sharing and applying to other platforms, maybe not only to other games.

Leave a Reply