Add territory and player packed event import

This commit is contained in:
Jan Petykiewicz 2026-04-15 19:15:47 -07:00
commit ca208f74e0
26 changed files with 1912 additions and 272 deletions

View file

@ -0,0 +1,71 @@
{
"format_version": 1,
"fixture_id": "packed-event-ordinary-named-company-territory-overlay-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving named-territory company-territory ordinary rows bind exactly and execute through the normal runtime path."
},
"state_import_path": "packed-event-ordinary-named-company-territory-overlay.json",
"commands": [
{
"kind": "service_trigger_kind",
"trigger_kind": 7
}
],
"expected_summary": {
"calendar_projection_source": "base-snapshot-preserved",
"calendar_projection_is_placeholder": false,
"company_count": 3,
"active_company_count": 3,
"player_count": 2,
"territory_count": 2,
"company_territory_track_count": 3,
"packed_event_collection_present": true,
"packed_event_record_count": 1,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 1,
"packed_event_parity_only_record_count": 1,
"event_runtime_record_count": 1,
"total_event_record_service_count": 1,
"total_trigger_dispatch_count": 1,
"total_company_cash": 734
},
"expected_state_fragment": {
"companies": [
{
"company_id": 1,
"current_cash": 444
},
{
"company_id": 2,
"current_cash": 90
},
{
"company_id": 3,
"current_cash": 200
}
],
"packed_event_collection": {
"records": [
{
"import_outcome": "imported",
"decoded_conditions": [
{
"kind": "company_territory_numeric_threshold",
"target": {
"kind": "selected_company"
},
"territory": {
"kind": "ids",
"ids": [7]
},
"metric": "total",
"comparator": "ge",
"value": 10
}
]
}
]
}
}
}

View file

@ -0,0 +1,9 @@
{
"format_version": 1,
"import_id": "packed-event-ordinary-named-company-territory-overlay",
"source": {
"description": "Overlay import combining named-territory runtime context with the real company-territory threshold sample."
},
"base_snapshot_path": "packed-event-territory-player-overlay-base-snapshot.json",
"save_slice_path": "packed-event-ordinary-named-company-territory-save-slice.json"
}

View file

@ -0,0 +1,144 @@
{
"format_version": 1,
"save_slice_id": "packed-event-ordinary-named-company-territory-save-slice",
"source": {
"description": "Tracked save-slice document with a real named-territory company-territory threshold row gating Company Cash.",
"original_save_filename": "captured-ordinary-named-company-territory.gms",
"original_save_sha256": "ordinary-named-company-territory-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"proves exact named-territory binding for company-territory thresholds"
]
},
"save_slice": {
"file_extension_hint": "gms",
"container_profile_family": "rt3-classic-save-container-v1",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"trailer_family": null,
"bridge_family": null,
"profile": null,
"candidate_availability_table": null,
"special_conditions_table": null,
"event_runtime_collection": {
"source_kind": "packed-event-runtime-collection",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"container_profile_family": "rt3-classic-save-container-v1",
"metadata_tag_offset": 28928,
"records_tag_offset": 29184,
"close_tag_offset": 29696,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 46,
"live_record_count": 1,
"live_entry_ids": [46],
"decoded_record_count": 1,
"imported_runtime_record_count": 1,
"records": [
{
"record_index": 0,
"live_entry_id": 46,
"payload_offset": 29240,
"payload_len": 176,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 7,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 7,
"primary_selector_0x7f0": 99,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 2,
"modifier_flag_0x7fa": 0,
"grouped_target_scope_ordinals_0x7fb": [0, 1, 1, 1],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [-1, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 1,
"standalone_condition_rows": [
{
"row_index": 0,
"raw_condition_id": 2323,
"subtype": 0,
"flag_bytes": [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"candidate_name": "Appalachia",
"comparator": "ge",
"metric": "Company-Territory Track Pieces",
"semantic_family": "numeric_threshold",
"semantic_preview": "Test Company-Territory Track Pieces >= 10",
"requires_candidate_name_binding": true,
"notes": [
"condition row carries candidate-name side string"
]
}
],
"negative_sentinel_scope": {
"company_test_scope": "selected_company_only",
"player_test_scope": "disabled",
"territory_scope_selector_is_0x63": true,
"source_row_indexes": [0]
},
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 2,
"descriptor_label": "Company Cash",
"target_mask_bits": 1,
"parameter_family": "company_finance_scalar",
"opcode": 8,
"raw_scalar_value": 444,
"value_byte_0x09": 1,
"value_dword_0x0d": 12,
"value_byte_0x11": 2,
"value_byte_0x12": 3,
"value_word_0x14": 24,
"value_word_0x16": 36,
"row_shape": "multivalue_scalar",
"semantic_family": "multivalue_scalar",
"semantic_preview": "Set Company Cash to 444 with aux [2, 3, 24, 36]",
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [
{
"kind": "company_territory_numeric_threshold",
"target": {
"kind": "condition_true_company"
},
"territory": {
"kind": "all_territories"
},
"metric": "total",
"comparator": "ge",
"value": 10
}
],
"decoded_actions": [
{
"kind": "set_company_cash",
"target": {
"kind": "condition_true_company"
},
"value": 444
}
],
"executable_import_ready": true,
"notes": [
"decoded from grounded real 0x4e9a row framing",
"named company-territory threshold lowers both company and territory scope at import time"
]
}
]
},
"notes": [
"real named company-territory threshold sample"
]
}
}

View file

@ -0,0 +1,75 @@
{
"format_version": 1,
"fixture_id": "packed-event-ordinary-named-territory-executable-overlay-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving named-territory ordinary rows bind exactly and execute through the normal runtime path."
},
"state_import_path": "packed-event-ordinary-named-territory-executable-overlay.json",
"commands": [
{
"kind": "service_trigger_kind",
"trigger_kind": 7
}
],
"expected_summary": {
"calendar_projection_source": "base-snapshot-preserved",
"calendar_projection_is_placeholder": false,
"company_count": 3,
"active_company_count": 3,
"player_count": 2,
"territory_count": 2,
"company_territory_track_count": 3,
"packed_event_collection_present": true,
"packed_event_record_count": 1,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 1,
"packed_event_parity_only_record_count": 1,
"packed_event_blocked_named_territory_binding_count": 0,
"event_runtime_record_count": 1,
"total_event_record_service_count": 1,
"total_trigger_dispatch_count": 1,
"total_company_cash": 1067
},
"expected_state_fragment": {
"companies": [
{
"company_id": 1,
"current_cash": 777
},
{
"company_id": 2,
"current_cash": 90
},
{
"company_id": 3,
"current_cash": 200
}
],
"packed_event_collection": {
"records": [
{
"import_outcome": "imported",
"decoded_conditions": [
{
"kind": "territory_numeric_threshold",
"target": {
"kind": "ids",
"ids": [7]
},
"metric": "track_pieces_total",
"comparator": "ge",
"value": 10
}
]
}
]
},
"event_runtime_records": [
{
"record_id": 45,
"service_count": 1
}
]
}
}

View file

@ -0,0 +1,9 @@
{
"format_version": 1,
"import_id": "packed-event-ordinary-named-territory-executable-overlay",
"source": {
"description": "Overlay import combining named-territory runtime context with the real named-territory threshold sample."
},
"base_snapshot_path": "packed-event-territory-player-overlay-base-snapshot.json",
"save_slice_path": "packed-event-ordinary-named-territory-save-slice.json"
}

View file

@ -103,6 +103,9 @@
"decoded_conditions": [
{
"kind": "territory_numeric_threshold",
"target": {
"kind": "all_territories"
},
"metric": "track_pieces_total",
"comparator": "ge",
"value": 10

View file

@ -23,15 +23,15 @@
"packed_event_collection_present": true,
"packed_event_record_count": 2,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 0,
"packed_event_imported_runtime_record_count": 1,
"packed_event_parity_only_record_count": 1,
"packed_event_unsupported_record_count": 1,
"packed_event_blocked_missing_condition_context_count": 0,
"packed_event_blocked_territory_condition_scope_count": 1,
"packed_event_blocked_territory_condition_scope_count": 0,
"packed_event_blocked_missing_compact_control_count": 0,
"packed_event_blocked_unmapped_real_descriptor_count": 0,
"packed_event_blocked_structural_only_count": 0,
"event_runtime_record_count": 0,
"event_runtime_record_count": 1,
"total_company_cash": 0
},
"expected_state_fragment": {
@ -53,7 +53,7 @@
"payload_family": "real_packed_v1",
"trigger_kind": 6,
"one_shot": true,
"import_outcome": "blocked_territory_condition_scope",
"import_outcome": "imported",
"compact_control": {
"primary_selector_0x7f0": 99,
"grouped_target_scope_ordinals_0x7fb": [0, 1, 2, 3]
@ -81,7 +81,7 @@
{
"kind": "set_company_cash",
"target": {
"kind": "condition_true_company"
"kind": "all_active"
},
"value": 7
}

View file

@ -34,7 +34,7 @@
"live_record_count": 2,
"live_entry_ids": [3, 5],
"decoded_record_count": 1,
"imported_runtime_record_count": 0,
"imported_runtime_record_count": 1,
"records": [
{
"record_index": 0,

View file

@ -0,0 +1,57 @@
{
"format_version": 1,
"fixture_id": "packed-event-player-cash-overlay-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving descriptor 1 Player Cash imports and executes through the ordinary runtime path."
},
"state_import_path": "packed-event-player-cash-overlay.json",
"commands": [
{
"kind": "service_trigger_kind",
"trigger_kind": 6
}
],
"expected_summary": {
"calendar_projection_source": "base-snapshot-preserved",
"calendar_projection_is_placeholder": false,
"company_count": 3,
"player_count": 2,
"territory_count": 2,
"packed_event_collection_present": true,
"packed_event_record_count": 1,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 1,
"event_runtime_record_count": 1,
"total_event_record_service_count": 1,
"total_trigger_dispatch_count": 1
},
"expected_state_fragment": {
"players": [
{
"player_id": 1,
"current_cash": 888
},
{
"player_id": 2,
"current_cash": 250
}
],
"packed_event_collection": {
"records": [
{
"import_outcome": "imported",
"decoded_actions": [
{
"kind": "set_player_cash",
"target": {
"kind": "selected_player"
},
"value": 888
}
]
}
]
}
}
}

View file

@ -0,0 +1,9 @@
{
"format_version": 1,
"import_id": "packed-event-player-cash-overlay",
"source": {
"description": "Overlay import combining player runtime context with the real Player Cash descriptor sample."
},
"base_snapshot_path": "packed-event-territory-player-overlay-base-snapshot.json",
"save_slice_path": "packed-event-player-cash-save-slice.json"
}

View file

@ -0,0 +1,126 @@
{
"format_version": 1,
"save_slice_id": "packed-event-player-cash-save-slice",
"source": {
"description": "Tracked save-slice document with a real player-scoped Player Cash row.",
"original_save_filename": "captured-player-cash.gms",
"original_save_sha256": "player-cash-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"proves descriptor 1 import through the normal runtime path"
]
},
"save_slice": {
"file_extension_hint": "gms",
"container_profile_family": "rt3-classic-save-container-v1",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"trailer_family": null,
"bridge_family": null,
"profile": null,
"candidate_availability_table": null,
"special_conditions_table": null,
"event_runtime_collection": {
"source_kind": "packed-event-runtime-collection",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"container_profile_family": "rt3-classic-save-container-v1",
"metadata_tag_offset": 28928,
"records_tag_offset": 29184,
"close_tag_offset": 29696,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 47,
"live_record_count": 1,
"live_entry_ids": [47],
"decoded_record_count": 1,
"imported_runtime_record_count": 1,
"records": [
{
"record_index": 0,
"live_entry_id": 47,
"payload_offset": 29280,
"payload_len": 140,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 6,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 6,
"primary_selector_0x7f0": 12,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 0,
"modifier_flag_0x7fa": 2,
"grouped_target_scope_ordinals_0x7fb": [0, 1, 1, 1],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [-1, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 1,
"standalone_condition_rows": [
{
"row_index": 0,
"raw_condition_id": -1,
"subtype": 4,
"flag_bytes": [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72],
"candidate_name": null,
"notes": [
"negative sentinel-style condition row id"
]
}
],
"negative_sentinel_scope": {
"company_test_scope": "disabled",
"player_test_scope": "selected_player_only",
"territory_scope_selector_is_0x63": false,
"source_row_indexes": [0]
},
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 1,
"descriptor_label": "Player Cash",
"target_mask_bits": 2,
"parameter_family": "player_finance_scalar",
"opcode": 8,
"raw_scalar_value": 888,
"value_byte_0x09": 1,
"value_dword_0x0d": 12,
"value_byte_0x11": 2,
"value_byte_0x12": 3,
"value_word_0x14": 24,
"value_word_0x16": 36,
"row_shape": "multivalue_scalar",
"semantic_family": "multivalue_scalar",
"semantic_preview": "Set Player Cash to 888 with aux [2, 3, 24, 36]",
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [],
"decoded_actions": [
{
"kind": "set_player_cash",
"target": {
"kind": "condition_true_player"
},
"value": 888
}
],
"executable_import_ready": true,
"notes": [
"decoded from grounded real 0x4e9a row framing",
"player-side negative-sentinel scope lowers player cash at import time"
]
}
]
},
"notes": [
"real player cash descriptor sample"
]
}
}

View file

@ -0,0 +1,158 @@
{
"format_version": 1,
"snapshot_id": "packed-event-territory-player-overlay-base-snapshot",
"source": {
"description": "Base runtime snapshot supplying named-territory and player-selection context for packed-event overlays."
},
"state": {
"calendar": {
"year": 1840,
"month_slot": 1,
"phase_slot": 2,
"tick_slot": 3
},
"world_flags": {
"base.only": true
},
"metadata": {
"base.note": "territory-and-player overlay context"
},
"companies": [
{
"company_id": 1,
"current_cash": 150,
"debt": 80,
"credit_rating_score": 650,
"prime_rate": 5,
"controller_kind": "human",
"track_piece_counts": {
"total": 20,
"single": 5,
"double": 8,
"transition": 1,
"electric": 3,
"non_electric": 17
}
},
{
"company_id": 2,
"current_cash": 90,
"debt": 40,
"credit_rating_score": 480,
"prime_rate": 6,
"controller_kind": "ai",
"track_piece_counts": {
"total": 8,
"single": 2,
"double": 2,
"transition": 0,
"electric": 1,
"non_electric": 7
}
},
{
"company_id": 3,
"current_cash": 200,
"debt": 10,
"credit_rating_score": 720,
"prime_rate": 4,
"controller_kind": "human",
"track_piece_counts": {
"total": 30,
"single": 10,
"double": 12,
"transition": 2,
"electric": 8,
"non_electric": 22
}
}
],
"selected_company_id": 1,
"players": [
{
"player_id": 1,
"current_cash": 500,
"controller_kind": "human"
},
{
"player_id": 2,
"current_cash": 250,
"controller_kind": "ai"
}
],
"selected_player_id": 1,
"territories": [
{
"territory_id": 7,
"name": "Appalachia",
"track_piece_counts": {
"total": 50,
"single": 10,
"double": 20,
"transition": 5,
"electric": 15,
"non_electric": 35
}
},
{
"territory_id": 8,
"name": "Great Plains",
"track_piece_counts": {
"total": 12,
"single": 4,
"double": 3,
"transition": 1,
"electric": 2,
"non_electric": 10
}
}
],
"company_territory_track_piece_counts": [
{
"company_id": 1,
"territory_id": 7,
"track_piece_counts": {
"total": 12,
"single": 3,
"double": 5,
"transition": 1,
"electric": 4,
"non_electric": 8
}
},
{
"company_id": 2,
"territory_id": 7,
"track_piece_counts": {
"total": 7,
"single": 2,
"double": 2,
"transition": 0,
"electric": 1,
"non_electric": 6
}
},
{
"company_id": 3,
"territory_id": 7,
"track_piece_counts": {
"total": 15,
"single": 5,
"double": 6,
"transition": 2,
"electric": 5,
"non_electric": 10
}
}
],
"event_runtime_records": [],
"candidate_availability": {},
"special_conditions": {},
"service_state": {
"periodic_boundary_calls": 0,
"trigger_dispatch_counts": {},
"total_event_record_services": 0,
"dirty_rerun_count": 0
}
}
}

View file

@ -0,0 +1,39 @@
{
"format_version": 1,
"fixture_id": "packed-event-territory-policy-save-slice-fixture",
"source": {
"kind": "captured-runtime",
"description": "Fixture proving descriptor 3 Territory - Allow All stays parity-only with an explicit blocker."
},
"state_save_slice_path": "packed-event-territory-policy-save-slice.json",
"commands": [
{
"kind": "step_count",
"steps": 1
}
],
"expected_summary": {
"calendar_projection_is_placeholder": true,
"packed_event_collection_present": true,
"packed_event_record_count": 1,
"packed_event_decoded_record_count": 1,
"packed_event_imported_runtime_record_count": 0,
"packed_event_parity_only_record_count": 1,
"packed_event_blocked_territory_policy_descriptor_count": 1,
"event_runtime_record_count": 0
},
"expected_state_fragment": {
"packed_event_collection": {
"records": [
{
"import_outcome": "blocked_territory_policy_descriptor",
"grouped_effect_rows": [
{
"descriptor_label": "Territory - Allow All"
}
]
}
]
}
}
}

View file

@ -0,0 +1,102 @@
{
"format_version": 1,
"save_slice_id": "packed-event-territory-policy-save-slice",
"source": {
"description": "Tracked save-slice document with a real Territory - Allow All row that stays parity-only.",
"original_save_filename": "captured-territory-policy.gms",
"original_save_sha256": "territory-policy-sample-sha256",
"notes": [
"tracked as JSON save-slice document rather than raw .smp",
"keeps descriptor 3 explicit without guessing territory policy mutation semantics"
]
},
"save_slice": {
"file_extension_hint": "gms",
"container_profile_family": "rt3-classic-save-container-v1",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"trailer_family": null,
"bridge_family": null,
"profile": null,
"candidate_availability_table": null,
"special_conditions_table": null,
"event_runtime_collection": {
"source_kind": "packed-event-runtime-collection",
"mechanism_family": "classic-save-rehydrate-v1",
"mechanism_confidence": "grounded",
"container_profile_family": "rt3-classic-save-container-v1",
"metadata_tag_offset": 28928,
"records_tag_offset": 29184,
"close_tag_offset": 29696,
"packed_state_version": 1001,
"packed_state_version_hex": "0x000003e9",
"live_id_bound": 48,
"live_record_count": 1,
"live_entry_ids": [48],
"decoded_record_count": 1,
"imported_runtime_record_count": 0,
"records": [
{
"record_index": 0,
"live_entry_id": 48,
"payload_offset": 29320,
"payload_len": 132,
"decode_status": "parity_only",
"payload_family": "real_packed_v1",
"trigger_kind": 6,
"one_shot": false,
"compact_control": {
"mode_byte_0x7ef": 6,
"primary_selector_0x7f0": 12,
"grouped_mode_0x7f4": 2,
"one_shot_header_0x7f5": 0,
"modifier_flag_0x7f9": 0,
"modifier_flag_0x7fa": 0,
"grouped_target_scope_ordinals_0x7fb": [1, 1, 1, 1],
"grouped_scope_checkboxes_0x7ff": [1, 0, 0, 0],
"summary_toggle_0x800": 1,
"grouped_territory_selectors_0x80f": [7, -1, -1, -1]
},
"text_bands": [],
"standalone_condition_row_count": 0,
"standalone_condition_rows": [],
"negative_sentinel_scope": null,
"grouped_effect_row_counts": [1, 0, 0, 0],
"grouped_effect_rows": [
{
"group_index": 0,
"row_index": 0,
"descriptor_id": 3,
"descriptor_label": "Territory - Allow All",
"target_mask_bits": 5,
"parameter_family": "territory_access_toggle",
"opcode": 1,
"raw_scalar_value": 1,
"value_byte_0x09": 0,
"value_dword_0x0d": 0,
"value_byte_0x11": 0,
"value_byte_0x12": 0,
"value_word_0x14": 0,
"value_word_0x16": 0,
"row_shape": "bool_toggle",
"semantic_family": "bool_toggle",
"semantic_preview": "Set Territory - Allow All to TRUE",
"locomotive_name": null,
"notes": []
}
],
"decoded_conditions": [],
"decoded_actions": [],
"executable_import_ready": false,
"notes": [
"decoded from grounded real 0x4e9a row framing",
"territory policy mutation remains parity-only in this slice"
]
}
]
},
"notes": [
"real territory policy descriptor sample"
]
}
}