Repository navigation
SDK: record scene event keys and counter directive elements, carry directive progress - #122
Merged
stanuwu merged 6 commits intoSep 27, 2026
Conversation
Fozkais
force-pushed
the
sdk-scene-keys-and-directive-elements
branch
from
September 18, 2026 00:52
939651b to
e581d0b
Compare
Contributor
Author
|
updated to match/adapt with 0.5.0 changes |
Fozkais
force-pushed
the
sdk-scene-keys-and-directive-elements
branch
from
September 21, 2026 14:18
8c0d27c to
83bf426
Compare
A scene resource references its event graph; the graph holds the gates the server publishes with set_scene_events, each carrying an event key and its ordinal in the scene's progression. The pack now carries one row per gate, ordered by scene slot then gate, with the resource and graph tags the row was read from. The catalog exposes the section and a per-slot range, and relation validation refuses a pack whose keys do not belong to a type-43 slot with exactly one resource of the stated tag. Format version 39.
The generator follows each scene resource to its graph, requires exactly one typed array of gate elements, checks every element opens with the graph's tag and the gate class, and records its key and ordinal. A graph that cannot be read, or a malformed one, is logged and leaves the scene without keys; only a topology inconsistency fails the build. Rows are checked against the inventory before composition and published to Lua as event_keys on each scene symbol, with the count in the manifest.
…iption A packed type-68 element is four localized string references and a flag word. The generator required a description and dropped the counter variant of a directive, authored with a progress label and no description. An element is now kept when it has a title and either text; the progress label, its source tags and the authored flag word travel with the row, and the counter bit is exposed to Lua as `counter` beside `progress`.
The type-68 encoder wrote the four signed lane values as zero, so a counter
element could only show 0 / 0. The preset now carries them and the encoder
writes them as authored; the inactive lanes stay at zero and the body keeps its
shape. set_directive accepts `progress = { current, maximum, ... }`, one to four
int32 values, and refuses it on an element whose authored flags declare no
counter, since the HUD would ignore the values. The resolved element definition
carries the flag word for that check.
The page walked every directive element of the pack for each occurrence of the state, and resolved the binding, the lease and the scriptable route again for every element it kept; each of those resolutions then scanned the whole element section once more to check the element's identity. With the counter elements now in the section the page dropped the game to 12 fps. Elements are written in slot, name hash then element order without repeats; the relation check now requires it, and slot_directive_elements returns one slot's elements by binary search. The page walks the type-68 slots of the state's objects, resolves each slot once with directives_availability and draws its elements from that range. prepare_directive checks the identity in the same range. A description or progress label is drawn only when authored; the missing marker was printed before.
Reach the gate table through the graph's own field instead of scanning the blob, and check the graph's class on the way. Drop a scene's keys when one gate is malformed, so a misread graph yields no keys. Log a scene with no graph at debug; it is not a fault. Key a directive by its progress label only when it has no description, so shipped scripts keep their title keys. Publish a scene's event keys from the sorted section range instead of a full scan. Move the key collector into the file's anonymous namespace and give build() its comment back. Delete the per-slot event key accessor nothing calls. Bump the pack version to 42; 41 is taken on master. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
stanuwu
force-pushed
the
sdk-scene-keys-and-directive-elements
branch
from
September 27, 2026 16:10
83bf426 to
ab796ea
Compare
Owner
|
Merged, thanks. |
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
set_scene_eventsand the gate's ordinal in the scene's progression. A graph that cannot be read or does not have the expected shape leaves the scene without keys and is logged, never refused.set_directivepublishes. The type-68 encoder wrote the four signed lane values as zero, so a counter could only show 0 / 0.event_keyson each scene symbol,progressandcounteron eachmission.Directiveentry, andprogress = { current, maximum }onset_directive.event_keysis the authored setscene:send_event{ key }accepts for that scene; the call itself only bounds the key.Files Modified
Pack Format
Sunrise/src/state/activity_sdk/format.hauthoredSceneEventKeyssection at the end of the section index, with its rowAuthoredSceneEventKey(scene slot, resource tag, graph tag, gate offset, ordinal, key, flags), and the graph layout: the graph field of a resource, the typed array marker, the gate array and element classes, the element size, the key and ordinal offsets, and a gate bound.DirectiveElementgainsprogress, its source tags andflags.Sunrise/src/state/activity_sdk/activity_sdk_loader.cppSunrise/src/state/activity_sdk/generation/pack_writer.hSunrise/src/state/activity_sdk/generation/activity_sdk_pack_writer.cppSunrise/src/state/activity_sdk/runtime.hSunrise/src/state/activity_sdk/activity_sdk_catalog.cppCatalog::authored_scene_event_keys()andslot_authored_scene_event_keys(), which returns one contiguous range per type-43 slot and relies on the section's slot ordering, as the resource accessor does.Sunrise/src/state/activity_sdk/activity_sdk_relation_validation.cppSunrise/src/state/activity_sdk/activity_sdk_structure_validation.cppauthored_scene_event_keyscheck: every row names a type-43 slot that holds exactly one resource of the stated tag, flags are exact, key and graph are set, and rows come in slot then gate order without repeats.SDK Generation
Sunrise/src/client/content/activity/activity_sdk_authored_scene_inventory.hSunrise/src/client/content/activity/activity_sdk_authored_scene_internal.hSunrise/src/client/content/activity/activity_sdk_authored_scene_inventory.cppSunrise/src/client/content/activity/activity_sdk_authored_scene_validation.cppSunrise/src/client/content/activity/activity_sdk_native_pack_text.cppSunrise/src/client/content/activity/activity_sdk_pack_composer.hSunrise/src/client/content/activity/activity_sdk_pack_composer.cppSunrise/src/client/content/activity/activity_sdk_pack_composer_rows.cppSunrise/src/client/content/activity/activity_sdk_pack_composer_validate.cppSunrise/src/client/content/activity/activity_sdk_native_pack_pipeline.cppSunrise/src/client/content/activity/activity_sdk_lua_artifacts.hSunrise/src/client/content/activity/activity_sdk_lua_publish.cppSunrise/src/client/content/activity/activity_sdk_lua_contract.cppSunrise/src/client/content/activity/activity_sdk_lua_catalog_contract.cppSunrise/src/client/content/activity/activity_sdk_lua_missions.cppevent_keys = { ... }in gate order on each scene symbol and the section count in the manifest.progressandcounteron amission.Directiveentry when authored; a counter element takes its key from its progress label, since it shares its title with the described one. DeclaresSunriseDirectiveand theprogressargument in the Lua contract and the new directive fields in the catalog contract.Server
Sunrise/src/middleware/bap/activity_message/scriptable_auth_body.hSunrise/src/middleware/bap/activity_message/activity_scriptable_auth_mission_body_codec.cppType68Presetcarries the four signed lane values; the encoder writes them as given for the active lane and zero for the inactive ones. The body keeps its shape.write_directive_entrytakes them after the navpoint name and bubble hashes and the waypoint reference.Sunrise/src/server/activity/mission/mission_script_vm.hSunrise/src/server/activity/mission/mission_script_sdk_bridge.cppSunrise/src/server/activity/mission/mission_script_lua_presentation_api.cppset_directiveacceptsprogress, one to four int32 values, beside the other named arguments, and refuses it on an element that declares no counter, since the HUD would ignore the values.Sunrise/src/server/ui/activity_host/activity_host_sdk_mission_view.cppValidation
e581d0bpassed.activity_sdk_scene_graphresult was logged. For scenes whose graphs were decoded by hand from their packages, the exported keys match in count, value and order, including the shared opening gate (ordinal -1) and scenes with 1, 3, 5 and 10 gates.set_directive{ directive = ..., progress = { 0, 3 } }shows the element's title once with " 0 / 3"; re-sending it with{ 1, 3 }updates the counter in place without a new banner.Notes
0x2and0x8occur in the installed content and are not named.set_directivefills one active lane, as before; the three-lane body is not exposed further.