Improbable Icon

Multiple rooms instead of one big world

general

#1

The documentation and samples talk mostly about one big open world. How would one use Spatial for many players, but separating into multiple locations (like rooms, caves etc) ?


Separate regions and instancing
Instances
Implementing SpatialOS to an existing Unity project
#2

I’m not from Improbable but this question has been asked before so I am going to give it as best of an answer that I can provide.

The platform in its current state is technically meant to have a complete open world, so rooms and caves would just be part of your game world.

However: if you would want to make a hard separation (portals to other planes or whatnot) than you can do a bit of trickery. If your world is, like a lot of MMORPGs, restricted in its use of the Y axis then you can layer multiple locations on top of eachother. Do keep in mind that workers only partition on the X/Z plane and not on the Y plane; so if you stack too much activity on top of eachother then your workers may become distressed.

Another option is to move a part of your world to some outlandishly far x/z coordinates but then you would need to take into account that game engines have floating point precision issues at large distances (above 20 to 40k units) and you need things like Floating Origin to compensate for this.

Another possibility is to use multiple deployments. You can move players between multiple active deployments but this may be financially unattractive since every deployment needs their own workers.

Does this help you?

p.s. I have a memory that the people from Improbable are thinking on how to solve this but I don’t know the state of that or whether something is coming.


#3

This is an interesting challenge… While open worlds are awesome, sometimes you want instances for parties. Take World of Warcraft as an example, while I think it would be cool for changes to happen to the world, I wouldn’t want 1000 players trying to go through a single dungeon at once. That of course is why they use instances.

You could get around this by copying an instance 1000 times for 1000 different parties, but that seems a little crazy. What would you do? Put a sign outside the entrance that says, sorry this one is full? :slight_smile:


#4

Hey @VectorXStudios,

Instances is a cool conversation topic that comes up fairly frequently.

The best option at the moment would be one of draconigras suggestions of spawning a new instance outside of the current world and teleporting the players there. Alternatively there are cool tricks you can do using Entity checkouts which mean you could actually have 2 groups running through the same dungeon with their own monsters. However if you have enough Players then there’s a logical point where you’ll still want to split the load so it makes sense just to take the remote dungeon approach from the get-go.

It’s actually pretty neat in terms of computation as you can despawn the dungeon terrain once the party had succeeded so you have minimal overhead if the majority of Players are engaging with some other game feature. I would implement it so that a few extra dungeons were always spawned at anytime so when the Players were teleported they could begin with effectively no waiting time besides loading the dungeon assets within their client. Even then you could things like delegate some state of each Player to the dungeon entity before the teleporting even starts so the dungeon assets are already being loaded. Instant instance loading!

Just some thoughts, need some more spare time to build my super mega awesome MMORPG :grin:

Cheers,
Ally


#5

Where can I go to learn about Entity checkouts? I’m spawning lobbies successfully but I’d like to hide all entities that aren’t associated with the same lobby ID, and I remembered reading this comment and the entity groups bit stuck out.


Will SpatialOS offer instanced areas?
#6

Hi @basil,

Here are the docs relating to how entity checkout works. I think the simplest answer to your question is that you need to spawn your lobbies far enough apart so that none of the entities in one lobby have a checkout radius that overlaps with a different lobby instance.


#7

It would be nice to be able to specify an instance ID for each of your “lobbies” and then spatialOS would handle the interest radius calculations internally. Moving instances around, tiling them, and taking care of the coordinates will be a brain killer.

It would require that you turn the Coordinates class into a 4 dimentional coordinate instead of 3. The last parameter is an optional int value specifying the instance id you are at.
Calculating euclidean distance is independent of dimensions.


#8

A question with scalability (far future) in mind:

-Let’s say I have a big grid where the same dungeon/prefab environment is distributed along the whole plane (e.g. 100 caves of the same type with 100 players each or so, leveraging the distributed work load with different workers), in a sense working as different “rooms”. Let’s also say this is the load limit for my engine and game type. Is there a way to plan for scalability where once the hard limit is reached the system “scales” by launching another deployment?


#9

Hi @alexcastedo, good question that unfortunately I don’t have a great answer for you at the moment. Scaling with regard to automatically launching new deployments based on load and balancing players between deployments is not something we currently support, but we are investigating potential solutions. As of now, I can’t promise anything on that though.

If you wanted to implement something that could handle this right now, your best approach would probably involve implementing your own intermediate server that operates as an intermediary between players trying to connect and spatial deployments. This server would be able to spin up new deployments if necessary, and balance connecting players between existing deployments. This isn’t something that we directly support, but you could probably make due with the existing spatial command line tools that are currently available.


#10

Good to know. Could you point me in the right direction to understand how it would work? Let’s say I want my final user to launch the same binary(like the same build exe in Unity) regardless or which deployment he is sent to by this intermediate server. How can I do that? How do I create different deployments for the same program? Can you point me to the relevant piece of docs or info?


#11

We don’t have anything in the docs about this topic, it’s not something we really officially support at the moment. Before you would do anything involving multiple deployments, we would probably need to loop in our team that manages the deployment infrastructure are verify everything is okay. What I mentioned above is probably how the general layout would work, but we don’t really have much we can offer at the moment in terms of specifics. Is your game close to the stage where you need to test this, or are you just curious as to how it would work in the future?