Wiki source code of Player State Machine (Test)

Version 35.1 by Alexandros Mloukie on 2025/12/11 03:03

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