Safe Cracking
November 9, 2018
The last day or so I’ve been working on another specialty screen for Sleuthhounds: Cruise. In a similar vein to the lock picking element I previously added, this time I’ve introduced safe cracking. Specifically, this is for safes where the player needs to turn a dial in different directions to input the safe’s combination.
The combination lock is a proper combination lock. First the player has to turn the lock twice clockwise before going to the first digit of the combination, then one full turn counterclockwise before continuing on to the second digit, and finally turning clockwise directly to the last digit. At that point if the player has entered the combination correctly they can pull the handle and the safe will open.
The graphics in the Sleuthhounds games are displayed using OpenGL, which is a library of programming functions typically used for creating 3D graphics. In my particular case, I render 2D images for Sleuthhounds, but using a 3D library gives me several advantages. Here I’m able to draw the dial of the safe once and then when the game is playing I can use the 3D OpenGL functions to rotate that image in place. This means that I don’t have to draw a separate image for every position the dial can have, which is a real time saver.
The trickiest bit about coding the safe was to account for some “slop” in the combination. It can be very easy to miss the exact digit in a combination by a little bit. I didn’t want to penalize the player for that so I allow the player to be a few degrees away from the actual digit on either side.
There will probably only be three or four instances of opening safes in the final Cruise game. To hasten development of the game, I’ve created the one safe so that it’s parameterized. This means that I can reuse the same safe close-up but with different opening combinations depending on what room the player is in when using the safe. Of course, for the actual game there will be more than just using found combinations. How much more will be up to players to discover when they play it.