Local Messages (Using y_iterate and Incognito's Streamer Plugin)
#1

In most, or even all game modes, the most common algorithm to send local messages is to loop through all
connected players, get their distance from the player that sent the message and send the message if the distance isn't too big.


Using Incognito's Streamer Plugin and Y_Less' y_iterate (AKA foreach) I came up with another way of doing it.
However I'm not sure if its more efficient for the long term.

For every player, there's a 3d sphere zone created and attached to the player.
Multi-dimensional iterator to store the players in each area.

When players enter or leave an area they get added to the iterator of that area or removed from it respectively.
And finally whenever there's a need to send a local message it will only loop through the players that are
in the area of the player that sent the message.

This way does take much more memory, and I suspect that it might be less efficient when
there are many people online (players entering and leaving areas all the time...)

The main use of those local messages are for roleplay servers that have different types of chat ranges, that means more zones and more memory.

I want to hear your opinion of the algorithm I suggested here, what do you think?
Reply
#2

Or you could use a custom GetDistanceBetweenPlayers function which accepts position parameters so that it doesn't have to retrieve the same player's position 500 times.
Reply
#3

Quote:
Originally Posted by SuperViper
View Post
Or you could use a custom GetDistanceBetweenPlayers function which accepts position parameters so that it doesn't have to retrieve the same player's position 500 times.
Hmm I actually haven't thought about that, I haven't seen the source code of his streamer plugin (****** won't let me).

I would still like to hear more opinions, perhaps from someone who saw his source code, or knows how it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)