PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
behavior_state_machine_types.h
1#pragma once
2
3#include "pixelbullet/filesystem/virtual_path.h"
4#include "pixelbullet/scene/entity_id.h"
5
6#include <glm/vec2.hpp>
7
8#include <optional>
9#include <string>
10#include <vector>
11
12namespace pixelbullet
13{
14namespace platform::scene_play
15{
16enum class RuntimeUiAction : int
17{
18 TogglePause,
19 ResumeRun,
20 ReloadCurrentScene,
21 RestartRun,
22};
23} // namespace platform::scene_play
24
25enum class InputSignal
26{
27 Interact,
28 Confirm,
29 Cancel,
30 PrimaryAction,
31};
32
33enum class BehaviorTargetAddressing
34{
35 Self,
36 Binding,
37};
38
40{
41 BehaviorTargetAddressing addressing = BehaviorTargetAddressing::Self;
42 std::string binding_slot;
43
44 [[nodiscard]] bool operator==(const BehaviorTarget&) const noexcept = default;
45};
46
47enum class BehaviorTriggerType
48{
49 OnEnter,
50 AfterSeconds,
51 InputSignal,
52 TriggerEnter,
53 TriggerExit,
54 KeyPickupCollected,
55 InteractionFocusEnter,
56 InteractionFocusExit,
57 InteractionInputSignal,
58 LevelCheckpointActivated,
59 LevelRespawned,
60 LevelCompleted,
61 InteractionSequenceCompleted,
62 PatrolWaypointReached,
63 PatrolRouteCompleted,
64 PerceptionTargetDetected,
65 PerceptionTargetLost,
66 PatrolInvestigationReached,
67 TargetEnteredAttackRange,
68 TargetExitedAttackRange,
69 TargetEnteredRangedAttackRange,
70 TargetExitedRangedAttackRange,
71 MeleeAttackRecovered,
72 RangedHitscanAttackRecovered,
73 TargetKilled,
74 CombatantDamaged,
75 CombatantDefeated,
76};
77
78enum class BehaviorVariableType
79{
80 Bool,
81 Int,
82};
83
84enum class BehaviorVariableScope
85{
86 Local,
87 Scene,
88};
89
91{
92 std::string name;
93 BehaviorVariableType type = BehaviorVariableType::Bool;
94 BehaviorVariableScope scope = BehaviorVariableScope::Local;
95 bool bool_initial_value = false;
96 int int_initial_value = 0;
97
98 [[nodiscard]] bool operator==(const BehaviorVariableDeclaration&) const noexcept = default;
99};
100
102{
103 std::string name;
104 std::string default_value = {};
105
106 [[nodiscard]] bool operator==(const BehaviorStringParameterDeclaration&) const noexcept = default;
107};
108
110{
111 std::string name;
112 std::string value;
113
114 [[nodiscard]] bool operator==(const BehaviorStringParameterValue&) const noexcept = default;
115};
116
117enum class BehaviorGuardComparison
118{
119 BoolEquals,
120 IntEquals,
121 IntGreaterOrEqual,
122 IntLessOrEqual,
123};
124
125enum class BehaviorGuardSource
126{
127 Variable,
128 InventoryKey,
129 RunFlag,
130};
131
133{
134 BehaviorGuardSource source = BehaviorGuardSource::Variable;
135 std::string variable_name;
136 std::string key_id;
137 std::string key_id_parameter;
138 BehaviorVariableScope scope = BehaviorVariableScope::Local;
139 BehaviorGuardComparison comparison = BehaviorGuardComparison::BoolEquals;
140 bool bool_value = false;
141 int int_value = 0;
142
143 [[nodiscard]] bool operator==(const BehaviorGuardCondition&) const noexcept = default;
144};
145
147{
148 BehaviorTriggerType type = BehaviorTriggerType::OnEnter;
149 float after_seconds = 0.0f;
150 InputSignal input_signal = InputSignal::Interact;
151 BehaviorTarget target{};
152 std::string interaction_outcome_id;
153 int patrol_waypoint_index = -1;
154
155 [[nodiscard]] bool operator==(const BehaviorTrigger&) const noexcept = default;
156};
157
158enum class BehaviorActionType
159{
160 SetMeshVisible,
161 SetSpriteVisible,
162 SetPointLightEnabled,
163 SetSpotLightEnabled,
164 SetDirectionalLightEnabled,
165 SetAudioSourceEnabled,
166 StartAudioSource,
167 StopAudioSource,
168 SelectCamera,
169 ControlTransformAnimation,
170 SetBoolVariable,
171 ToggleBoolVariable,
172 SetIntVariable,
173 AddIntVariable,
174 SetInteractableEnabled,
175 SetColliderEnabled,
176 SetRigidBodyEnabled,
177 SetRuntimeObjective,
178 ClearRuntimeObjective,
179 SetRuntimeStatusText,
180 ClearRuntimeStatusText,
181 SetRuntimeHintText,
182 ClearRuntimeHintText,
183 SetInteractionPromptText,
184 ClearInteractionPromptText,
185 SetPausedMenuContent,
186 ClearPausedMenuContent,
187 SetCompletedMenuContent,
188 ClearCompletedMenuContent,
189 ShowRuntimeNotification,
190 SetTrackedObjective,
191 SetTrackedObjectiveStage,
192 CompleteObjective,
193 FailObjective,
194 ClearTrackedObjective,
195 StartMission,
196 EmitMissionEvent,
197 SetRunFlag,
198 ClearRunFlag,
199 StartInteractionSequence,
200 SetPatrolEnabled,
201 PausePatrol,
202 ResumePatrol,
203 SetPatrolRoute,
204 SetPatrolMoveSpeed,
205 ChaseTarget,
206 InvestigateLastSeenTarget,
207 ReturnToPatrol,
208 StartMeleeAttack,
209 StartPrimaryHitscanAttack,
210 StartRangedHitscanAttack,
211};
212
213enum class TransformAnimationPlaybackCommand
214{
215 Play,
216 Pause,
217 Stop,
218 Restart,
219};
220
222{
223 BehaviorActionType type = BehaviorActionType::SetMeshVisible;
224 BehaviorTarget target{};
225 std::string variable_name;
226 std::string text_value;
227 BehaviorVariableScope scope = BehaviorVariableScope::Local;
228 bool bool_value = true;
229 int int_value = 0;
230 float duration_seconds = 2.5f;
231 TransformAnimationPlaybackCommand animation_command = TransformAnimationPlaybackCommand::Play;
232 std::string detail_text_value;
233 std::string hint_text_value;
234 std::string objective_id;
235 pixelbullet::VirtualPath objective_asset;
236 std::string objective_stage_id;
237 pixelbullet::VirtualPath mission_asset;
238 std::string mission_event_id;
239 pixelbullet::VirtualPath interaction_asset;
240 BehaviorTarget patrol_route_target{};
241 float patrol_move_speed = 0.0f;
242 std::vector<platform::scene_play::RuntimeUiAction> runtime_ui_actions;
243
244 [[nodiscard]] bool operator==(const BehaviorAction&) const noexcept = default;
245};
246
248{
249 BehaviorTrigger trigger{};
250 std::vector<BehaviorGuardCondition> guards;
251 std::string target_state;
252
253 [[nodiscard]] bool operator==(const BehaviorTransition&) const noexcept = default;
254};
255
257{
258 std::string name;
259 std::vector<BehaviorAction> entry_actions;
260 std::vector<BehaviorTransition> transitions;
261
262 [[nodiscard]] bool operator==(const BehaviorState&) const noexcept = default;
263};
264
266{
267 std::string slot_name;
268 EntityId entity = EntityId::Invalid();
269
270 [[nodiscard]] bool operator==(const BehaviorBinding&) const noexcept = default;
271};
272
274{
275 std::string state_name;
276 glm::vec2 position = glm::vec2(0.0f);
277
278 [[nodiscard]] bool operator==(const BehaviorEditorGraphNodeLayout&) const noexcept = default;
279};
280
282{
283 std::vector<BehaviorEditorGraphNodeLayout> nodes;
284
285 [[nodiscard]] bool Empty() const noexcept
286 {
287 return nodes.empty();
288 }
289
290 [[nodiscard]] bool operator==(const BehaviorEditorGraphLayout&) const noexcept = default;
291};
292
294{
295 std::string initial_state;
296 std::vector<BehaviorVariableDeclaration> variables;
297 std::vector<BehaviorStringParameterDeclaration> string_parameters;
298 std::vector<std::string> binding_slots;
299 std::vector<BehaviorState> states;
300 std::optional<BehaviorEditorGraphLayout> editor_graph;
301
302 [[nodiscard]] bool operator==(const BehaviorStateMachineAsset&) const noexcept = default;
303};
304} // namespace pixelbullet
Definition entity_id.h:11
Definition scene.h:23
Definition virtual_path.h:10
Definition behavior_state_machine_types.h:222
Definition behavior_state_machine_types.h:266
Definition behavior_state_machine_types.h:282
Definition behavior_state_machine_types.h:274
Definition behavior_state_machine_types.h:133
Definition behavior_state_machine_types.h:294
Definition behavior_state_machine_types.h:257
Definition behavior_state_machine_types.h:102
Definition behavior_state_machine_types.h:110
Definition behavior_state_machine_types.h:40
Definition behavior_state_machine_types.h:248
Definition behavior_state_machine_types.h:147
Definition behavior_state_machine_types.h:91