Skip to content

fix: add fire lines support for streaming/protobuf playback mode#122

Merged
fank merged 1 commit intomainfrom
fix/firelines-streaming-mode
Feb 3, 2026
Merged

fix: add fire lines support for streaming/protobuf playback mode#122
fank merged 1 commit intomainfrom
fix/firelines-streaming-mode

Conversation

@fank
Copy link
Member

@fank fank commented Feb 3, 2026

Summary

  • Fire lines (projectile trajectories) were not appearing when using streaming mode with protobuf format
  • Added framesFired support to protobuf schema and updated all layers of the stack
  • Fixed streaming mode playback loop to draw fire lines
  • Fixed getLatLng() to work correctly in streaming mode

Root Causes

  1. Missing protobuf schema field: The protobuf schema lacked framesFired data for entities
  2. Missing playback code: The streaming mode playback loop didn't include fire line drawing code (only JSON mode had it)
  3. Position retrieval bug: getLatLng() tried to read from empty _positions array in streaming mode instead of getting position from marker
  4. Off-by-one bug: firedOnFrame() loop condition was i < length - 1 instead of i < length

Changes

Backend

  • Add FiredFrame message to protobuf schema (ocap.proto)
  • Add FiredFrame struct and FramesFired field to EntityDef (engine.go)
  • Update parser to extract framesFired from JSON recordings (parser_v1.go)
  • Update protobuf writer to include framesFired in manifest (writer_protobuf_v1.go)

Frontend

  • Update protobuf decoder to read framesFired field (protobuf.js)
  • Add fire line drawing code to streaming mode playback loop (ocap.js)
  • Fix getLatLng() to return marker position in streaming mode (ocap.entity.js)
  • Fix off-by-one bug in firedOnFrame() loop condition (ocap.unit.js)

Test plan

  • Load a recording with fire events in streaming mode
  • Verify fire lines appear during playback
  • Verify fire lines toggle works correctly
  • Verify JSON mode still works (regression test)

Fire lines (projectile trajectories) were not appearing when using
streaming mode with protobuf format because:

1. The protobuf schema lacked framesFired data for entities
2. The streaming mode playback loop didn't include fire line drawing
3. getLatLng() couldn't retrieve entity positions in streaming mode

Changes:
- Add FiredFrame message to protobuf schema (ocap.proto)
- Update parser to extract framesFired from JSON recordings
- Update protobuf writer to include framesFired in manifest
- Update frontend decoder to read framesFired from protobuf
- Add fire line drawing code to streaming mode playback loop
- Fix getLatLng() to return marker position in streaming mode
- Fix off-by-one bug in firedOnFrame() loop condition
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/storage 56.61% (-0.53%) 👎
github.com/OCAP2/web/pkg/schemas/protobuf/v1 0.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/storage/engine.go 63.64% (ø) 33 21 12
github.com/OCAP2/web/internal/storage/parser_v1.go 54.78% (-2.75%) 774 (+70) 424 (+19) 350 (+51) 👎
github.com/OCAP2/web/internal/storage/writer_protobuf_v1.go 76.57% (+0.01%) 367 (+13) 281 (+10) 86 (+3) 👍
github.com/OCAP2/web/pkg/schemas/protobuf/v1/ocap.pb.go 0.00% (ø) 0 0 0

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.

@fank fank merged commit 0800ab5 into main Feb 3, 2026
2 checks passed
@fank fank deleted the fix/firelines-streaming-mode branch February 3, 2026 23:51
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