Skip to content

fix: projectile tracking reliability + server-side lifecycle for non-bullet projectiles#88

Merged
fank merged 9 commits intomainfrom
fix/projectile-and-placed-object-tracking
Mar 1, 2026
Merged

fix: projectile tracking reliability + server-side lifecycle for non-bullet projectiles#88
fank merged 9 commits intomainfrom
fix/projectile-and-placed-object-tracking

Conversation

@fank
Copy link
Member

@fank fank commented Mar 1, 2026

Summary

  • Non-bullet projectile server-side lifecycle — Smoke grenades, flares, rockets, and other long-lived projectiles were silently lost on dedicated servers because the client-side Deleted EH doesn't fire reliably due to locality transfer. Non-bullet projectiles now stream position/hit data to the server via CBA events, with the server accumulating and sending the final EVENT:PROJECTILE to the extension. Bullets (shotBullet) remain fully client-side — unchanged. A 120s server-side timeout cleans up orphaned entries if the client crashes.
  • Placed object detonation after placer disconnect — Mines/explosives that detonate after the placing player disconnects never received a PLACED:EVENT, so their markers persisted forever in playback. The server now adds a Local EH to placed objects that re-attaches Explode/Deleted EHs when the object transfers to the server on disconnect.

Files changed

File Change
fnc_eh_fired_clientProjectile.sqf New — client-side EH setup for non-bullet projectiles, streams data to server
fnc_eh_fired_server.sqf Distributes new function, adds trackedProjectiles hashmap, 4 CBA handlers + timeout PFH, placed object Local EH fallback
fnc_eh_fired_client.sqf Routes shotBullet → clientBullet, everything else → clientProjectile
fnc_eh_fired_clientBullet.sqf Cleaned up: removed PFH failsafe and sent flag (non-bullets handled by new file)
XEH_prep.sqf Registered new function

Test plan

  • Fire LMG (shotBullet) — verify bullets tracked as before, no server-side lifecycle events
  • Throw smoke grenade — verify EVENT:PROJECTILE arrives with positions (PFH sampling)
  • Throw frag grenade near AI — verify hit data populated
  • Throw smoke grenade and disconnect — verify event still arrives (PFH failsafe or timeout)
  • Place mines, disconnect, let AI trigger — verify mine markers disappear in playback
  • Place mines, stay connected, let AI trigger — verify no duplicate events
  • Fire shotgun (submunitions) — verify children tracked as bullets
  • Check RPT logs for script errors

…s after disconnect

Two issues fixed:

1. Non-bullet projectiles (smoke grenades, flares) never reach the extension
   on dedicated servers. The Deleted EH doesn't fire reliably for long-lived
   projectiles due to locality transfer or engine cleanup bypassing it.
   Fix: the per-frame handler (which already runs for non-bullet projectiles)
   now holds a direct reference to the data array and acts as a failsafe
   sender when it detects isNull. A shared sent flag at data index 20
   prevents duplicate sends with the Deleted EH.

2. Placed objects (mines, explosives) that detonate after the placer
   disconnects never get a PLACED:EVENT, so their markers persist forever
   in playback. The client-side Explode/Deleted EHs are lost on disconnect.
   Fix: the server adds a Local EH to placed objects that re-attaches
   Explode/Deleted EHs when the object transfers to the server, ensuring
   detonation is captured regardless of client connectivity.
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical issues in projectile and placed object tracking within the recording system. It introduces robust mechanisms to ensure that long-lived projectiles and objects placed by disconnecting players are correctly tracked and their lifecycle events are captured, improving the accuracy and completeness of recorded data.

Highlights

  • Non-bullet Projectile Tracking: Implemented a per-frame handler with a direct reference to projectile data and a shared sent flag to ensure reliable tracking of long-lived projectiles (e.g., smoke grenades, flares) on dedicated servers, preventing silent failures when the Deleted event handler is unreliable.
  • Placed Object Detonation: Added a server-side Local event handler to placed objects (e.g., mines) to re-attach Explode and Deleted event handlers when the placing player disconnects, ensuring their detonation or deletion is captured in playback regardless of client connectivity.
Changelog
  • addons/recorder/fnc_eh_fired_clientBullet.sqf
    • Initialized a new data index (20) as a boolean sent flag to prevent duplicate event sends.
    • Modified the Deleted event handler to check and set this sent flag, exiting early if the event has already been sent by the per-frame handler.
    • Updated the per-frame handler for non-bullet projectiles to pass the _data array by reference, allowing it to persist after projectile deletion, and added logic to act as a failsafe sender if the Deleted EH fails, using the new sent flag.
  • addons/recorder/fnc_eh_fired_server.sqf
    • Added a Local event handler to placed objects, which triggers when the object becomes local to the server (e.g., upon placer disconnect).
    • Inside this Local handler, Explode and Deleted event handlers are re-attached to the placed object, ensuring that detonation and deletion events are captured server-side even if the original client-side handlers are lost.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two important fixes for projectile and placed object tracking. For long-lived projectiles, a per-frame handler now acts as a failsafe to ensure data is sent even if the Deleted event handler doesn't fire, using a flag to prevent duplicate events. For placed objects like mines, a server-side Local event handler is added to re-attach lifecycle event handlers when the placer disconnects, ensuring detonations are always captured. The changes are logical and address the described issues effectively. I have one suggestion to improve maintainability by reducing code duplication in the new server-side fallback logic.

fank added 7 commits March 1, 2026 18:49
Non-bullet projectiles (grenades, smoke, rockets) move from client-side
to server-side data accumulation to fix reliability issues on dedicated
servers where the Deleted EH doesn't fire due to locality transfer.
…pdate headers

Remove PFH failsafe and sent flag from fnc_eh_fired_clientBullet.sqf — non-bullet
projectiles now use fnc_eh_fired_clientProjectile.sqf (server-side lifecycle).
Update file comment headers to reflect the new architecture.
@fank fank changed the title fix: projectile tracking for long-lived projectiles and placed objects after disconnect fix: projectile tracking reliability + server-side lifecycle for non-bullet projectiles Mar 1, 2026
The Local EH is not supported on mine/explosive objects (engine error:
"Unknown enum value: Local"). Replace with a tracked hashmap + 30s
periodic check that detects when placed objects transfer to the server
and re-adds Explode/Deleted EHs.
@fank fank merged commit 04a1737 into main Mar 1, 2026
1 check passed
@fank fank deleted the fix/projectile-and-placed-object-tracking branch March 1, 2026 18:37
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.

1 participant