Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Renderer] Shadowmaps flashlight bugged in multiplayer #531

Open
di57inct opened this issue Jan 28, 2025 · 5 comments
Open

[Renderer] Shadowmaps flashlight bugged in multiplayer #531

di57inct opened this issue Jan 28, 2025 · 5 comments

Comments

@di57inct
Copy link

di57inct commented Jan 28, 2025

EDIT: https://youtu.be/TzCqgphlLG0

https://youtu.be/0M8TsI5MSe0
As you can see in the chat, EF_DIMLIGHT is present, but the flashlight doesn't show either for me or for the other players.

https://www.youtube.com/watch?v=ZGxpE8eHjxI
In this second clip, you can see at the beginning that my flashlight appears, but at a fixed origin and angle.

Somehow, it only wants to work on certain maps and map zones. When it works, the fps drops drastically:

Image

@hzqst
Copy link
Owner

hzqst commented Jan 30, 2025

Root cause

Valve uses exact the same key (key=4) for any dynamic light emitted from player with EF_DIMLIGHT

//cl_ents.c from hw.dll

		if ( j != cl.viewentity - 1 )
		{
			if (ent->curstate.effects & EF_BRIGHTLIGHT)
			{
				dl = efx.CL_AllocDlight (4);
				VectorCopy (ent->origin, dl->origin);
				dl->origin[2] += 16;
				dl->color.r = dl->color.g = dl->color.b = 250;
				dl->radius = RandomFloat(400,431);
				dl->die = cl.time + 0.001;
			}
			if (ent->curstate.effects & EF_DIMLIGHT)
			{
				dl = efx.CL_AllocDlight (4);
				VectorCopy (ent->origin, dl->origin);
				dl->color.r = dl->color.g = dl->color.b = 100;
				dl->radius = RandomFloat(200,231);
				dl->die = cl.time + 0.001;
			}
		}

		ClientDLL_AddEntity( ET_PLAYER, ent );
	}

	CL_PlayerFlashlight();

thus only one flashlight from a non-local-player will be effective at the same time.

Let's fuck Valve.

Possible mitigation

maybe change 4 to sth. like 0x40000+j as j is the playerindex then everyone will not share a unique dlight between each others anymore.

Fix

https://github.com/hzqst/MetaHookSv/releases/tag/v20250130a

hzqst added a commit that referenced this issue Jan 30, 2025
@di57inct
Copy link
Author

Crashes instantly when i try to turn on the flashlight

@hzqst
Copy link
Owner

hzqst commented Jan 31, 2025

Crashes instantly when i try to turn on the flashlight

try https://github.com/hzqst/MetaHookSv/releases/tag/v20250131a

@hzqst
Copy link
Owner

hzqst commented Feb 3, 2025

still not working?

@di57inct
Copy link
Author

di57inct commented Feb 3, 2025

didn't get a chance to test it haven't used the pc for 4 days. will reply after i do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants