0
\$\begingroup\$

Imagine joining a room with 100 (moving) players and a lot of items and being assigned a random position in the room (read: agar.io).

At the moment I'm eager loading the other players and items and sending it to the player when he joined the room (and notifying other players about the new player) but I'm not sure if this is the best way to do this.

I was thinking about implementing lazy loading and only show players and items near the spawned player.

  • How is such problem most commonly solved?

I was thinking about using a quadtree in order to find surrounding objects (or would a simple distance formula work)?

\$\endgroup\$
2
  • \$\begingroup\$ "not sure if this is the best way" Best with regards to what? Also, you're asking two questions here, with the first one being answered by the second one. In any case, you should implement the most simple approach first, then work from there: if you don't get any issues with the simple distance formula, then don't bother with the queadtree. \$\endgroup\$
    – Vaillancourt
    Commented Apr 24, 2019 at 16:27
  • \$\begingroup\$ Also, to spare that poor google search engine: What is eager loading?. \$\endgroup\$
    – Vaillancourt
    Commented Apr 24, 2019 at 16:27

0

You must log in to answer this question.

Browse other questions tagged .