Skip to content

Conversation

@Rainyan
Copy link
Collaborator

@Rainyan Rainyan commented Oct 25, 2025

Description

Fix a problem with spectators seeing the spectated ghoster's beacons instantly, instead of after the delay specified by the cvar neo_ghost_delay_secs. For the default case, we can derive the ghost equip time from its m_flNextPrimaryAttack, but for the neo_ctg_ghost_beacons_when_inactive mode I also had to add a new time variable (m_flPickupTime) for tracking when the ghost was initially picked up.

Also fixes an inaccuracy for the ghost beacons maximum visible distance.

Toolchain

  • Windows MSVC VS2022

Linked Issues

@Rainyan Rainyan changed the title Bug/spec beacons Fixes for ghost beacons Oct 25, 2025
@Rainyan Rainyan requested a review from a team October 25, 2025 09:26
Copy link
Contributor

@Agiel Agiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

@Rainyan Rainyan marked this pull request as draft October 25, 2025 10:24
@Rainyan Rainyan force-pushed the bug/spec-beacons branch 2 times, most recently from 186b85c to deabc00 Compare October 28, 2025 15:04
Fix NeotokyoRebuild#1426 where spectators of a ghost carrier would see the ghost beacon
UI visuals immediately, instead of having the correct ghost bootup delay
applied.

Fix NeotokyoRebuild#1441 where our ghost beacons max range was slightly incorrect.

Also fix some incorrect ghost beacons related cvar naming with the
proper `cl_neo_...` and `sv_neo_...` prefixes, and refactor some of the
cvar locations.

The previously client-sided cvar "neo_ghost_delay_secs" has moved
server side, and an additional server cvar "sv_neo_serverside_beacons"
is introduced to toggle between this new server-sided behaviour (which
is now the default), and the old client-sided FCVAR_CHEAT based
solution. In the server-sided mode, off-PVS enemies will no longer be
networked to the ghoster until they are ready to be displayed, and the
ghost beacon beep sounds will be handled server-side (since we can no
longer know the nearest off-PVS enemy distance client-side in such
cases). The timing to network this server-sided state is estimated from
the ghoster's average latency, with some extra for safety to ensure they
should still arrive in time.

This "sv_neo_serverside_beacons" server-side mode is somewhat
experimental, and probably needs playtesting to verify it's working
correctly. The unfortunate side-effect of the server-sided mode is that
the ghost beacon beep sounds are no longer playing at the exact
distance-based timings (since they depend on the EmitSound
server->client packet arrival latency), which means at least
theoretically they aren't quite as accurate anymore for estimating the
nearest enemy distance for ghosters with wildly fluctuating ping or
otherwise unstable connection. One alternative worth exploring could be
to explicitly network the nearest enemy distance as a netprop to the
ghoster, since someone attempting to use the networked data to cheat
could already derive an approximation of the nearest enemy distance
from the ghost beep frequency anyway.
The "sv_neo_serverside_beacons" feature introduced in 23f5cd9 has been
improved; when enabled, we now perform the ghost beacon beep sounds again
client-sided, while retaining the benefits of calculating most of the
ghoster-related logic (like the bootup sequence duration and distance)
server-sided.

"sv_neo_serverside_beacons 1" is now the recommended value for this
option. In the "sv_neo_serverside_beacons 0" mode, ghosters who have the
ghost equipped will instantly be transmitted all enemy player netprops,
as a legacy option.

The ghost beacons logic has also been refactored to remove some of the
dependencies between gamerules and the ghost.
@Rainyan
Copy link
Collaborator Author

Rainyan commented Oct 28, 2025

Well, this PR grew a bit larger than I expected. There's now more logic on whether to network enemies to the ghoster based on ghost activation time, distance etc. This is toggleable with a new cvar sv_neo_serverside_beacons (default value 1, i.e. enabled), where turning it off will make the server instantly network enemies instead of waiting for the sv_neo_ghost_delay_secs duration.

Since the ghoster needs to know the distance to nearest enemy for the beacon sound effect's playback interval (it would be a bit unreliable timing-wise to send them from server->client), there's a new m_flNearestEnemyDist networked property on the ghost, so that we can share this with the ghoster without needing to expose all the enemies' locations before they're allowed to know it. In the sv_neo_serverside_beacons 0 mode, the client just calculates it from the networked enemy locations like before, instead of the server, since they have all the info.

Here's an example of the timed beacons networking, tested with r_novis 1; mat_wireframe 2;

beacons.webm

@Rainyan Rainyan marked this pull request as ready for review October 28, 2025 15:45
@Rainyan Rainyan requested a review from Agiel October 28, 2025 15:46
@Rainyan Rainyan requested a review from a team November 1, 2025 11:26
@Rainyan Rainyan requested a review from a team November 3, 2025 05:55
@Rainyan Rainyan merged commit 19e0fe2 into NeotokyoRebuild:master Nov 11, 2025
7 checks passed
@Rainyan Rainyan deleted the bug/spec-beacons branch November 11, 2025 09:03
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

Successfully merging this pull request may close these issues.

Ghost beacon max distance is incorrect Spectators can see ghost markers before the ghost carrier does

3 participants