I just had someone ask the following questions and thought I’d post our response here to help any devs who might have similar queries!
How are positions handled?
- For entities to synchronize positional information across all workers (including connected clients for whom the entity is visible), a global/world position is stored in your schema for your entity. In the PiratesTutorial there is a schema file called WorldTransform.cs which specifies a position and a rotation. Every entity must have a positional component, so the WorldTransform is given to the player’s ship, the pirate ships - even the terrain.In our schema format the EntityPosition type uses doubles for its precision.
- In some game engines, positions a certain distance from the origin (very large doubles) can be invalid, or can suffer from value instability. To combat this, every worker does itself have an explicit ‘centre’ position within the simulation. When it instantiates game objects to represent the entities in its area of interest it remaps their global/world positions in the simulation to be relative to the worker’s centre of position, which is considered to be the local origin. This can alleviate issues with extreme distances not playing nicely with game engines.
Are physics entirely server side or is this a trust-the-client approach?
- You fully control what code is executed server-side and client-side. You do not need to trust the client if you do not want to.
Can we create a modding API which allows users to create their own worlds or entirely replace the base world if they so desire?
- If a games developer wants to change the content in their game, either incorporating content produced by them or by their player community, that has more to do with their content pipeline than any limitations on our end. The community would need to go through your system to upload their work but it is possible.
- World’s Adrift has their Island Creator on Steam which is one such example of how you can empower the community to help shape your world.
Can users still host their own servers on their own machines?
- SpatialOS is a cloud-based platform which allows large scale game worlds by coordinating groups of servers resources on behalf of the game. It might be quite possible to make an offline mode for a game which can also use SpatialOS for large-scale online play, but SpatialOS will not benefit that offline/LAN development.