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.