2
\$\begingroup\$

Currently working on a small home project of developing our own game. The game basics are just a straightforward space game, currently without any collision detection/resolution, just movement with position, velocity, and acceleration.

The game is an MMO(RPG), so currently designing & implementing the backend / server / platform side of things. So the only items we need to store right now for each object is linear and angular 3D vectors. we're doing this for the position, velocity, and acceleration. So far, so good.

The question now comes to scaling wise: let's say, a single container of the physics engine has the computational power to calculate 10 rooms of 1000 objects each. It continuously calculates the new velocity and positions of all the objects and that's about it. So what if we want to scale? I want to go to 20 rooms of 1000 objects, theoretically this seems straightforward: spin up another container and room 1-10 on container1, room 11-20 on container2.

However, what if one of those rooms in container1 suddenly goes to 5000 objects, this would mean container1 can no longer feasibly calculate this, so it should be moved (instantly) to container3.

The objects would all be stored on a redis in-memory database for purposes of speedily operations. The goal is to not have any limits to a single room or the amount of rooms, and just scaling the amount of containers based on the amount of total objects that are moving around in the whole game. Similarly, the scaling down should be handled as well, if 5 containers are each operating at 10% capacity, it should be moved to 1 container.

We were discussing things such as event bus where we insert a repeating event to "tick" on roomX, a container would take this event, look at the total amount of objects in the room, and then determine how much it can handle. The problem which we have here is that there's no guarantee the container will be done with tick_0 when another container could be working on the same room for tick_1.

Are there any other techniques we should consider doing to try and get this to figure out a scaling solution?

Other relevant things to mention:

  • the rooms are unrelated to each other
  • current programming language is Golang
  • platform can be cloud agnostic (kubernetes with whichever pods are needed)
  • client side will use an existing physics engine, as the client only has to draw the current room it's in
  • physics engine is aimed to "tick" in between anywhere from 2-10/second, depending on the results and the computational cost of each item in the room

Looking for any help or pointers to get us underway with this issue! Places to discuss this would also be greatly appreciated.

Best regards

\$\endgroup\$
2
  • \$\begingroup\$ You could look into quadtrees/octtrees for partitioning your space fairly evenly with respect to the number of objects in each “unit”. Then you could send each unit to calculate separately. Also for simulations involving thousands of objects you might want to look into unity’s ECS system. It’s still, pretty early stages but there are demos with hundreds of thousands of objects simulated on one consumer-grade machine. \$\endgroup\$ – Adam B Feb 2 at 5:26
  • \$\begingroup\$ Perhaps this is useful: Architecture for scaling a large 2D MMORPG world vs player load. Also strongly recommended, although only adjacent to the topic. Conference talk GDC - Networking for Physics Programmers by Glenn Fiedler. \$\endgroup\$ – Theraot Apr 12 at 2:12
1
\$\begingroup\$

You may follow the path of EVE Online and it's famous Time Dilation. The main idea is to slow physics down when there are too many objects.

Other less famous optimizations include clustering objects into bubbles: each bubble includes all objects that are close enough to interact. Consider a bubble to be an unit of containerization.

Another great issue of huge space battles is amount of network traffic. I'd look into deterministic physics and lock-step synchronization at early stages of development, before it's too late.

\$\endgroup\$
1
  • \$\begingroup\$ As a side note, I think "small home project" and "MMO" does not mix well. Carefully studying prior art (such as EVE Online) is a must. \$\endgroup\$ – Shadows In Rain Mar 12 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.