Skip to content

MercuryWorkshop/terraria-wasm

Repository files navigation

Terrarium

A port of Terraria to the browser using WebAssembly and fna-wasm-threads

Read the writeup for more information on how this works. image

I want to host this on my website

Go to the releases page and download the latest release. Extract the contents of terraria-wasm-build.zip to your web server. Cross site isolation headers are required for this to work, so make sure your web server is configured to send the following headers:

Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin

I want to build this

Prerequisites

  • A x86_64 Linux system
  • dotnet 9.0.4
  • the mono-devel package on your distro
  • node and pnpm
  • Terraria (Linux or Windows build)
  • ilspycmd (SPECIFICALLY VERSION 9.0.0.7889) it's recommended to install ilspycmd using the .NET CLI
dotnet tool install --global ilspycmd --version 9.0.0.7889

Building

  1. Clone the repository (make sure you use --recursive!!)
  2. Decompile Terraria
bash tools/decompile.sh ~/.local/share/Steam/steamapps/common/Terraria/Terraria.exe
  1. Patch Terraria
bash tools/copydecompiled.sh
bash tools/applypatches.sh Vanilla
  1. Build the project
make serve

To build the frontend for production, run:

make publish

I want to add mods

Right now performance is not good enough in dotnet interpreted/jiterpreter mode, which is required for the MonoMod WASM port to function. Eventually it might be possible with improvements to the dotnet wasm jit or a "mixed aot" mode allowing for better FNA performance, but for now it isn't feasible

About

Terraria ported to the browser with WebAssembly

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors