Lower-fidelity simulation (offscreen action)

Architecture problem that's a bit out of my grasp with Unity. I'm wondering if this is a problem that'd be solved with ECS or jobs, and if anyone could point me to examples/point me in the right direction.

I have an RTS/adventure game where I'd like to stimulate offscreen action to challenge the player to build autonomous bases that stand up against enemies even when they aren't present.

The things working to my advantage here are that:

  • The areas where bases can be built are constrained to specific areas, the game will generally have a decent warning when the player may be approaching the base and could do some simulation last minute
  • This isn't the kind of RTS where players need to be able to just flick over to the base, the base can be run at a much lower fidelity and doesn't need to be instantaneously viewable.
  • The base areas are special delegated rooms, can probably be their own scenes, though I'd like to be able to load them additively at full fidelity into the main thread when they're approached.

So I'd like to simulate these rooms in another thread, at a lower fidelity (i.e. frame rate could probably be down to 1 Hz) the priority is not affecting performance for the real-time game.

Is there an easy way to run scenes in another thread? This is crazy-- but would launching a headless instance of Unity to run these other scenes in be viable (then just serialize their state when they're ready to be loaded into the main game)?

Would this be a good use-case for DOTS and, if so, what would be the best way to use DOTS for lower-fidelity areas?

Is there a way to constrain the resource usage of a job/unity instance in order to avoid it affecting the framerate for the main game?

I have a feeling you're way over thinking this.

In situations like these you want to separate the visuals from the data. If all the enemies, bases, etc, is represented as straight data, that can all be run pretty easily in the background at whatever frequency you want, and the visuals side of things just updates to match what the data is saying.

This separation of data and visuals is more or less the core of ECS/DOTS as well.

1 Like