Skip to content

Refactor projectile tracking to use lightweight array format#43

Merged
fank merged 1 commit intomainfrom
refactor/projectile-tracking-lightweight
Feb 3, 2026
Merged

Refactor projectile tracking to use lightweight array format#43
fank merged 1 commit intomainfrom
refactor/projectile-tracking-lightweight

Conversation

@fank
Copy link
Member

@fank fank commented Feb 3, 2026

Summary

  • Replace hashmap with flat positional array for projectile data (indices 0-18)
  • Remove JSON encoding overhead when sending to extension via :PROJECTILE: command
  • Replace non-existent :TIMESTAMP: extension calls with diag_tickTime
  • Rename variable from dataHash to projectileData

Motivation

The previous implementation used a hashmap with JSON encoding, which added unnecessary overhead for high-frequency fired events. This change:

  • Reduces per-projectile data size (~500+ bytes → ~200-300 bytes)
  • Eliminates CBA_fnc_encodeJSON call per projectile
  • Fixes extension errors from missing :TIMESTAMP: handler
  • Aligns with how other commands (:KILL:, :NEW:SOLDIER:STATE:, etc.) send data

Extension Interface Change

The :PROJECTILE: command now receives a flat array instead of JSON:

[firedFrame, firedTime, firerID, vehicleID, vehicleRole, remoteControllerID, 
 weapon, weaponDisplay, muzzle, muzzleDisplay, magazine, magazineDisplay,
 ammo, fireMode, positions, initialVelocity, hitParts, sim, isSub]

Test plan

  • Verify projectile tracking works in-game (fire weapons, check extension receives data)
  • Verify submunitions are tracked correctly (shotguns, cluster munitions)
  • Confirm no more :TIMESTAMP: errors in RPT log

- Replace hashmap with flat positional array for projectile data
- Remove JSON encoding overhead when sending to extension
- Replace non-existent :TIMESTAMP: extension calls with diag_tickTime
- Rename variable from dataHash to projectileData

This reduces per-projectile data size and eliminates unnecessary
encoding/decoding overhead for high-frequency fired events.

Array structure documented in fnc_eh_fired_client.sqf with indices 0-18.
@fank fank merged commit 0ca24cb into main Feb 3, 2026
1 check passed
@fank fank deleted the refactor/projectile-tracking-lightweight branch February 3, 2026 23:30
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