Horror game


As my final project in Physical Computing, I created a horror video game where the player’s heartbeat is used as an input method. The game is a top-down horror experience where the player attempts to navigate through a maze-like environment. To complete the level, the player must unlock doors by finding corresponding keys. The player is not alone in the maze, as there are enemies that can sense the heartbeat of the player. To stay hidden from the creatures, player needs to focus on keeping their heartbeat calm. Only the immediate surroundings are visible, as everything else, including the enemies, are hidden in total darkness. The creatures cannot be killed, so only way is to avoid them, which requires patience and calculated movements.


Heartbeat as an input

The heartbeat of the player is tracked with a PulseSensor, and visually presented as a pulsating ring around the playable character. When this ring gets close to an enemy, the enemy will charge towards the player. The player can still escape if they are quick enough. The closer the enemy gets the faster their speed becomes, eventually catching the player. In this case the player will fall into total darkness and the game will end. To avoid this outcome, the player must time their movements, and navigate past the enemies in between their heartbeats. The enemies can sense the player through walls, which allows the player to safely lure them to more optimal locations.

Design process

The game design process was an engaging experience. I started by ideating and testing different core features around the heartbeat data. I wanted to visualise the heartbeat as directly as possible, to make it unique and personal to each player. The drawback of this approach was in its susceptibility to sensor noise, as rather than simply counting heartbeats, I wanted to visualize the rhythmic pattern itself. As another design choice, I aimed to enhance immersion by integrating all information directly into the game world, without the use of a separate HUD. In the current state of the game, this includes having the heartbeat and the collected keys visually presented on the character. The level progression is designed to be easy to understand, as the first locked door and corresponding key are visible simultaneously. Inspired by the themes of heartbeat and blood, the enemy design draws inspiration from leeches and other parasites. This approach results in a simple yet recognisable design that retains its repulsiveness even in pixelated form.

Learning process

Having no previous experience with programming or electronics, I learned many practical skills during the project. The game is created using p5.js, a creative coding library for JavaScript. In addition, the p5play library was used to create sprites, which are individual elements that can interact with each other. This enables the player to collect keys, collide with walls, and die horribly in contact with the enemies. It was interesting to design simple animations for the characters. These also have purpose, as the idle animations make the enemies more visible from the static environment. I also realised how some simple features can be complicated to implement, for example diagonal player movement, or rotation of the character model. There were also some p5play features that I could not get working, perhaps because the current version is relatively new, and related tutorials were not complete. One of the main struggles involved setting objects on different layers, a feature that was supposed to be very simple in p5play. Eventually, these struggles led me to give up on implementing a start and an end screen. All things considered, I was happy with the results, being able to implement and experiment with all the core features of the game.

Additional information

Map design

The map design process started with sketching, and soon moved to Photoshop. My aim was to create an intuitive map that introduces the basic mechanics. Some areas are more forgiving as they allow the player to loop around walls. I tried to design the game to discourage aimless running, requiring precise timing for certain encounters. Below is the final map design.

Detail image

Enemy design

The design of the enemies originated from concepts of horror and blood. It had to be something that remains distinct even in a pixelated, top-down view. Leeches and other parasites became direct inspiration, mainly due to their appearance, but also for their desire for blood. I created the enemy design in Photoshop, and then used this JavaScript library to turn them into pixel art. The idle and moving animations both have 6 frames each. Below is the final enemy design.

Detail image

Pulse sensor

I used a PulseSensor to track the heartbeat of the player. The sensor was simply connected to an Arduino Uno, which was then connected to a computer. There are good official tutorials on how to get data from the sensor for different purposes. It is important to apply a correct amount of pressure towards the sensor, it worked the best when the pressure was just enough to seal the sensor from light. Below is an image of the setup.

Detail image


I also wanted to implement simple quality of life features. The game can be played using either arrow keys or WASD keys. Opening the port connection for the sensor can be done by pressing ‘P’, and full screen mode can be activated with ‘F’. Moreover, the game can be played without a heartbeat sensor by switching to a simulated one with the press of ‘H’.