Skip to content

feat: track all marker property updates with diff detection#87

Merged
fank merged 2 commits intomainfrom
feat/marker-updates
Mar 1, 2026
Merged

feat: track all marker property updates with diff detection#87
fank merged 2 commits intomainfrom
feat/marker-updates

Conversation

@fank
Copy link
Member

@fank fank commented Mar 1, 2026

Summary

  • MarkerUpdated handler now extracts all mutable marker properties (text, color, size, type, brush, shape) in addition to position/direction/alpha
  • Adds HashMap-based diff tracking — only sends :MARKER:STATE: to the extension when at least one property actually changed
  • Converts color from config name to hex on the client side (matching CREATED handler behavior)
  • Seeds state cache on marker creation, cleans up on deletion

Context

Communities use markers that dynamically update text/color during gameplay (e.g., FPS display markers that call setMarkerText/setMarkerColor every 15 seconds). Previously OCAP only captured position/direction/alpha on MarkerUpdated — text, color, and other changes were silently discarded.

Companion extension PR: OCAP2/extension#new

Test plan

  • Review SQF diff for correctness of property extraction, color conversion, cache seeding/comparison/cleanup
  • In-game test: create marker, update its text/color, verify OCAP captures the changes

@fank
Copy link
Member Author

fank commented Mar 1, 2026

Companion extension PR: OCAP2/extension#136

@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 significantly upgrades the OCAP system's ability to track dynamic marker changes. By extending the MarkerUpdated handler to capture a comprehensive set of mutable properties and introducing a robust diff-tracking mechanism, it ensures that only meaningful updates are processed and transmitted. This enhancement addresses a long-standing issue where many marker property changes were previously ignored, providing a more accurate and efficient recording of in-game marker activity.

Highlights

  • Expanded Marker Property Tracking: The MarkerUpdated handler now captures text, color, size, type, brush, and shape, in addition to position, direction, and alpha.
  • Implemented Diff Detection: A HashMap-based system tracks marker states, ensuring :MARKER:STATE: events are only sent when properties genuinely change.
  • Standardized Color Format: Marker colors are now converted from config names to hex format on the client side, aligning with the CREATED handler's behavior.
  • Enhanced State Management: The system now seeds the state cache upon marker creation and cleans it up when markers are deleted.
Changelog
  • addons/recorder/fnc_handleMarkers.sqf
    • Initialized GVAR(trackedMarkerStates) as a new HashMap for storing marker property states.
    • Modified the marker creation logic to seed GVAR(trackedMarkerStates) with the initial properties of newly created markers.
    • Updated the marker update event (:MARKER:STATE:) to include all mutable properties (text, color, size, type, brush, shape) in addition to position, direction, and alpha.
    • Added logic to remove a marker's state from GVAR(trackedMarkerStates) when the marker is deleted.
    • Expanded the marker update detection section to extract all relevant properties: position, direction, alpha, text, color, size, type, brush, and shape.
    • Implemented a color conversion mechanism to transform marker config names (like "Default") into HTML hex color codes.
    • Introduced a diff-checking mechanism that compares the current marker state with its last known state from GVAR(trackedMarkerStates), preventing redundant :MARKER:STATE: events.
    • Updated the CBA_fnc_serverEvent call for "UPDATED" markers to pass the full set of extracted and converted properties.
Activity
  • The author provided a detailed summary outlining the changes, context, and a two-part test plan.
  • The test plan includes a review of the SQF diff and an in-game verification step.
  • A related extension PR (OCAP2/extension#new) was referenced, indicating a coordinated change across repositories.
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 aims to enhance marker tracking by capturing all property updates and implementing a diff-based approach to minimize network traffic. This is a valuable improvement. However, the current implementation of the diff-checking logic has a critical flaw where client-side code attempts to access a server-only variable, which would lead to script errors. My review includes two related comments that move the diff-checking logic to the server, which will resolve the issue and allow the feature to function as intended.

GVAR(trackedMarkerStates) is a server-only variable. The diff checking
was incorrectly placed in the client-side MarkerUpdated EH where clients
don't have access to it. Moved to the server-side UPDATED case handler.
@fank fank merged commit 96bb445 into main Mar 1, 2026
1 check passed
@fank fank deleted the feat/marker-updates branch March 1, 2026 13:55
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