Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

mvdspec should get all the frags/deaths prints #108

Open m4son opened 2 years ago

m4son commented 2 years ago

Yesterday, the caster on twitch had a problem figuring out how many players are alive on each team, since mvdspec doesn't get all the information when spectating in-eyes, while in free float he gets all the death/frags correct. Is it possible that we could fix that for in-eyes mode for mvdspec?

Raptor007 commented 2 years ago

I have a guess why. When chase cam is external, it copies stats: https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/g_chase.c#L138 https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/g_chase.c#L204 But if chase cam is in-eyes, it only copies stats if the server doesn't support clientNum, which is unlikely: https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/g_chase.c#L214 https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/g_chase.c#L245

I believe clientNum is supposed to handle spectating such that the stats don't need to be copied, but perhaps mvdspec is missing that part. If my guess is right, the easy solution would be to always copy client->ps.stats from targ->client->ps.stats even when using clientNum, but I'll have to check there's no downside that made a previous coder choose not to do it this way.

Raptor007 commented 2 years ago

Clarification: Do you mean the on-screen stats, or the console death messages?

If it's about console printing, there's probably some tweak that needs to be made in PrintDeathMessage for mvdspec, though I don't see why it would be different for in-eyes spectating: https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/p_client.c#L641-L649

m4son commented 2 years ago

You got it right, its about console death messages.

Hm, i thought its intended that sometimes when action is far away, we dont get kill prints or was i wrong aboout this whole time :D

Raptor007 commented 2 years ago

It's intended that in teamplay, only the killer, the killed, and anyone else not alive (whether spectating or dead) gets the messages. It's to prevent people who are alive from knowing when other players die that they didn't kill.

Spectators should always get the messages, since they're not alive players. This is being determined by other->solid == SOLID_NOT which maybe isn't correct for mvdspec or in-eyes chase cam.

m4son commented 2 years ago

Aha, makes sense. So, mvdspec gets all the data as if he was alive player. Can we "hack" this :thinking:

Raptor007 commented 2 years ago

It shouldn't consider them alive if they're a spectator. I think that's the bug. Maybe PrintDeathMessage needs to check !IS_ALIVE(other) instead of just SOLID_NOT, or specifically check the spectator and mvdspec flags as it loops over players. https://github.com/Raptor007/aq2-tng/blob/a268e2410afff708ce93acf48102325b3f7c0558/source/g_local.h#L2026

Raptor007 commented 2 years ago

This might be a little more complicated than I thought. It's probably related to ent->client->clientNum which is the only significant difference I can think of between in-eyes or chase cam.

What is your server's value for sv_mvd_spawn_dummy? I suspect there's a connection to these Q2Pro issues: https://github.com/skullernet/q2pro/issues/3 https://github.com/skullernet/q2pro/issues/36

m4son commented 2 years ago

I have checked the cvar and it's set to 1 I can check again this issue tomorrow when there are pickups played, just to make 100% sure

m4son commented 2 years ago

Well, I figured it out that this is a q2pro issue and not TNGs.

Raptor007 commented 2 years ago

Okay, if you're sure. It might be possible for TNG to work around the issue by temporarily resetting clientNum values in the PrintDeathMessage loop.

m4son commented 2 years ago

We can still try :-)

Raptor007 commented 2 years ago

Yeah I'll give it a try. If this method works, perhaps it would make sense to intercept all gi.cprintf and adjust clientNum, similar to how the bots branch does it: https://github.com/Raptor007/aq2-tng/blob/deaf34cc3d69ec13567b5607041a0968abcd089a/source/acesrc/acebot_cmds.c#L200-L216