Screenshot of facility game

You’ve just arrived at the next floor of the facility. Do you have what it takes to escape?

Facility is a puzzle horror game, set some distance underground. Your goal is to solve the puzzles and escape to the next level.

Click below to download:

Windows Linux

Stuck? Scroll to the bottom of the page for the walkthrough.

Spoilers below.

Development

Over the summer I had a dream that that I was trapped in an underground prison, going through various gates and doors trying to escape. So the next morning I took my notebook and sketched what I imagined one floor of this underground prison might look like. Then I tried to come up with some good puzzles to take place in these rooms (you can be the judge on that though). As a teenager I used to play a lot of those “Escape the Room” online flash games, so I was inspired to make something along those lines, minus the puzzles where you have to click on a certain pixel with no hint as to why. Here’s the map that I sketched out below.

picture of notebook with game map

After that I started up blender, made a large plane, and subdivided it. Then I traced out the room that I wanted and extruded downwards. Then I made the door frames and a window for a certain puzzle in the center, put a ceiling on it, slapped some textures on it, and then I had a basic level.

screenshot of untextured game map in blender

Textured

screnshot of textured game map in blender

For the game engine I decided to use Unity, since I’m most familiar with it. I imported the level into Unity and got to work. I made a simple game state script to keep track of things like items and flags, and scripts for loading rooms so that they could be separate and (somewhat) organized.

Once I made the first room, the generator room, I realized something: This is gonna take a ton of work. There are 13 rooms total, which doesn’t sound like a lot, but thinking of puzzles, creating the models, developing the scripts, debugging, animating, ect. is pretty tedious. But obviously I kept with it, and I tried to work on this game at least once a week since late summer this year. Since this is a spooky game, and it’s almost Halloween, I’ve been working on this game as much as I could for the past two weeks to get it out while it’s still the season.

There are a lot of boring tedious things that go into making a game, so I’ll spare you those details and I’ll focus on the cool things below.

Highlights

3D Modeling

I didn’t want to use any premade models or assets if I could help it because I wanted to get more familiar with Blender. So I made just about everything you can see in the game either with Blender or just using primitives in Unity itself.

Animations are especially tedious in my opinion. I was animating the walking animation for a person in Blender, but somewhere along the way I messed up the leg positions. But I just decided that it’s now a remote controlled zombie and doesn’t need to walk perfectly.

Graphics

As you saw above, I’m not great at 3D modeling and graphics (yet). I think it’s tedious, and like a lot of people I’m sure, I would rather be working on the mechanics of the game than the graphics. But they have to be made though.

I decided to go with a dithering effect, which I found here. You can see the results below:

screenshot of game without dithering effect

“Yawn. Flat and boring.”

screenshot of game with dithering effect

“Ooo wow looks dark and gritty.”

As you can see the dithering effect does a lot of heavy lifting in order to cover up for my lack of 3D modeling skills. I think if I were more familiar with Blender it wouldn’t be as tedious, so I just have to practice more.

Chess

I like the game chess. I’m not very good at it, but it’s fun to see grand masters play. I’ve had this idea of having some sort of chess puzzle that used a chess engine in a videogame for a while now. At first I thought maybe it would be cool to have a chess tournament in a point and click adventure game, and a puzzle in that game could be to give your opponent stupid pills or something so that the player would win the grand prize. Maybe I’ll do that in my next game. But for this game you are just playing against a computer, and to beat the computer you have to disable some logic units so that it won’t “think” too hard.

I didn’t really want to put in all the work to implement the chess logic, because I know that thousands of people in the world have already done it. So I searched “chess” on Github, and sure enough:

93,064 repository results

Narrowed down to C# yields 5,727 results.

It was a bit difficult searching through all the repositories for what I wanted though. There were two main things that I was looking for:

  1. An implementation of all the necessary chess logic that includes the board representation, available moves, and doesn’t forget about edge cases
  2. Has MIT or other free licensing so I don’t need to worry about asking for permission to use or redistributing GPL code

A lot of chess repositories that I looked into missed the last point in my first requirement, the edge cases. The biggest edge case that at least half the repositories I looked at missed was En passant (The other edge case that I saw missed more than once was castling ability). En passant is such an annoying edge case that Forsyth–Edwards Notation (FEN) has a specific field just to account for it.

The chess repository that I ended up going with is this one here developed by Marco Tröster. It had just about everything I needed. The only thing that it was missing was generating a FEN string, because I need to feed it into the chess engine. So I developed that myself which wasn’t really that hard.

To test out that the chess logic worked correctly, I hooked it up so that each side would just make random moves. Personally, it was incredibly satisfying seeing it work for the first time. I probably spent two hours in total just watching it play random moves (I'm aware that the chessboards aren't oriented correctly in the videos, they were fixed before the final release).

As expected, most of the time the random opponents would end in a draw and the two kings would dance around with each other until I stepped in and ended the game. Occasionally though one of the two would accidentally mate the other.

It's a little funny watching it back now. You have 5 seconds of peace, and then all hell breaks loose. Then all of a sudden the game stops and you're trying to figure out how the checkmate happened. Also, I'm sure to everyone's disappointment, the MSPaint style chess pieces did not make it to the final product.

Chess Engine

Speaking of chess engine earlier, I wanted to use the most powerful engine in the world, Stockfish. Stockfish is GPL licensed, which means I can freely distribute it as long as I distribute the source code and any modifications I made, with documentation, along with my game. I didn’t make any modifications to Stockfish, and I didn’t really want to, so I included Stockfish along with my game the same way that it was downloaded from their website, source code in all.

The way my chess game works is that it calls the Stockfish engine in the background, feeds it a few commands to set up the engine, then feeds a FEN string to it, and then the game waits 5 seconds for Stockfish’s preferred move.

If you really wanted to, you yourself could swap out the Stockfish engine with another engine. As long as the path to the executable is the same as Stockfish, and the engine is UCI compatible, it should work.

Also since I set a time limit and not a depth limit on the chess engine (since I didn't want the player sitting around twiddling their thumbs for who knows how long), you could theoretically run this game on an incredibly underclocked computer and potentially beat Stockfish.

I also made it so when the chess computer is in "dumb mode," as in the 2 logic units in the game are turned off, the dumb chess computer makes random moves 90% of the time. I wanted to keep the player slightly on their toes, like if they kept their queen hanging there'd at least be 10% chance Stockfish would punish them for it. My "dumb computer" also has the potential of actually being better than Stockfish. If the random number generator that chooses the random moves generates the numbers just right, it could potentially generate moves that even Stockfish wouldn't think about. But we'd have to be really really lucky for that.

Conclusion

If I were to start from scratch I'd definitely do a few things differently. One big thing would be putting the fuse panel in a more central location. I'd switch the test rooms with the fuse and generator rooms and probably not even have a separate room for the fuse panel, just have it out in the hallway instead. It's a little annoying running back and forth to the fuse room, but it's a pretty short game anyway.

Overall it was pretty fun developing this game. I got a little more familiar with Blender and Unity in 3D. I think the next game I’ll try to make will be something in 2D though, maybe even something procedurally generated. Who knows.

I hope you enjoyed this game, have a fun Halloween.

Oh yeah and enjoy this blooper before you go.

"I DON'T KNOW IF I WANT TO SIT DOWN OR BARK. REGARDLESS THOUGH GIMME A SAUSAGE!!!"

Walkthrough

  1. Find the large open area in the hallway, there in a corner pick up the jumper cable
  2. Next go to the utility closet and pick the fuse up off the shelf
  3. Go to the generator room and hook up the jumper cable to power the facility
  4. Then go to the fuse room and place the fuse in the Execution Room slot
  5. Go to the execution room, open the gate, and grab the security office keys from the corner of the cell
  6. Go to the security office and grab the dollar off the desk (powering the security office is optional and not necessary)
  7. Go to the fuse room and place the fuse in the Break Room slot
  8. Go to the break room and use the vending machine, then pick up the sausage
  9. Go to fuse room and place the fuse in the Detainment Room slot
  10. Go to the detainment room and give the dog the sausage. Do not open the gate before you give the dog the sausage!
  11. Open the gate, enter the cell, open the toolbox, and grab the fuse
  12. Go back to the fuse room and place the fuses in the Test A and Test B slots
  13. Go to test room B and use the controls to move the zombie to the door, then use the “Hit” button to have the zombie break the chair blocking the door
  14. Go to the fuse room and remove the fuse from the test room A slot. While you’re here you can place the fuse in the Office slot
  15. Go to test room A and pick the picture up off the ground from under the dead man’s hand (if you didn’t place the fuse in the office slot before, go do that now)
  16. The password is “alice” (You can find this password by opening the inventory, navigating to the picture, and rotating it around to the back)
  17. In the last email you will find the PIN to the server room. It is “1685”
  18. Go back to the fuse room (for the final time) and place the fuses in the Server and Terminal slots
  19. Go to the server room, type the PIN into the keypad outside to unlock the door, and go inside
  20. Inside the server room turn off any two of the three logic units with the levers
  21. Go to the terminal room and use the computer
  22. You will have to checkmate the computer in order to get the keycard. Don’t worry though, with the two logic units disabled the computer will make dumb random 90% of the time. If you're still having trouble checkmating the computer though, search the internet to see how to do a Fool's mate! And if the random moves don't line up for a Fool's mate, quit out and try again until you can get one (Note: A Fool's mate will not work when the all the logic units are enabled).
  23. After checkmating the computer, grab the keycard and go back out to the hallway
    Find the end of the hall that has the keycard pad, and use it to exit the level

Map

  1. Security Room
  2. Utility Closet
  3. Break Room
  4. Office
  5. Server Room
  6. Terminal Room
  7. Test Room A
  8. Test Room B
  9. Detainment Room
  10. Execution Room
  11. Fuse Room
  12. Generator Room