Out-of-Combat Protocol: Syndrome of Silence Roguelike Assistant
About 1140 wordsAbout 4 min
Tips
Please note that JSON files do not support comments. Any comments in the text are for demonstration only and should not be copied directly.
Resource Location
Related resources are stored under assets/resource/data/sos.
Field Description
Top-Level Structure
{
"types": [], // Array of node types, listing all possible node types
"<NodeTypeName>": {} // Configuration for each node type
}Node Type List
The types field defines all supported node types:
Completed Node- Node that has been completedMain Path- Main story eventEncounter on the Road- Side eventTreasure Site- Obtain treasureRest Area- Recovery and restShopping Opportunity- Spend "Goldfinch Coins" to buy itemsCraftsman's Hand- Upgrade and replace creationsEncounter- Simple battleExtra Encounter- Battle with special rulesConflict- More difficult elite battlePerilous Situation- Increasingly difficult chained battle challengeHard Battle- Extremely dangerous boss battleDialogue- Dialogue event node
Node Configuration Structure
Each node type contains the following fields:
{
"event_name_roi": [x, y, w, h], // Region of interest for event name recognition, null means no event name recognition needed
"actions": [], // Default action sequence (for nodes without event name or for general handling)
"events": {}, // Event-specific action configuration (optional)
"interrupts": [] // List of interrupt handler nodes (optional)
}Node Type Classification
Nodes without event name (directly execute actions):
Shopping OpportunityEncounterExtra EncounterConflictHard BattleCraftsman's Hand
Nodes with event name (need to recognize the specific event, execute the corresponding configuration in events):
Main PathRest AreaTreasure SitePerilous Situation
Action Types
1. RunNode - Run a node
Run a predefined process node
{
"type": "RunNode",
"name": "NodeName"
}Common nodes:
SOSTeamSelect- Team selectionSOSCombat- Battle processSOSContinue- Continue/confirm buttonSOSEventEnd- End eventBackButton- Back buttonSOSConfirm- Confirm button
2. SelectOption - Option selection
Select a dialogue or event option (vertically arranged)
{
"type": "SelectOption",
"method": "OCR" | "HSV", // Recognition method: OCR text recognition or HSV color recognition
"expected": ["Option1", "Option2"], // For OCR: expected text(s) (required)
"order_by": "Vertical", // Sort order: Vertical or Horizontal, default is Vertical (optional)
"index": 0 // Option index, default 0 is the first, -1 is the last (optional)
}OCR method:
- Select option by recognizing text content
expectedcan be a string or an array of strings, matched in order- A separate recognition node is created for each expected value
HSV method:
- Select option by color recognition
- Use the
indexparameter to specify which option to select
3. SelectEncounterOption - Encounter option selection
Specialized for "Encounter on the Road" scenarios (horizontally arranged)
{
"type": "SelectEncounterOption",
"method": "OCR" | "HSV", // Recognition method: OCR text recognition or HSV color recognition
"expected": "Option text", // For OCR: expected text (required)
"order_by": "Vertical", // Sort order for template recognition: Vertical or Horizontal, default is Vertical (optional)
"index": 0 // For HSV: option index, default 0 is the first, -1 is the last (optional)
}OCR method:
- Select option by recognizing text content
expectedis a string specifying the expected text to recognizeorder_byis used for magnifier icon template recognition sorting, default isVertical
HSV method:
- Select option by color recognition
- Use the
indexparameter to specify which option to select order_byis used for magnifier icon template recognition sorting, default isVertical
Interrupt Handler Nodes (Interrupts)
Interrupt handler nodes that may be triggered during action execution:
SOSSelectHarmonic- Select HarmonicSOSHarmonicObtained- Harmonic obtainedSOSSelectArtefact- Select ArtefactSOSArtefactsObtained- Artefact obtainedSOSLoseArtefact- Lose ArtefactSOSSelectResonator- Select ResonatorSOSResonatorObtained- Resonator obtainedSOSStatsUpButton- Stats up buttonSOSStatsUp- Stats upSOSNextMessage- Next messageSOSContinue- Continue buttonSOSDice- Dice event
Event Configuration Examples
Simple Battle Node Example
"Conflict": {
"event_name_roi": null, // No event name recognition needed
"actions": [
{
"type": "RunNode",
"name": "SOSTeamSelect" // 1. Select team
},
{
"type": "RunNode",
"name": "SOSCombat" // 2. Enter battle
}
]
}Complex Event Node Example
"Rest Area": {
"event_name_roi": [858, 72, 132, 33], // Region for event name recognition
"events": {
"Club Visitor": { // Specific event name
"actions": [
{
"type": "RunNode",
"name": "SOSContinue" // 1. Click continue
},
{
"type": "SelectOption",
"method": "HSV",
"index": -1 // 2. Select the last option (HSV recognition)
},
{
"type": "RunNode",
"name": "SOSEventEnd" // 3. End event
}
],
"interrupts": [ // Possible interrupts
"SOSArtefactsObtained",
"SOSStatsUpButton",
"SOSStatsUp",
"SOSLoseArtefact",
"SOSNextMessage"
]
}
}
}Event with Option Recognition Example
"Main Path": {
"event_name_roi": [858, 72, 132, 33],
"events": {
"Journey Begins": {
"actions": [
{
"type": "RunNode",
"name": "SOSContinue"
},
{
"type": "SelectOption",
"method": "OCR",
"expected": [
"Mystery", // Prefer these attributes
"Strength",
"Passion",
"Reaction",
"Perception"
]
},
{
"type": "RunNode",
"name": "SOSEventEnd"
}
],
"interrupts": [
"SOSSelectHarmonic",
"SOSHarmonicObtained",
"SOSStatsUp"
]
}
}
}Configuration Description
ROI Region Description
event_name_roi defines the region for event name recognition, in the format [x, y, width, height]:
x: X coordinate of the top-left cornery: Y coordinate of the top-left cornerwidth: Widthheight: Heightnull: This node does not require event name recognition
Execution Flow
1. Node Selection Phase (SOSSelectNode)
- Use neural network to recognize node type (from the
typesarray) - Click the node and wait for UI response (up to 5 retries)
- If
event_name_roiis configured, recognize the event name in the specified region - Record the current node type and event name
2. Node Processing Phase (SOSNodeProcess)
- Determine whether event name recognition is needed based on node type:
- Nodes without event name: Directly use the action sequence in
actions - Nodes with event name: Find the corresponding event configuration in
events
- Nodes without event name: Directly use the action sequence in
- Execute each action in
actionsin order - Interrupt detection is performed before and after each action
3. Action Execution Mechanism
For each action:
- Try to execute the main action (up to 10 retries)
- If execution fails, traverse the
interruptslist for interrupt detection - If an interrupt event is detected, handle it immediately, then continue the main action
- If all retries fail, return failure
4. Interrupt Detection Mechanism
- Interrupt detection is triggered each time the main action fails
- Traverse the
interruptsarray in order - If an interrupt event is detected, execute the corresponding task immediately
- After handling the interrupt, continue the main action
Notes
- Actions are executed in the order of the
actionsarray - Each action is retried up to 10 times; timeout is considered failure
- Interrupt detection is triggered when the main action fails, not asynchronously
- OCR option recognition matches the
expectedarray in order, stopping at the first match - For HSV method,
index-1 means the last option, 0 means the first - Node click operation waits for UI freeze detection (500ms freeze, 3000ms timeout)
- If event name recognition fails, the entire node process fails and the task stops
- Unadapted events will log an error and stop task execution
Development Suggestions
- When adding new events, first add the event configuration in the corresponding node type's
events - Interrupt nodes should be independently recognizable and executable tasks
- When using OCR option recognition,
expectedshould include all possible correct option texts - For complex event flows, it is recommended to split into multiple small actions for easier debugging and maintenance
