Improbable Icon

SpatialOS for Scientific Computing Simulations



Hello there!

I am coming from a background of Scientific Computing/Computational Mechanics focusing on performing large scale physics simulations (simulation of large cities for, weather, winds, pedestrians etc). I am currently evaluating the suitability of SpatialOS for such simulations.

Currently the scientific simulation community faces the following persistent problems while simulating large scale models:

  1. Its really hard to scale beyond a point with the current distributed computing paradigms
  2. Its not fault tolerant
  3. Its hard to achieve dynamic load balancing.

While spatialOS seems to solve many of these issues at some level, the suitability of spatialOS for such scientific computing simulations is not clear. The current community around spatialOS is focused on game development.

Could somebody perhaps shed some light on the suitability of spatialOS for such scientific computing simulations? Are there any instances in which such simulations are performed on spatialOS? If so a tutorial case showing how to perform such simulations would give great insights.

Given that most of the scientific computing solvers (“workers” in spatialOS terminology) are in C++, I believe that there could be a way in which we could run scientific simulations on spatialOS with the SDK tools. But at this point its not clear how to achieve that.

Thanks for your inputs in advance.

Best Regards,



Hi Rama, thanks for your question.

Using SpatialOS as a platform for scientific computing has been a recurring topic for discussion around the office, which we’ve learnt more and more about as we come into contact with users like yourself!

Depending on your particular interest and application of ‘scientific computing’ (one ambiguity we’ve learnt the hard way), there are a few SpatialOS design decisions that may be relevant:

  • SpatialOS prioritises progress over guaranteed delivery. This means that component updates may be lost, commands may fail to be delivered first try etc.
    This design is good for gaming where ‘liveness’ of data is paramount, but possibly not helpful in scientific computing, where missing an update may affect the experiment.

  • Load balancing in SpatialOS has exactly two dimensions: location in cartesian space, and worker attribute. So for example you could have two ‘physical’ entities next to each other owned by the same worker, or a ‘physical’ and ‘visual’ entity next to each other, owned by different workers. These use cases fit SpatialOS very nicely, and can be load balanced efficiently.
    If, however, you need to load balance by some arbitrary other attribute (for example having all red cars in the world owned by the same worker), this is not currently supported*.

  • SpatialOS is intended to be highly scalable for relatively lightweight updates on entity-components . That doesn’t preclude using lists and nested structures, but it’s not intended for e.g serialising large data objects, which can come with attempting to port existing projects to SpatialOS.

Having said that, it is possible to work around some of these challenges:

  • Lack of guaranteed delivery can be compensated for with a global logical clock regulating progress in lockstep across all nodes, waiting to make progress until all participants have successfully completed the step.
    SpatialOS doesn’t provide an implementation of a global clock, but it’s possible to implement as a worker.

  • Alternatively, you can avoid computing in lockstep if the preconditions for a local step are well defined and spatially sharded. We have experimented internally with this approach to determinism using cellular automata (as in Conway’s Game of Life).

The bottom line is that you could use SpatialOS as a platform for scientific computation, but only with a relatively significant foundational framework to ensure determinism and correctness!

Hope that answers some of your question :slight_smile:


*Strictly speaking, you could force authority manually using specific worker entity ACL constraints, but I wouldn’t recommend it.


Hi Karl,

Thanks for your detailed response. It does give me a good orientation into the capabilities of SpatialOS

In the context of scientific computing, I see that there are several classes of simulations which can leverage the capabilities of SpatialOS (like Agent Based Methods at micro- and meso- levels etc). For few other applications like simulation of global atmospheric flows, or wind simulation across cities which normally use “Mesh Based” Finite Volume Methods (as in Computational Fluid Dynamics, CFD), it probably involves massive amount of changes to the existing codes. The current computing paradigms for running these codes on distributed machines normally involve MPI frameworks (here is a widely used CFD code

I love the way one can quickly deploy games on spatialOS using the SDKs. Similarly, if sometime in the future spatialOS can enable users to perform simulations like CFD that would add tremendous value and would be fantastic!

Best Regards,