Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How can I implement a network proximity checker in Unity using LLAPI?

I'm implementing my own Network Manager using LLAPI. I want to implement a network proximity checker to detect game objects closed to each player, and spawn them on the clients only when they are in the "near area". Each game object belongs to a player. How can implement this?

My idea is the following. The first steps:

1/ the player connects to the multiplayer game

2/ the player is instantiated in a given position

3/ the client representing this player, sends a request to the server, asking for gameobjects closed to his position

4/ the server searches for all gameobjects inside the "player area"

5/ the server sends information to the client, to instantiate all those gameobjects.

6/ The client instantiate all those game objects

Once the first steps have been done:

1/ The client sends a request to the server with a given frequency (once per second, perhaps), asking for gameobjects closed to his position

2/ The server searches for all gameobjects inside the "player area"

3/ the server sends information to the client, to instantiate all those

4/ The client searches in all those game gameobjects to recognize the new ones, and only instantiate them. Then, remove all the onces which are not in the list.

I need to perform this "proximity checker" once per second, per player. Having 1000 players / 10000 players, I think this doesn't have a good performance.

Any idea about how can I improve it?

Comments