Making Subnautica Scarier With Real-life Effects

About the project

By monitoring the health, oxygen, and depth in Subnautica, let's make the game scarier and more immersive with real life effects!

Project info

Items used in this project

Hardware components

Adafruit NeoPixel Ring: WS2812 5050 RGB LED Adafruit NeoPixel Ring: WS2812 5050 RGB LED x 1
Espressif ESP32S Espressif ESP32S x 1

Software apps and online services

Arduino IDE Arduino IDE

Hand tools and fabrication machines

visual studio code visual studio code For python code x 1

Story

Inspiration

Subnautica is a blast, but it was around the time that I started scanning and grappling onto the murderous leviathans like Indiana Jones that I realized I was just too desensitized to fully appreciate the thalassophobia feelings the game is supposed to invoke. It is classified as a horror game, after all! With Subnautica 2 set to release in the coming year, this needed rectified immediately. What to do...

What We're Building

The goal is to increase the immersion and the fear factors. That means we need to have a way of monitoring certain aspects of the game so that we can trigger fun stuff.

To do so we're going to put together a python script that monitors certain aspects of the game. For this, we're monitoring the health, oxygen levels, and depth. Depth will just be to increase immersion. I tend to avoid spoilers so I can fully enjoy the given game, but I did look into what the maximum depth vehicles can go to for exactly this purpose and set the deepest depths I expect to be red. On the way down, we'll flow from one color to the next such that we can visualize how deep we are with color in the room!

Next up is oxygen. If we're going to induce panic, there's nothing quite like the Sonic Music that plays when you're near drowning from <redacted> years ago. It gets us right in the childhood and gets the adrenaline pumping like nothing else. If the oxygen percentage drops below 15% we play the music. If the oxygen levels start going up, we stop the music.

Last is health. Subnautica has a nice display when you get hit, mixing a red backdrop with a cracked screen, but adding a real life element really makes it hit home. As we'll get to momentarily, we're using an ESP32 for the led's and the buzzers. When we get hit, we pass a message to the ESP32 and make it buzz us so we feel it in real life.

Codey Time

The majority of the code is in a python script that monitors the display with pytesseract. I also included a calibration program, which was super nice. Last time I dabbled in this type of thing, it took me way too long to hone in on the part of the screen I wanted to read data from. This time, the calibration program makes it a quick visual process. Much less painful.

The full python program for adding immersion does a lot. For oxygen and health I ended up doing different processing methods to visually interpret the data. It was a pain but eventually the result was pretty good. The depth is just text and that worked pretty well very quickly.

For the 3 effects described, the only one that plays on the computer-run side of things is the sonic underwater music. When we drop below 15% oxygen, it plays until we start increasing in oxygen or, um - the audio finishes playing. For this I moved to pygame and it resolved some really annoying issues I had with other approaches.

The code is attached so it should just work in full, but here are the installs you'll need for it:

pip install opencv-python pyautogui numpy pygame pytesseract

Physical Additions

The last part of the process is the ESP32 side of things. The python program still handles the bulk of the processing, but we continuously listen for commands on the arduino side as well. Depth is passed ongoingly, anytime we get good values (which should be the vast majority of the time). A "buzz" is only passed when we take damage, and the arduino orchestrates playing a buzz through the coin buzzers.

To wire to the ESP32 is pretty straightforward. Here is a simple pinout:

D5 --> LED data

VIN --> LED power

GND --> LED GND

D14 --> buzzer red

D2 --> other buzzer's red

GND --> both buzzer's blue

End Result

Now we have a fully functional way to give us anxiety problems when we ignore our oxygen levels for too long, cool lighting to represent the depths we reach, and a way to buzz ourselves when we get too close to a bitey-fish. Now that the code works, it does add a lot of fun to the game and sets the stage for when Subnautica 2 arrives. I look forward to hear any ideas and iterations other people have and make! Hope you enjoyed and have a good one.

Code

arduino_subnautica

This is to be run on an esp32 (or tweak it as needed to run on your arduino of choice). It handles listening for depth information as well as when we get damaged to update led display and buzz us when relevant.

immersive_subnautica.py

This is the main program that captures your data as you play Subnautica and orchestrates having immersive effects happen.

calibration.py

A simple calibration program that makes it easier to get the right location and sizing for the different parts we want to capture for the full immersive Subnautica program.

Credits

Photo of donutsorelse

donutsorelse

I like to make stuff and make something different every week!

   

Leave your feedback...