Area Loading System

A small game I am working on involves a few hundred randomly generated worlds. Each player has the ability to visit any world and interact with it (like place a building down or raise populations). Ideally, the game would be able to support 12 players simultaneously. When creating these worlds, I thought it would be inefficient if the worlds a specific player was not in were being updated and loaded for them. Therefore, I thought it would be a good idea to implement an area loading system where worlds would be displayed only if the client was there. Two approaches came to mind:

  1. Have the server simulate the game (all interactions, worlds, buildings, populations, etc.), updating the game state with a fixed frequency. When a client is in a world, any updates to the game state are sent to them to display visually.

  2. Actually load the worlds on the server whenever they have at least one player. Then, any changes a player makes are verified on the server before affecting the loaded worlds.

There are two concerns I have with these approaches. In the first, I worry about client synchronization. The client can move populations from one point to another along a hexagonal grid. If the worlds are loaded locally, then there would be a discrepancy between how long it takes different clients to simulate the movement once an update is received. The server might have to perform each step of the movement while the clients interpolate between them which also leads to the same issue. In the second, I worry about security. If the worlds are actually loaded, I plan to let the client moving things have network ownership. However, this gives them control over the physics of that item (which lets them do things like speed up or slow down the movement).

If I were to attempt sanity checks in the second approach, I would have to poll the speed of all movable entities in the game that the client can manipulate to see whether they are within a desired threshold. I do not know how costly and how effective this would be. I want to know if there are better ways of approaching this problem because I am completely inexperienced with this kind of thing.

2 Likes