fix: expand sparse vehicle positions during streaming conversion#133
Merged
Conversation
Arma 3 vehicles can use a sparse position format where each entry covers a range of frames via [startFrame, endFrame] at index 4. The JSON frontend handles this with range-based lookup (_positionsHasFrames), but the parser assigned sequential frame numbers ignoring the ranges. This caused static vehicles (like DShKs) to disappear after the first frame in streaming playback, and reappear only when moving. Expand sparse entries into dense per-frame positions in the parser and fix calculateEndFrame to use the last sparse range end. Previously converted missions need re-conversion.
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
endFramecalculation for vehicles using sparse position formatProblem
Arma 3 vehicles can use a sparse position format where each position entry covers a range of frames via
[startFrame, endFrame]at index 4. The JSON frontend handles this correctly via range-based lookup (_positionsHasFrames), but the backend parser ignored the frame ranges entirely — it assigned sequential frame numbers (startFrame + arrayIndex), treating all positions as dense.For a static DShK with 1 sparse entry covering frames 0–5000, the parser created only 1 position (frame 0). The streaming writer then only included the entity in frame 0 of the chunk data, causing it to disappear after the first frame and reappear only when it started moving (generating more position entries).
This also caused
calculateEndFrameto returnstartFrame + 1instead of5000, giving wrong entity lifetime metadata.Fix
collectEntityPositions: Detect sparse vehicle positions (entry[4] is[startFrame, endFrame]array) and expand each sparse entry into oneEntityPositionper frame in the rangecalculateEndFrame: For sparse data, use the last entry's frame range end instead ofstartFrame + len(positions) - 1Test plan
TestParserV1_Parse_VehicleSparsePositions— verifies sparse→dense expansion (2 sparse entries → 15 dense positions)TestParserV1_Parse_VehicleSparsePositions_ChunkBuild— end-to-end: static vehicle appears in every frame of built chunkTestParserV1_Parse_VehicleDensePositions_Unaffected— regression: dense vehicle positions unchangedTestParserV1_calculateEndFrame_SparseVehicle— endFrame uses last sparse range end