Skip to content

feat: add projectile marker support for grenades and smokes#79

Merged
fank merged 3 commits intomainfrom
feat/projectile-markers
Feb 4, 2026
Merged

feat: add projectile marker support for grenades and smokes#79
fank merged 3 commits intomainfrom
feat/projectile-markers

Conversation

@fank
Copy link
Member

@fank fank commented Feb 4, 2026

Summary

  • Thrown projectiles (grenades, smokes) are now exported as markers in the v1 JSON format
  • Enables the web viewer to display grenade/smoke icons with trajectory positions
  • Other projectiles (bullets, rockets) continue to use fire lines

Changes

  • Add ProjectileEventToProjectileMarker converter that extracts icon filename from Arma path and creates marker with trajectory states
  • Modify handleProjectileEvent to route thrown projectiles (Weapon="throw") to AddMarker instead of RecordFiredEvent
  • Add tests for projectile marker conversion

Marker Format

The marker format follows web viewer expectations:

  • Type: magIcons/<icon_filename>.paa
  • Side: GLOBAL (-1)
  • OwnerID: firer's OCAP ID
  • Positions: trajectory from throw to impact

Example Output

[
  "magIcons/gear_smokegrenade_white_ca.paa",
  "Smoke Grenade (White)",
  243,
  -1,
  5,
  "FFFFFF",
  -1,
  [[243, [8345.61, 18302.5], 0, 1], [245, [8364.59, 18331.1], 0, 1]],
  [1, 1],
  "ICON",
  "Solid"
]

Test plan

  • Unit tests for ProjectileEventToProjectileMarker pass
  • Unit tests for empty icon fallback pass
  • Full test suite passes
  • Manual test with Arma 3 recording containing grenades/smokes

fank added 3 commits February 4, 2026 12:17
Thrown projectiles (grenades, smokes) are now exported as markers in the
v1 JSON format instead of fire lines. This enables the web viewer to
display grenade/smoke icons with trajectory positions.

Changes:
- Add ProjectileEventToProjectileMarker converter that extracts icon
  filename from Arma path and creates marker with trajectory states
- Modify handleProjectileEvent to route thrown projectiles (Weapon="throw")
  to AddMarker instead of RecordFiredEvent
- Add tests for projectile marker conversion

The marker format follows web viewer expectations:
- Type: magIcons/<icon_filename>.paa
- Side: GLOBAL (-1)
- OwnerID: firer's OCAP ID
- Positions: trajectory from throw to impact
The M coordinate in LineStringZM now stores the actual frame number
from SQF instead of tickTime. This enables accurate frame-by-frame
animation of projectile markers in the web viewer.

Before: M = tickTime (unused)
After:  M = frameNo (used for marker state CaptureFrame)
- Add EndFrame field to core.Marker
- Set endFrame to last position's frame for projectile markers (when
  grenade explodes/dissipates) instead of -1 (persist forever)
- Regular markers default to -1 via builder (0 treated as -1)
- Update MarkerToCore to set EndFrame: -1 for regular markers
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/extension/v5/internal/handlers 9.87% (ø)
github.com/OCAP2/extension/v5/internal/model/convert 89.92% (+4.21%) 👍
github.com/OCAP2/extension/v5/internal/model/core 0.00% (ø)
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1 100.00% (ø)
github.com/OCAP2/extension/v5/internal/worker 15.54% (-0.32%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/extension/v5/internal/handlers/handlers.go 9.87% (ø) 770 76 694
github.com/OCAP2/extension/v5/internal/model/convert/convert.go 89.92% (+4.21%) 129 (+38) 116 (+38) 13 👍
github.com/OCAP2/extension/v5/internal/model/core/marker.go 0.00% (ø) 0 0 0
github.com/OCAP2/extension/v5/internal/storage/memory/export/v1/builder.go 100.00% (ø) 103 (+3) 103 (+3) 0
github.com/OCAP2/extension/v5/internal/worker/dispatch.go 17.50% (-0.45%) 200 (+5) 35 165 (+5) 👎

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/extension/v5/internal/model/convert/convert_test.go

@fank fank merged commit 4003206 into main Feb 4, 2026
3 checks passed
@fank fank deleted the feat/projectile-markers branch February 4, 2026 12:52
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