Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Implemented Distance based chat transparency

  • Thread starter Thread starter Conundrum
  • Start date Start date
C

Conundrum

Guest
I don't know how feasible this could be but I was involved in an (unusually) large scene last night and the sheer amount of people talking made it hard to keep track of what relevant people were saying.

My suggestion is to have an option to enable transparency in the chat based on how close or far away a character is. That way you can easily discern who is beside you in the ocean of text and who is not. Something like this already exists for the hover-over chat above peoples heads. Although I know that's a different thing all together.

For example:

Person 1 (close): "Something, Something, Something... Something."

Person 2 (nearby): "Something! Something... Something, something."

Person 3 (Far away): "Something... Something... Something..."
 
Last edited:
To add to this, a slightly larger chat message whenever someone is yelling something. That is all.
 
to add onto this, maybe if you character is a rebel you get like a red chat color so everyone can know, cps get blue too so if someone doesnt know you are a cp they can know, would be immersive for rp
 
How about it displays a body count like [Italian man speaking in a fa...] [Bodycount: 109] says: "Hello my fellow LOYALISTS."
 
to add onto this, maybe if you character is underclass you can have them speak with a black name. I think this would bring forth immersion a ton
 
to add onto this, maybe if your character is a loyalist vortigaunt their chat messages don't show up at all. i think this would improve quality of rp by a ton
 
to add onto this, maybe if you're a staff member it displays it in your chat message at all time so people can know to talk in [LOOC] to you. I think this would improve the quality of rp by a ton.
 
I don't know how feasible this could be but I was involved in an (unusually) large scene last night and the sheer amount of people talking made it hard to keep track of what relevant people were saying.

My suggestion is to have an option to enable transparency in the chat based on how close or far away a character is. That way you can easily discern who is beside you in the ocean of text and who is not. Something like this already exists for the hover-over chat above peoples heads. Although I know that's a different thing all together.

For example:

Person 1 (close): "Something, Something, Something... Something."

Person 2 (nearby): "Something! Something... Something, something."

Person 3 (Far away): "Something... Something... Something..."
This is a bit of an interesting issue that took awhile to figure out.

You see, the issue is related to the computational issues with getting the distance between two positions (ex: you, and the person talking) in Euclidian space.

You might remember Cartesian coordinates from math class. A grid where you have points in the form of (X, Y). In about every game engine, position is stored as a three dimensional Cartesian coordinate. So, a 3d vector (X, Y, Z). To get the distance between them you run this formula on both coordinates:
1687743913857.png
The issue with this is that it is really slow for computers to do this with any degree of precision because of the square root. So, to avoid performance issues on a server that many already struggle to play on, we need a better solution.

The way we solve this is by omitting the final square root:
1687744208518.png
This gives us the distance to the square between you and the person talking. So, if you are 200 units apart, we get that as 40,000 here.

From there, we need to fit that number into a range to get the alpha which is a 1 byte int (0 to 255). Lets say a range from 50 to 255.

To fit it into the range, we have to a relatively simple calculation based on the maximum distance for chat range squared:
normalX = (X - min(X)) * (max(alpha) - min(alpha)) / (max(X) - 1)

Once we have the normalized X, we subtract it from the maximum to invert it (so that as someone is further away, the number decreases):
alpha = 255 - normalX
For example: To get the desired chat alpha if someone is standing 230 HU away from the player:
Code:
distance for max chat range squared = 280^2 = 78,400
distance for min chat range squared = 1^2 = 1

squared distance from local player to speaker = 230^2 = 52,000

minimum chat alpha = 50
maximum chat alpha = 255

x =  (40,000 - 1) * (255 - 50) / (78,400 - 1)
x =  39,999 * 200 / 78,399
x = 182.65

chat alpha = 255 - x
chat alpha = 72.35

Cool huh? Thats how you effeciently get the chat alpha (between 50 - 255) based on the distance from the player to the speaker. :cool:
 
Back
Top