# Computerraria: A RISC-V Computer Built Inside Terraria's Wiring System

> Computerraria implements a fully compliant rv32i RISC-V instruction set inside the wiring system of the game Terraria. With the WireHead accelerator mod installed, the in-game CPU runs at approximately 5 kHz with 96 KB of RAM, and can execute programs including Pong compiled from Rust.

**misprit7/computerraria** — A fully compliant RISC-V computer made inside the game Terraria

- Repository: https://github.com/misprit7/computerraria
- Website: https://youtu.be/zXPiqk0-zDY
- Stars: 3,863 · Forks: 55
- Language: Rust
- License: MIT
- Published: 2026-09-23 · Updated: 2026-09-23 · Language: en
- Canonical page: https://hysenlabs.com/projects/misprit7-computerraria

## What Computerraria Builds and Why

Terraria is a 2D sandbox game whose wiring system allows players to connect switches, sensors, and actuators with colored wires to create logic circuits. The wiring system is Turing complete in principle, but vanilla Terraria's wiring implementation runs too slowly for anything practical.

Computerraria exploits this by implementing the complete rv32i base integer instruction set of RISC-V inside the wiring system. The README describes the goal as maximizing compliance and processing ability of the in-game CPU. The result is a machine that can execute real software compiled from Rust or C.

The README frames the project humorously as an attempt to push computational speeds back to the early 1970s era by running a real instruction set inside a game. The point is not practical computing but a demonstration that a fully spec-compliant RISC-V processor can be constructed from Terraria wires and tiles, and that programs compiled for RISC-V will run correctly on it.

## The WireHead Accelerator and Current Performance

Without an accelerator, the vanilla Terraria wiring engine is far too slow for a CPU to be usable. Computerraria depends on WireHead, a separate mod at github.com/misprit7/WireHead, which is described in the README as a wiring accelerator and headless control mod that maintains full compatibility with the vanilla wiring system but reimplements it in a much more efficient manner.

With WireHead installed, the current specifications of the computer are:
- Clock speed: approximately 5 kHz
- RAM: 96 KB
- Instruction set: rv32i

These numbers are constrained by the game simulation, not by the host machine's hardware. 5 kHz is roughly the speed of early 1970s microprocessors, which is what the README's framing refers to. The 96 KB of RAM is sufficient to run simple interactive programs such as Pong.

## Setting Up the Project on Linux

The README states that currently only Linux is fully supported. Windows support exists in theory through WSL but has not been fully tested. The setup requires a working Rust and Cargo installation, tModLoader (available on Steam as app 1281930), and the WireHead mod.

To clone the repository and install the WireHead mod source:

```bash
cd "~/.local/share/Terraria/tModLoader/ModSources" && git clone https://github.com/misprit7/WireHead.git
```

The game world file is computer.wld. Copy it to the tModLoader worlds directory:

```
Linux: ~/.local/share/Terraria/tModLoader/Worlds
```

The copy-world.sh script automates moving the world file back and forth with --to (copy to world folder) or --from (copy from world folder) flags.

To compile and load a program such as Pong:

```bash
cd <path to computerraria>/app/pong
cargo rb
./copy-bin.sh /tmp/pong.txt
```

Then in the game, type:

```
/bin write /tmp/pong.txt
```

The README notes a bug where NPCs controlling the CPU clock are too far from the spawn point to spawn immediately. The workaround is to use a teleporter to travel to their location and back before starting the program.

## Repository Layout and Tooling

The file structure described in the README has five major parts:

```
.
├── app/
│   ├── tdriver/
│   └── template/
├── computer.wld
├── doc/
├── docker/
├── test/
└── tinterface/
    ├── bin/
    └── tinterface/
```

The app/ directory contains programs written for the computer. tdriver/ provides the low-level driver API for interacting with the CPU from Rust, including startup code and graphics drivers. template/ is the starting point for new Rust projects targeting the computer.

computer.wld is the Terraria world file that contains the actual CPU. The README notes that while it is technically a binary file, it functions more like source code in this project context because it is edited manually and compresses well.

tinterface/ is a Python module and command-line wrapper that interfaces programmatically with a running Terraria instance, allowing binaries to be uploaded and execution to be started without a GUI. This is used for automated testing in CI.

## Compliance Testing and the Automated CI Pipeline

The README states that the goal is to maximize compliance with the rv32i specification, not just to run a specific program. The test/ directory contains the compliance test suite, which uses riscof, a standard RISC-V compliance testing framework. A plugin for computerraria and a reference plugin using sail_cSim (a formal specification simulator) allow the two to be compared instruction by instruction.

Automated in-game tests run through GitHub Actions, as shown by the CI badge in the README. This means the repository has automated verification that the CPU correctly executes the rv32i instruction set against a reference implementation.

For advanced CI and headless usage without a display, the Docker image can be used:

```bash
docker pull misprit7/computerraria
docker run -it misprit7/computerraria
```

The Docker image has all tooling pre-installed for building and testing without a graphical Terraria session.

## Real Limitations and Scope of the Project

Three concrete constraints shape what Computerraria can and cannot do.

First, the 5 kHz clock speed makes it impractical for anything computationally intensive. Pong works because it requires very little computation per frame. A program that performs sorting on large arrays or does floating-point arithmetic (which rv32i does not include natively) would run at speeds that make it effectively unusable.

Second, Linux is the only fully supported platform. The README acknowledges that Windows support via WSL is theoretical and not fully tested. macOS is not mentioned.

Third, the setup process is involved. It requires a licensed copy of Terraria, tModLoader from Steam, building the WireHead mod from source inside tModLoader's mod sources directory, copying a world file, and using a workaround for a known NPC spawn bug. This is not a beginner-friendly project.

## Maintenance Status and License

The last push to misprit7/computerraria was on 2026-08-03. The repository is not archived.

The project is MIT licensed, which permits free use, modification, and redistribution with attribution. The project homepage links to a YouTube video at youtu.be/zXPiqk0-zDY that explains the project visually, which is the most accessible introduction to what the computer looks like inside the game.

Computerraria occupies a niche shared by similar game-based computing projects. Minecraft's in-game redstone circuitry has been used to build CPUs, and the demoscene has long used constrained environments for computation. What distinguishes Computerraria is the claim of full rv32i compliance verified against a formal reference implementation, which puts it in a more rigorous category than most game-based CPU projects.

## Conclusion

Computerraria is a serious demonstration of computation theory implemented as a game modification. It is the right project to study for engineers interested in how a fully compliant RISC-V CPU can be built from a wiring simulation. Running it requires Terraria, tModLoader, the WireHead mod, and a working Rust toolchain. The setup is non-trivial and currently only fully supported on Linux. The last push was on 2026-08-03, and the project is MIT licensed.

## FAQ

### Is Terraria Turing complete because of projects like Computerraria?

The Computerraria README states the project implements a fully compliant rv32i instruction set inside the Terraria wiring system, which demonstrates that the wiring system can perform arbitrary computation. The project depends on the WireHead accelerator mod to reach practical speeds.

### What programs can Computerraria actually run?

The README describes Pong as a working example running purely on the in-game CPU, with source in app/pong/src/main.rs. Any program compiled for the rv32i instruction set can run on the computer, including programs written in Rust or C.

### Does Computerraria require a specific version of Terraria or tModLoader?

The README does not specify a Terraria version. It requires tModLoader, available on Steam as app 1281930, and the WireHead mod built from the source at github.com/misprit7/WireHead. The Dockerfile lists a comprehensive set of prerequisites.

## Sources

- [Issues](https://github.com/misprit7/computerraria/issues)
- [License: MIT](https://github.com/misprit7/computerraria/blob/main/LICENSE)
- [misprit7/computerraria on GitHub](https://github.com/misprit7/computerraria)
- [Project website](https://youtu.be/zXPiqk0-zDY)
- [README](https://github.com/misprit7/computerraria/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/misprit7-computerraria
