New chat type - latency fix or resource eater?
#1

Hi there,


Some of you might know me from certain roleplay servers thoroughout the years but since that stuff doesn't really matter here I'll spare you from my ranting.

Here's an idea I came up with (Not saying I'm the first, I can't read minds) a while back but never had the time to test. I'm hoping someone here can give an estimation of how much this would improve the chat latency and how much server resources would have to be used (AKA is it worth it?). This would obviously be a "fix" for servers using functions to fetch distance between players. I probably spent more time drawing this picture (I know it's awesome, thanks ) than thinking about the idea but here goes:

Here's an example of how a message usually is sent to other players:
  • 1. Superman (Blue car with an S on it) sends the message "I AM SUPER!!!" by typing it into the chatbox and pressing enter.
  • 2. The message (string) is recieved by the server, and the server checks the player's location. It then sends the message, allowing everyone within 7 meters (10 x/y/z radius) to hear it.
  • 3. Both drivers' clients (games) recieves the string/message and it's announced from (2). If both cars are within the 7 meters radius, they will see/hear the message - otherwise they won't.

So here's the thing I thought about:
What if the server, instead of sending the string from the location it recieved it from (2), ran a function to check "who is within a 7 meters radius" and then sent the messages directly to the clients in that area? Here's a demonstration:
  • 1. Superman (Blue car with an S on it) sends the message "I AM SUPER!!!" by typing it into the chatbox and pressing enter.
  • 2. The message (string) is recieved by the server, and the server checks for all clients within a 7 meters radius (According to the server, not the players). It then sends the message directly to the players that were considered inside this range. If someone is not within this area at the point of which the server checked, they will not recieve the message.
Hopefully, this isn't too complicated...


To sum it up, based on what I know and/or understand:
Possible positive sides:
  • The accuracy of all messages are increased by around 50% (Again, this is my theory, I'm not certain)
  • Clients should recieve less packages (I don't know about this either) because messages are not broadcasted but sent as "private messages".
Possible negative sides:
  • Might take more resources than the other system
  • Might be a lot of work to script

As I mentioned previously in this post, what I'm trying to do by posting here is to get a second opinion from more experienced scripters of how it could work, and if it's actually worth it in terms of improvement versus server resources.
Reply
#2

Or you could just use LimitGlobalChatRadius

https://sampwiki.blast.hk/wiki/LimitGlobalChatRadius

Reply
#3

I don't really see how it is supposed to reduce latency. One way or another you are going to have to get and compare the speaker & listener's positions, and if they are moving, the positions will not be accurate.

I'm not an expert on LimitGlobalChatRadius, but considering it is a SA:MP function, it is probably your best bet, like kaisersouse said.
Reply
#4

Quote:
Originally Posted by kaisersouse
Or you could just use LimitGlobalChatRadius

https://sampwiki.blast.hk/wiki/LimitGlobalChatRadius

You didn't read anything except the title did you?

Obviously that would be the best function to use, but that's not what I'm asking.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)