Wiki source code of Player State Machine

Version 41.1 by Alexandros Mloukie on 2025/12/17 15:09

Hide last authors
Alexandros Mloukie 1.1 1 = 0 - Introduction =
2
3 This document outlines the Finite State Machine infrastructure inherent to the Player Character. It contains and defines:
4
5 * Player States & Overarching Architecture
6 * State Transitions
7 * State Actions
8
9 The player's Finite State machine defines the states and capabilities of the Player Character within the game. Each state is self-contained, and can be transitioned to when certain conditions are met. The state capabilities, transition requirements, and relations to one another are defined within this document.
10
11 == 0.1 - Disclaimer ==
12
13 This document is subject to change as part of the evolving nature of the game's development, and updates will be made accordingly. If anything is not correct or requires further explanation, contact Adam Janus to get further guidance.
14
15 == 0.2 - Terminology ==
16
17 (% class="table-bordered" style="margin-right:auto" %)
18 (% class="active" %)|=(% style="width: 200px;" %)Term|=(% style="width: 1237px;" %)Meaning
19 |(% style="width:200px" %)PC|(% style="width:1237px" %)Player Character
20 |(% style="width:200px" %)(((
21 FSM
22 )))|(% style="width:1237px" %)Finite State Machine
23
24 ----
25
26 = 1 - Core Concepts =
27
28 There are 4 key concepts inherent to the FSM
29
30 (% class="table-bordered" %)
31 (% class="active" %)|=(% style="width: 203px;" %)Concept|=(% style="width: 1234px;" %)Definition
32 |(% style="width:203px" %)State|(% style="width:1234px" %)(((
33 The different, distinct, and self-contained conditions the PC can be in. The PC can only be in **one** state at any given moment.
34 )))
35 |(% style="width:203px" %)Action|(% style="width:1234px" %)(((
36 Describes the different actions, mechanics, and elements the player can engage with.Multiple States can have access to the same Actions.
37
38 Some Actions will Transition from the current State to a new one.
39
40 Actions can induce Statuses on the player.{{wikimacrocontent/}}
41 )))
42 |(% style="width:203px" %)Status|(% style="width:1234px" %)(((
43 Describes an external effect (e.g. buff/debuff) that affects the player (e.g. Blindness, Crippled)
44
45 Statuses can affect the capabilities of the player (e.g. reduce speed), and prevent or allow certain Actions taking place (e.g. no sprinting when Crippled).
46
47 Statuses can prevent or allow the player's Transitions to another State.
48 )))
49 |(% style="width:203px" %)Transition|(% style="width:1234px" %)A Transition refers to the act of moving from one State to another, usually as a result of an Action or Status.
50
51 ----
52
Alexandros Mloukie 40.1 53 = 2 - Player States{{id name="PlayerStates"/}} =
Alexandros Mloukie 1.1 54
55 (% class="table-bordered" %)
56 (% class="active" %)|=State|=Description
Alexandros Mloukie 31.1 57 |{{box}}Idle{{/box}}|Default player State. Allows for most of the movement and combat actions the player can partake in.
58 |{{box}}Controlled Fall{{/box}}|The player is mid-air, but maintains control over the PC.
59 |{{box}}Freefall{{/box}}|(((
60 The player is mid-air, but has lost control over the PC.
61 )))
62 |{{box}}Skating{{/box}}|The player is skating on top of a rail.
63 |{{box}}Rock Climbing{{/box}}|The player is clung onto a climbable rock surface.
64 |{{box}}Rope Climbing{{/box}}|The player is currently on a climbable rope.
65 |{{box}}Grappling{{/box}}|The player is currently utilizing a Grapple Hook tool.
66 |{{box}}Mounted{{/box}}|The player is mounting a vehicle/ridable mob.
67
68 ----
69
70 = 3 - Actions =
71
Alexandros Mloukie 34.1 72 == 3.1 - Traversal Actions ==
Alexandros Mloukie 31.1 73
Alexandros Mloukie 34.1 74 {{warning}}
75 For details on any of the following actions please refer to: Traversal - Technical Design
76 {{/warning}}
77
78 {{info}}Walk{{/info}} {{info}}Sprint{{/info}} {{info}}Crouch{{/info}} {{info}}Jump{{/info}} {{info}}Fall{{/info}} {{info}}Skate{{/info}} {{info}}Rock Climb{{/info}} {{info}}Rope Climb{{/info}} {{info}}Grapple{{/info}}
79
80 == 3.2 - Combat Actions ==
81
82 {{warning}}
83 For details on any of the following actions please refer to: Combat System - Technical Design
84 {{/warning}}
85
86 {{error}}Attack{{/error}} {{error}}Block{{/error}} {{error}}Parry{{/error}} {{error}}Dodge{{/error}} {{error}}Use Off-Hand{{/error}}
87
88 == 3.3 - Interaction Actions ==
89
90 {{warning}}
91 For details on any of the following actions please refer to: Crafting System - Technical Design
92 {{/warning}}
93
94 {{success}}Interact{{/success}} {{success}}Construct{{/success}}
95
Alexandros Mloukie 32.1 96 ----
Alexandros Mloukie 31.1 97
Alexandros Mloukie 32.1 98 = 4 - Statuses =
99
Alexandros Mloukie 41.1 100 == 4.1 - Status List{{id name="StatusList"/}} ==
Alexandros Mloukie 34.2 101
102 (% class="table-bordered" %)
103 (% class="active" %)|=Status|=Blocks the following Actions
104 |{{box}}Blinded{{/box}}|{{info}}Skate{{/info}} {{info}}Grapple{{/info}} {{error}}Attack{{/error}} {{error}}Parry{{/error}} {{success}}Interact{{/success}} {{success}}Construct{{/success}}
105 |{{box}}Crippled{{/box}}|{{info}}Sprint{{/info}} {{info}}Jump{{/info}} {{info}}Skate{{/info}} {{info}}Rock Climb{{/info}} {{error}}Dodge{{/error}}
106 |{{box}}Crouching{{/box}}|{{info}}Sprint{{/info}} {{error}}Dodge{{/error}}
107 |{{box}}Sprinting{{/box}}|{{info}}Crouch{{/info}} {{info}}Rock Climb{{/info}} {{info}}Rope Climb{{/info}} {{info}}Grapple{{/info}} {{error}}Attack{{/error}} {{error}}Block{{/error}} {{error}}Parry{{/error}} {{error}}Dodge{{/error}} {{error}}Use Off-Hand{{/error}} {{success}}Interact{{/success}} {{success}}Construct{{/success}}
108 |{{box}}Attacking{{/box}}|{{info}}Sprint{{/info}} {{info}}Rock Climb{{/info}} {{info}}Rope Climb{{/info}} {{info}}Grapple{{/info}} {{error}}Attack{{/error}} {{error}}Block{{/error}} {{error}}Parry{{/error}} {{error}}Dodge{{/error}} {{error}}Use Off-Hand{{/error}} {{success}}Interact{{/success}} {{success}}Construct{{/success}}
109
110 == 4.2 - Action Induced Statuses ==
111
112 (% class="table-bordered" %)
113 (% class="active" %)|=(% style="width: 127px;" %)Action|=(% style="width: 1036px;" %)Applies the following Status
114 |(% style="width:127px" %){{info}}Sprint{{/info}}|(% style="width:1036px" %){{box}}Sprinting{{/box}}
115 |(% style="width:127px" %){{info}}Crouch{{/info}}|(% style="width:1036px" %){{box}}Crouching{{/box}}
116 |(% style="width:127px" %){{error}}Attack{{/error}}|(% style="width:1036px" %){{box}}Attacking{{/box}}
117
118 ----
119
120 = 5 - Transitions =
121
122 == 5.1 - High-Level Transition Diagram ==
123
Alexandros Mloukie 34.3 124 [[image:1765417604690-575.png]]
125
Alexandros Mloukie 35.1 126 == 5.2 - Per-State Transition Tables ==
127
128 === 5.2.1 - {{box}}Idle{{/box}} Transitions ===
129
130 (% class="table-bordered" %)
Alexandros Mloukie 36.1 131 (% class="active" %)|=(% style="width: 324px;" %)Available Actions|=(% style="width: 839px;" %)Transitions to State
132 |(% style="width:324px" %){{info}}Walk{{/info}} {{info}}Sprint{{/info}} {{info}}Crouch{{/info}}|(% style="width:839px" %)-
133 |(% style="width:324px" %){{info}}Jump{{/info}}|(% style="width:839px" %){{box}}Controlled Fall{{/box}}
134 |(% style="width:324px" %){{info}}Fall{{/info}} with Stamina|(% style="width:839px" %){{box}}Controlled Fall{{/box}}
135 |(% style="width:324px" %){{info}}Rock Climb{{/info}}|(% style="width:839px" %){{box}}Rock Climbing{{/box}}
136 |(% style="width:324px" %){{info}}Rope Climb{{/info}}|(% style="width:839px" %){{box}}Rope Climbing{{/box}}
137 |(% style="width:324px" %){{info}}Grapple{{/info}}|(% style="width:839px" %){{box}}Grappling{{/box}}
138 |(% style="width:324px" %){{error}}Attack{{/error}} {{error}}Block{{/error}} {{error}}Parry{{/error}} {{error}}Dodge{{/error}} {{error}}Use Off-Hand{{/error}}|(% style="width:839px" %)-
139 |(% style="width:324px" %){{success}}Interact{{/success}} {{success}}Construct{{/success}} with object or station|(% style="width:839px" %)-
140 |(% style="width:324px" %){{success}}Interact{{/success}} with mount|(% style="width:839px" %){{box}}Mounted{{/box}}
Alexandros Mloukie 35.1 141
142 === 5.2.2 - {{box}}Controlled Fall{{/box}} Transitions ===
143
144 (% class="table-bordered" %)
Alexandros Mloukie 36.1 145 (% class="active" %)|=(% style="width: 324px;" %)Available Actions|=(% style="width: 839px;" %)Transitions to State
146 |(% style="width:324px" %){{info}}Fall{{/info}} land on ground|(% style="width:839px" %){{box}}Idle{{/box}}
147 |(% style="width:324px" %){{info}}Fall{{/info}} land on rail|(% style="width:839px" %){{box}}Skating{{/box}}
148 |(% style="width:324px" %){{info}}Fall{{/info}} out of Stamina or after X seconds|(% style="width:839px" %){{box}}Freefall{{/box}}
149 |(% style="width:324px" %){{info}}Rock Climb{{/info}}|(% style="width:839px" %){{box}}Rock Climbing{{/box}}
150 |(% style="width:324px" %){{info}}Rope Climb{{/info}}|(% style="width:839px" %){{box}}Rope Climbing{{/box}}
151 |(% style="width:324px" %){{info}}Grapple{{/info}}|(% style="width:839px" %){{box}}Grappling{{/box}}
Alexandros Mloukie 35.1 152
153 === 5.2.3 - {{box}}Freefall{{/box}} Transitions ===
154
155 (% class="table-bordered" %)
Alexandros Mloukie 36.1 156 (% class="active" %)|=(% style="width: 324px;" %)Available Actions|=(% style="width: 839px;" %)Transitions to State
157 |(% style="width:324px" %){{info}}Fall{{/info}} land on a solid surface|(% style="width:839px" %){{box}}Idle{{/box}}
Alexandros Mloukie 35.1 158
159 === 5.2.4 - {{box}}Skating{{/box}} Transitions ===
160
161 (% class="table-bordered" %)
Alexandros Mloukie 36.1 162 (% class="active" %)|=(% style="width: 326px;" %)Available Actions|=(% style="width: 837px;" %)Transitions to State
163 |(% style="width:326px" %){{info}}Jump{{/info}}|(% style="width:837px" %){{box}}Controlled Fall{{/box}}
164 |(% style="width:326px" %){{info}}Grapple{{/info}}|(% style="width:837px" %){{box}}Grappling{{/box}}
Alexandros Mloukie 35.1 165
166 === 5.2.5 - {{box}}Rock Climbing{{/box}} Transitions ===
167
168 (% class="table-bordered" %)
Alexandros Mloukie 36.1 169 (% class="active" %)|=(% style="width: 327px;" %)Available Actions|=(% style="width: 836px;" %)Transitions to State
170 |(% style="width:327px" %){{info}}Jump{{/info}}|(% style="width:836px" %){{box}}Controlled Fall{{/box}}
171 |(% style="width:327px" %){{info}}Fall{{/info}} when out of Stamina|(% style="width:836px" %){{box}}Controlled Fall{{/box}} → {{box}}Freefall{{/box}}
172 |(% style="width:327px" %){{info}}Rock Climb{{/info}} end Rock Climb on ground|(% style="width:836px" %){{box}}Idle{{/box}}
173 |(% style="width:327px" %){{info}}Grapple{{/info}}|(% style="width:836px" %){{box}}Grappling{{/box}}
Alexandros Mloukie 35.1 174
175 === 5.2.6 - {{box}}Rope Climbing{{/box}} Transitions ===
176
177 (% class="table-bordered" %)
Alexandros Mloukie 36.1 178 (% class="active" %)|=(% style="width: 327px;" %)Available Actions|=(% style="width: 836px;" %)Transitions to State
179 |(% style="width:327px" %){{info}}Jump{{/info}}|(% style="width:836px" %){{box}}Controlled Fall{{/box}}
180 |(% style="width:327px" %){{info}}Fall{{/info}} when out of Stamina|(% style="width:836px" %){{box}}Controlled Fall{{/box}} → {{box}}Freefall{{/box}}
181 |(% style="width:327px" %){{info}}Rope Climb{{/info}} end Rope Climb on ground|(% style="width:836px" %){{box}}Idle{{/box}}
182 |(% style="width:327px" %){{info}}Grapple{{/info}}|(% style="width:836px" %){{box}}Grappling{{/box}}
Alexandros Mloukie 35.1 183
184 === 5.2.7 - {{box}}Grappling{{/box}} Transitions ===
185
186 (% class="table-bordered" %)
Alexandros Mloukie 36.1 187 (% class="active" %)|=(% style="width: 327px;" %)Available Actions|=(% style="width: 835px;" %)Transitions to State
188 |(% style="width:327px" %){{info}}Jump{{/info}}|(% style="width:835px" %){{box}}Controlled Fall{{/box}}
189 |(% style="width:327px" %){{info}}Fall{{/info}} when out of Stamina|(% style="width:835px" %){{box}}Controlled Fall{{/box}} → {{box}}Freefall{{/box}}
190 |(% style="width:327px" %){{info}}Rock Climb{{/info}}|(% style="width:835px" %){{box}}Rock Climbing{{/box}}
191 |(% style="width:327px" %){{info}}Rope Climb{{/info}}|(% style="width:835px" %){{box}}Rope Climbing{{/box}}
192 |(% style="width:327px" %){{info}}Grapple{{/info}} end Grapple on ground|(% style="width:835px" %){{box}}Idle{{/box}}
Alexandros Mloukie 35.1 193
194 === 5.2.8 - {{box}}Mounted{{/box}} Transitions ===
195
196 (% class="table-bordered" %)
Alexandros Mloukie 36.1 197 (% class="active" %)|=(% style="width: 329px;" %)Available Actions|=(% style="width: 833px;" %)Transitions to State
198 |(% style="width:329px" %){{info}}Walk{{/info}}|(% style="width:833px" %)-
199 |(% style="width:329px" %){{success}}Interact{{/success}} to dismount|(% style="width:833px" %){{box}}Idle{{/box}}