Olympe Engine
2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Source
TaskSystem
AtomicTasks
AI
Task_Flee.h
Go to the documentation of this file.
1
/**
2
* @file Task_Flee.h
3
* @brief Atomic AI task that moves an entity away from a 2D threat position.
4
* @author Olympe Engine
5
* @date 2026-03-08
6
*
7
* @details
8
* Task_Flee computes a flee direction opposite to the threat (TargetX, TargetY)
9
* and moves the entity away from it. Returns Running while the entity is
10
* closer than Distance to the threat; returns Success once the entity is
11
* far enough away.
12
*
13
* Parameters (ParameterMap):
14
* "TargetX" (Float) — X coordinate of the threat (required).
15
* "TargetY" (Float) — Y coordinate of the threat (required).
16
* "Distance" (Float) — safe flee distance in units (optional, default 200.0).
17
*
18
* Returns:
19
* Running while the entity's distance to the threat < Distance.
20
* Success once the entity's distance to the threat >= Distance.
21
* Failure if "TargetX" or "TargetY" are missing.
22
*
23
* C++14 compliant - no C++17/20 features.
24
*/
25
26
#pragma once
27
28
#include "../../IAtomicTask.h"
29
30
namespace
Olympe
{
31
32
/**
33
* @class Task_Flee
34
* @brief Moves an entity away from a 2D threat position until safe distance is reached.
35
*/
36
class
Task_Flee
:
public
IAtomicTask
{
37
public
:
38
Task_Flee
();
39
40
TaskStatus
ExecuteWithContext
(
const
AtomicTaskContext
&
ctx
,
41
const
ParameterMap
&
params
)
override
;
42
43
TaskStatus
Execute
(
const
ParameterMap
&
params
)
override
;
44
45
void
Abort
()
override
;
46
};
47
48
}
// namespace Olympe
GetComponentTypeID_Static
ComponentTypeID GetComponentTypeID_Static()
Definition
ECS_Entity.h:56
Olympe::IAtomicTask
Abstract interface for a single atomic unit of work.
Definition
IAtomicTask.h:63
Olympe::IAtomicTask::ParameterMap
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition
IAtomicTask.h:67
Olympe::Task_Flee
Moves an entity away from a 2D threat position until safe distance is reached.
Definition
Task_Flee.h:36
Olympe::Task_Flee::Task_Flee
Task_Flee()
Definition
Task_Flee.cpp:23
Olympe::Task_Flee::Abort
void Abort() override
Aborts the task, releasing any in-progress state.
Definition
Task_Flee.cpp:25
Olympe::Task_Flee::Execute
TaskStatus Execute(const ParameterMap ¶ms) override
Executes the atomic task for one frame.
Definition
Task_Flee.cpp:30
Olympe::Task_Flee::ExecuteWithContext
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap ¶ms) override
Executes the atomic task for one frame with full runtime context.
Definition
Task_Flee.cpp:35
Olympe
< Provides AssetID and INVALID_ASSET_ID
Definition
BTEditorCommand.cpp:16
Olympe::TaskStatus
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition
IAtomicTask.h:38
Olympe::AtomicTaskContext
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().
Definition
AtomicTaskContext.h:36
Generated on Mon Apr 13 2026 08:15:20 for Olympe Engine by
1.9.8