Heyo, I'm fleshing out the replication logic for my single-server MMO engine and could use some help.
I already have movement replication working, but I'm adding the replication of data that you only need to send once when you first see a new entity (just name and sprite for now). The scenario I'm trying to support is “client's entity walks in range of peer's entity → server sends peer data (name/sprite) to client (and client data to peer)”. My first thought is an approach like:
During a server tick:
- Move all entities.
- For each client entity, build a list of all other client entities that are in range of it (using a spatial partitioning grid).
- Compare the list of in-range entities to a saved list of in-range entities from the last tick.
- Send the data of all newly in-range entities to the client (and maybe also tell it which ones just went out of range).
- Save the new list, to be used next tick.
Is this the way to do it? Or is there a more efficient way to handle this?