๐ฎ Black Trigram (ํ๊ด) Future State Diagrams
March 19, 2026 ยท View on GitHub
๐ ISMS Alignment: This document follows Hack23 Secure Development Policy architecture documentation requirements.
๐ Related Documentation
| Document | Focus | Description |
|---|---|---|
| Current State Diagram | ๐ฎ Current States | Current game and combat state machines |
| Future Architecture | ๐ Future Vision | Planned architectural enhancements |
| Future Flowchart | ๐ Future Flow | Planned workflow enhancements |
| Data Model | ๐ Data | Type system and data structures |
๐ฏ Overview
This document outlines planned state machine enhancements for Black Trigram (ํ๊ด), documenting future state transitions for multiplayer modes, advanced combat mechanics, and progression systems.
๐ Multiplayer Session States (AWS WebSocket)
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#2979FF','primaryTextColor':'#fff','primaryBorderColor':'#0D47A1','lineColor':'#00C853','secondaryColor':'#FFD600','tertiaryColor':'#FF3D00'}}}%%
stateDiagram-v2
[*] --> Disconnected: App Start
Disconnected --> Authenticating: Login Attempt<br/>Cognito OAuth
state Authenticating {
[*] --> ValidateToken
ValidateToken --> CheckCognito: JWT Token
CheckCognito --> TokenValid: Valid Token
CheckCognito --> TokenInvalid: Invalid/Expired
TokenValid --> RetrieveProfile: DynamoDB Query
TokenInvalid --> LoginFailed
RetrieveProfile --> [*]
LoginFailed --> [*]
}
Authenticating --> Connected: Auth Success<br/>WebSocket Open
Authenticating --> Disconnected: Auth Failed
Connected --> EstablishWebSocket: wss://api.blacktrigram.com/ws
state EstablishWebSocket {
[*] --> WSHandshake
WSHandshake --> SendConnectionInit
SendConnectionInit --> ReceiveConnectionAck
ReceiveConnectionAck --> StoreConnectionId
StoreConnectionId --> [*]
}
EstablishWebSocket --> Idle: WebSocket Ready<br/>Connection ID Stored
Idle --> Matchmaking: Queue for Match<br/>Send joinQueue
Idle --> CreatingLobby: Create Custom Lobby<br/>Lambda: createLobby
Idle --> JoiningLobby: Join Friend<br/>Room Code Entry
Idle --> Disconnected: Logout<br/>Cognito SignOut
state Matchmaking {
[*] --> EnterQueue
EnterQueue --> WaitingForMatch: Queue Position: {n}
WaitingForMatch --> CheckMatches: Lambda: findMatch<br/>Every 5s
CheckMatches --> MatchFound: Opponent Found<br/>ELO Match
CheckMatches --> ExpandSearch: Timeout 3min<br/>Widen ELO Range
ExpandSearch --> CheckMatches
MatchFound --> [*]
}
Matchmaking --> MatchFound: Opponent Located
Matchmaking --> Idle: Cancel Queue<br/>User Cancelled
MatchFound --> VerifyingMatch: Accept Match Prompt<br/>10s Countdown
state VerifyingMatch {
[*] --> ShowMatchInfo
ShowMatchInfo --> WaitForAccept: Opponent: {name}<br/>ELO: {rating}<br/>Ping: {ms}ms
WaitForAccept --> PlayerAccepted: User Accepted
WaitForAccept --> PlayerDeclined: User Declined
WaitForAccept --> Timeout: No Response (10s)
PlayerAccepted --> CheckAllPlayers
CheckAllPlayers --> AllAccepted: All Players Ready
CheckAllPlayers --> SomeoneDeclined: Someone Declined
PlayerDeclined --> [*]
Timeout --> [*]
AllAccepted --> [*]
SomeoneDeclined --> [*]
}
VerifyingMatch --> PreparingMatch: All Players Accept
VerifyingMatch --> Matchmaking: Someone Declined<br/>Return to Queue
CreatingLobby --> CustomLobby: Lobby Created<br/>Room Code: {code}
JoiningLobby --> CustomLobby: Join Success<br/>DynamoDB Query
JoiningLobby --> Idle: Join Failed<br/>Invalid Code
state CustomLobby {
[*] --> WaitingForPlayers
WaitingForPlayers --> ShowLobbyInfo: Room Code: {code}<br/>Players: {n}/2<br/>Settings: {config}
ShowLobbyInfo --> CheckReady: Check Ready Status
CheckReady --> AllReady: All Players Ready
CheckReady --> WaitingForPlayers: Not All Ready
AllReady --> [*]
}
CustomLobby --> PreparingMatch: All Ready<br/>Start Match
CustomLobby --> Idle: Lobby Disbanded<br/>Host Left
state PreparingMatch {
[*] --> LoadMatchData
LoadMatchData --> AllocateRoom: Lambda: allocateRoom<br/>Generate room_id
AllocateRoom --> SyncPlayerData: WebSocket Broadcast<br/>Player States
SyncPlayerData --> LoadGameAssets: 3D Models<br/>Stage Data<br/>Audio Files
LoadGameAssets --> EstablishP2P: WebRTC Setup<br/>STUN/TURN Servers
EstablishP2P --> [*]
}
PreparingMatch --> SyncingGameState: Assets Loaded
PreparingMatch --> Idle: Sync Failed<br/>Connection Error
state SyncingGameState {
[*] --> InitializeP2P
InitializeP2P --> ExchangeICE: ICE Candidates
ExchangeICE --> EstablishConnection: WebRTC Connected
EstablishConnection --> SyncInitialState: Send Game State<br/>{ players, stage, rules }
SyncInitialState --> VerifySync: Hash Verification
VerifySync --> SyncComplete: States Match
VerifySync --> Resync: Hash Mismatch
Resync --> SyncInitialState
SyncComplete --> [*]
}
SyncingGameState --> InMatch: Sync Complete<br/>Ready to Fight
SyncingGameState --> Idle: Sync Failed<br/>Retry Limit
state InMatch {
[*] --> MatchCountdown
MatchCountdown --> ActiveCombat: 3...2...1...FIGHT!
ActiveCombat --> MonitorConnection: Heartbeat 1s Keepalive<br/>Game State Sync ~60fps (Rollback)
MonitorConnection --> ActiveCombat: Connection Stable
MonitorConnection --> ConnectionIssue: Ping > 200ms<br/>Connection Lost
ConnectionIssue --> Reconnecting: Attempt Reconnect<br/>Disconnected Player
ConnectionIssue --> OpponentWaiting: Opponent View<br/>Show "Waiting for Opponent"<br/>Pause Match Timer
ConnectionIssue --> BothDisconnected: Both Players Disconnected<br/>Start Abort Timer (30s)
Reconnecting --> ActiveCombat: Reconnect Success<br/>Resume Match Timer
Reconnecting --> Disconnected: Reconnect Failed (30s)<br/>Forfeit Disconnected Player
OpponentWaiting --> ActiveCombat: Opponent Reconnected<br/>Resume Match Timer
OpponentWaiting --> MatchComplete: Opponent Forfeit<br/>Award Win
BothDisconnected --> MatchComplete: Abort Match<br/>No Contest
ActiveCombat --> RoundComplete: Health โค 0<br/>OR Time Up
RoundComplete --> [*]
}
InMatch --> MatchPaused: Pause Request<br/>ESC Key
InMatch --> MatchComplete: Round End
InMatch --> Disconnected: Connection Lost<br/>Forfeit Match
state MatchPaused {
[*] --> ShowPauseMenu
ShowPauseMenu --> WaitForResume: Resume Option<br/>Forfeit Option
WaitForResume --> UserResume: User Resumes
WaitForResume --> UserForfeit: User Forfeits
UserResume --> [*]
UserForfeit --> [*]
}
MatchPaused --> InMatch: Resume<br/>Continue Fight
MatchPaused --> Idle: Forfeit<br/>Match Lost
state MatchComplete {
[*] --> DetermineWinner
DetermineWinner --> CalculateELO: Apply ELO Algorithm<br/>K-factor: 32
CalculateELO --> UpdateRatings: Lambda: updateRatings<br/>DynamoDB Update
UpdateRatings --> SaveMatchHistory: Lambda: saveMatch<br/>S3 Backup
SaveMatchHistory --> UpdateLeaderboards: DynamoDB GSI<br/>Global Rankings
UpdateLeaderboards --> [*]
}
MatchComplete --> SavingResults: Calculate Results
state SavingResults {
[*] --> SavePlayerStats
SavePlayerStats --> SaveMatchData: DynamoDB PutItem<br/>match_history table
SaveMatchData --> UpdateAchievements: Check Achievement Progress
UpdateAchievements --> GenerateReplay: Save Replay Data<br/>S3 Storage
GenerateReplay --> SendNotifications: SNS<br/>Email/Push
SendNotifications --> [*]
}
SavingResults --> PostMatch: Save Complete
state PostMatch {
[*] --> DisplayStats
DisplayStats --> ShowDamageDealt
ShowDamageDealt --> ShowVPStrikes: 70 VP Breakdown
ShowVPStrikes --> ShowTechniquesUsed: Technique Stats
ShowTechniquesUsed --> ShowELOChange: Rating Change
ShowELOChange --> ShowReplayOption: Watch Replay
ShowReplayOption --> [*]
}
PostMatch --> Idle: Return to Menu<br/>WebSocket Active
note right of Matchmaking
ELO-based matching
ยฑ100 initial range
Expand to ยฑ200 after 3min
Region filtering (Asia, NA, EU)
Latency optimization
Queue position tracking
end note
note right of SyncingGameState
WebRTC P2P connection
Input prediction (rollback netcode)
Lag compensation (up to 100ms)
State hash verification
Automatic desync detection
Reconnect on packet loss
end note
note right of InMatch
60fps target
Real-time state updates
Input buffering (3 frames)
Heartbeat monitoring
Automatic reconnect (30s grace)
Frame-perfect rollback
end note
๐ Progression System States
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#00C853','primaryTextColor':'#fff','primaryBorderColor':'#00796B','lineColor':'#2979FF','secondaryColor':'#FFD600','tertiaryColor':'#FF3D00'}}}%%
stateDiagram-v2
[*] --> Novice: New Player
state Novice {
[*] --> Learning
Learning --> Practicing
Practicing --> FirstVictory
FirstVictory --> [*]
}
Novice --> Apprentice: 10 Matches Won
state Apprentice {
[*] --> BasicMastery
BasicMastery --> VPTraining
VPTraining --> TrigramMastery
TrigramMastery --> [*]
}
Apprentice --> Adept: 50 Matches Won
state Adept {
[*] --> AdvancedTechniques
AdvancedTechniques --> ComboMastery
ComboMastery --> ConsistentPerformance
ConsistentPerformance --> [*]
}
Adept --> Expert: 100 Matches + 60% Win Rate
state Expert {
[*] --> PerfectStrikes
PerfectStrikes --> AdvancedCombat
AdvancedCombat --> CompetitivePlay
CompetitivePlay --> [*]
}
Expert --> Master: 250 Matches + 70% Win Rate
state Master {
[*] --> AllArchetypesMastered
AllArchetypesMastered --> AllStancesMastered
AllStancesMastered --> AllVPsMastered
AllVPsMastered --> [*]
}
Master --> Grandmaster: Tournament Victory
note right of Novice
Learning basics
< 10 wins
Tutorial completion
end note
note right of Master
Elite player
250+ wins
70%+ win rate
All content mastered
end note
๐ Tutorial Progress States
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#FFD600','primaryTextColor':'#000','primaryBorderColor':'#F57F17','lineColor':'#00C853','secondaryColor':'#2979FF','tertiaryColor':'#FF3D00'}}}%%
stateDiagram-v2
[*] --> TutorialStart: Begin Tutorial
TutorialStart --> Lesson1: Basics
state Lesson1 {
[*] --> MovementIntro
MovementIntro --> MovementPractice
MovementPractice --> AttackIntro
AttackIntro --> AttackPractice
AttackPractice --> [*]
}
Lesson1 --> Lesson2: Pass Quiz
state Lesson2 {
[*] --> TrigramIntro
TrigramIntro --> StancePractice
StancePractice --> TransitionDrill
TransitionDrill --> [*]
}
Lesson2 --> Lesson3: Pass Test
state Lesson3 {
[*] --> VPAnatomyIntro
VPAnatomyIntro --> VPCategories
VPCategories --> VPPractice
VPPractice --> PrecisionTest
PrecisionTest --> [*]
}
Lesson3 --> Lesson4: Precision Passed
state Lesson4 {
[*] --> CombatIntro
CombatIntro --> DefensePractice
DefensePractice --> OffensePractice
OffensePractice --> FirstSparring
FirstSparring --> [*]
}
Lesson4 --> Lesson5: Defeat AI Level 1
state Lesson5 {
[*] --> AdvancedTechniques
AdvancedTechniques --> Combos
Combos --> Counters
Counters --> FinalTest
FinalTest --> [*]
}
Lesson5 --> TutorialComplete: Defeat AI Level 3
TutorialComplete --> [*]: Certified
note right of Lesson3
70 Vital Points
Categories explained
Precision training
Realistic effects
end note
๐ค AI Opponent States (Advanced)
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#FF3D00','primaryTextColor':'#fff','primaryBorderColor':'#BF360C','lineColor':'#00C853','secondaryColor':'#FFD600','tertiaryColor':'#2979FF'}}}%%
stateDiagram-v2
[*] --> Analyzing: Match Start
Analyzing --> Passive: Player Aggressive
Analyzing --> Aggressive: Player Passive
Analyzing --> Balanced: Player Balanced
Passive --> Defensive: Take Damage
Passive --> Analyzing: Time Elapsed
Aggressive --> Offensive: Opening Detected
Aggressive --> Analyzing: Attack Failed
Balanced --> Adaptive: Learning Pattern
Defensive --> Countering: Perfect Block
Defensive --> Retreating: Health Low
Offensive --> Pressuring: Combo Successful
Offensive --> Balanced: Attack Blocked
Adaptive --> Exploiting: Pattern Detected
Adaptive --> Balanced: No Pattern
Countering --> Offensive: Counter Success
Countering --> Defensive: Counter Failed
Retreating --> Defensive: Distance Gained
Retreating --> Analyzing: Player Retreated
Pressuring --> Finishing: Health Critical
Pressuring --> Aggressive: Pressure Failed
Exploiting --> Dominating: Consistent Success
Exploiting --> Analyzing: Player Adapted
Finishing --> Victory: KO Achieved
Dominating --> Victory
Victory --> [*]
Analyzing --> [*]: Time Up
Passive --> [*]: Time Up
Defensive --> [*]: Time Up
note right of Analyzing
Study player patterns
Identify weaknesses
Adjust difficulty
Machine learning
end note
note right of Adaptive
Real-time learning
Pattern recognition
Strategy adjustment
Skill matching
end note
๐ฑ Mobile State Enhancements
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'#2979FF','primaryTextColor':'#fff','primaryBorderColor':'#0D47A1','lineColor':'#00C853','secondaryColor':'#FFD600','tertiaryColor':'#FF3D00'}}}%%
stateDiagram-v2
[*] --> DetectingDevice: App Launch
DetectingDevice --> PhoneMode: Phone Detected
DetectingDevice --> TabletMode: Tablet Detected
DetectingDevice --> DesktopMode: Desktop Detected
PhoneMode --> Portrait: Default Orientation
PhoneMode --> Landscape: Rotate Device
Portrait --> TouchControls: Setup Controls
Landscape --> TouchControls
TabletMode --> HybridControls: Setup Controls
DesktopMode --> KeyboardControls: Setup Controls
TouchControls --> CheckNetwork: Ready
HybridControls --> CheckNetwork
KeyboardControls --> CheckNetwork
CheckNetwork --> Online: Connection Good
CheckNetwork --> Offline: No Connection
CheckNetwork --> Limited: Slow Connection
Online --> FullFeatures: Enable All
Offline --> OfflineMode: Local Only
Limited --> ReducedFeatures: Essential Only
FullFeatures --> Gameplay: Start Game
OfflineMode --> Gameplay
ReducedFeatures --> Gameplay
Gameplay --> MonitorPerformance: Active
MonitorPerformance --> HighPerformance: FPS > 50
MonitorPerformance --> MediumPerformance: FPS 30-50
MonitorPerformance --> LowPerformance: FPS < 30
HighPerformance --> Gameplay
MediumPerformance --> OptimizeGraphics: Reduce Effects
OptimizeGraphics --> Gameplay
LowPerformance --> MinimumGraphics: Minimum Settings
MinimumGraphics --> Gameplay
Gameplay --> BackgroundState: App Minimized
BackgroundState --> Gameplay: App Resumed
BackgroundState --> [*]: App Closed
Gameplay --> [*]: Exit
note right of DetectingDevice
Screen size
Touch capability
Performance tier
Network status
end note
note right of MonitorPerformance
Real-time FPS monitoring
Auto-adjust quality
Battery optimization
Thermal throttling
end note
ํ๊ด์ ๊ธธ์ ๊ฑธ์ด๋ผ - Walk the Path of the Black Trigram into Advanced States
These future state diagrams document planned state machine enhancements for Black Trigram, including multiplayer session management, progression systems, advanced AI behavior, and mobile optimization states.
๐ Document Control:
โ
Approved by: James Pether Sรถrling, CEO
๐ค Distribution: Public
๐ท๏ธ Classification:
๐
Effective Date: 2026-03-19
โฐ Next Review: 2026-09-19
๐ฏ Framework Compliance: