Skip to content

feat: Implement ID-based object model#171

Merged
davidbits merged 3 commits intomasterfrom
feat/object-ids
Mar 5, 2026
Merged

feat: Implement ID-based object model#171
davidbits merged 3 commits intomasterfrom
feat/object-ids

Conversation

@davidbits
Copy link
Copy Markdown
Owner

Closes #135

This pull request introduces a comprehensive ID-based identity model for all major simulation objects, moving away from the previous name-based identification system. This change addresses the fragility of relying on unique names and provides a more robust internal mechanism for object referencing and management throughout the simulation core and UI.

Key Changes

Core & C++ API (libfers)

  • A new SimId type (a 64-bit integer) and SimIdGenerator have been introduced to create unique, structured IDs for simulation objects. The ID is composed of a 16-bit type code and a 48-bit counter.
  • All core simulation entities, including Platform, Transmitter, Receiver, Target, Antenna, Waveform, and Timing, are now assigned a unique SimId upon creation.
  • Internal data structures and lookup functions (e.g., in the World class) have been refactored to use SimId as the primary key instead of std::string names.
  • The public C API in libfers/api.h has been updated to reflect these changes. Functions like fers_get_antenna_pattern and structs like fers_visual_link_t now operate with IDs instead of names.

Frontend (fers-ui)

  • A corresponding ID generation utility (idUtils.ts) has been added to the frontend to manage object identities within the React/Zustand state, replacing the previous uuid implementation.
  • The application state model (Zustand store) has been updated to use the new numeric string ID format for all relevant objects and assets.
  • UI components that referenced objects by name, such as LinkVisualizer, AntennaPatternMesh, and SceneTree, have been modified to use IDs for data fetching and state management.
  • Selection logic in the UI has been enhanced to differentiate between selecting a top-level item (like a Platform) and a nested component (like a Transmitter).

Serialization and Compatibility

  • No Change to User-Facing XML: The user-facing .xml scenario files remain unchanged. They continue to use string names for references to maintain backward compatibility and user-friendliness.
  • On-the-Fly ID Generation: When an XML scenario is loaded, the C++ parser now generates SimIds for all objects and resolves the name-based references into ID-based ones internally. It also enforces name uniqueness at load time to prevent ambiguity.
  • Internal Data Format: The internal JSON payload exchanged between the UI and the C++ backend now uses this new ID system for all object identification and references.

Signed-off-by: David Young <davidsamuelyoung@protonmail.com>
Signed-off-by: David Young <davidsamuelyoung@protonmail.com>
…lated entities

Signed-off-by: David Young <davidsamuelyoung@protonmail.com>
@davidbits davidbits self-assigned this Mar 5, 2026
@davidbits davidbits added type: enhancement A new feature or a request for an improvement. scope: core-simulator Related to the C++ core engine (fers). scope: ui Related to the Tauri/React UI (fers-ui). scope: schema Related to the XML schema definition. labels Mar 5, 2026
@davidbits davidbits merged commit b3848fa into master Mar 5, 2026
@davidbits davidbits deleted the feat/object-ids branch March 5, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: core-simulator Related to the C++ core engine (fers). scope: schema Related to the XML schema definition. scope: ui Related to the Tauri/React UI (fers-ui). type: enhancement A new feature or a request for an improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Implement UUIDs for world objects

1 participant