Dev Update

Under the Hood: How Darkhaven Uses Unity

The Darkhaven team answered a round of community questions about the game's technical setup, explaining how the simulation runs separately from Unity and what that means for hosting, world size and modding.

The Darkhaven developers recently spent some time in the official Discord answering community questions about the game’s technical foundations. Here’s a summary of what they shared.

The simulation is separate from Unity

According to the developers, Darkhaven’s game simulation runs independently of the Unity engine. Unity handles visuals and input, which they listed as:

  • The content pipeline
  • VFX
  • UI
  • Rendering

The entire simulation state lives outside Unity. Unity reads that state and tries to synchronize only the visuals near the player. VFX and sounds are driven by a stream of events from the simulation, which Unity picks up and plays, matching them to what’s on screen.

The team described the client as essentially “a thin terminal with fancy visuals” communicating with a locally hosted simulation. They noted they used the same approach on Marvel Heroes with Unreal, where it allowed servers to run all the game code without running Unreal itself, which they said is comparatively very expensive to host.

The developers also said the setup is very flexible about where the host runs: whether it’s a local thread, a separate process or in the cloud, “nothing cares.”

Engine flexibility

Asked about the possibility of changing engines, the developers said enough of the game is engine agnostic that they don’t think a switch would be insurmountable if it ever had to happen for whatever reason.

How the project is built in Unity

The team explained that very little of the game lives in prefabs (at least not complicated ones) and nothing lives in scenes. The simulation is what assembles everything, so there are no big scenes or levels. In fact, the project has only a single scene, which is empty apart from some configuration objects; everything else is dynamically loaded and constructed.

As a result, their prefabs are mostly tiny bundles of models and VFX, and the rest of the Unity assets are simple data objects that the developers said could easily be converted to JSON or a similar format.

What the team does use the Unity editor for:

  • Shaders and materials
  • Audio
  • Texture and FBX import metadata
  • VFX (particles, VFX Graph, etc.)
  • Putting together the small prefabs mentioned above
  • Editor inspectors and custom editor windows for general data objects, such as lower-level wardrobe and environment data

For UI, the developers said they use a mix of both Unity systems: mostly UGUI, with some UI Toolkit for in-game editors.

Game data and modding

The developers also edit the simulation’s game data in the Unity editor, but that data isn’t tied to any Unity types. It can be imported and exported in different formats, which they listed as a custom binary format, JSON or Google Sheets. The team noted that this will be useful for modding, though they didn’t go into further detail.

World size and coordinates

On the question of large worlds, the developers said that with their current expected maximum world sizes, floating-point issues should never be a problem. If they were ever to expand beyond roughly 30,000 meters, where physics “starts getting funny,” they would probably implement an origin rebase, which they said wouldn’t be very difficult since Unity is already so abstracted from the simulation state.

The simulation itself uses 64-bit fixed-point coordinates with a larger range, which are converted (lossily) to floats when Unity reads the simulation state.

On other games and inspiration

In response to a community suggestion about another game, the developers said they’d be checking it out. Speaking generally, they explained that they aren’t playing every game but do keep an eye out, and invited players to point out anything they think the team should pay attention to. They added that while inspiration can be valuable, they’re focused on making the game they want to make.