Olympe Engine
2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Source
TaskSystem
AtomicTasks
Combat
Task_Flee.h
Go to the documentation of this file.
1
/**
2
* @file Task_Flee.h
3
* @brief Atomic task that computes a flee direction away from a target.
4
* @author Olympe Engine
5
* @date 2026-03-08
6
*
7
* @details
8
* Task_Flee reads the entity's current position from "local:Position" and
9
* an optional threat target from "local:Target" (or the "Target" parameter).
10
* It computes the direction away from the threat, scales it by Distance, and
11
* writes the resulting flee target position to "local:FleeTarget" in the
12
* LocalBlackboard. A movement task (e.g. Task_MoveToLocation) can then be
13
* used to move the entity toward the computed flee target.
14
*
15
* Parameters (ParameterMap):
16
* "Target" (Vector) — threat position override (optional; falls back to
17
* "local:Target" EntityID in LocalBB, then origin).
18
* "Distance" (Float) — flee distance in units (optional, default 200.0).
19
*
20
* Returns:
21
* Success after writing the flee target.
22
* Failure if ctx.LocalBB is null.
23
*
24
* C++14 compliant - no C++17/20 features.
25
*/
26
27
#pragma once
28
29
#include "../../IAtomicTask.h"
30
31
namespace
Olympe
{
32
33
/**
34
* @class Task_Flee
35
* @brief Computes a flee direction and stores the target position in LocalBB.
36
*/
37
class
Task_Flee :
public
IAtomicTask {
38
public
:
39
Task_Flee
();
40
41
TaskStatus
ExecuteWithContext
(
const
AtomicTaskContext
&
ctx
,
42
const
ParameterMap
&
params
)
override
;
43
44
TaskStatus
Execute
(
const
ParameterMap
&
params
)
override
;
45
46
void
Abort
()
override
;
47
};
48
49
}
// namespace Olympe
GetComponentTypeID_Static
ComponentTypeID GetComponentTypeID_Static()
Definition
ECS_Entity.h:56
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::Task_Flee
Task_Flee()
Olympe::Task_Flee::Abort
void Abort() override
Aborts the task, releasing any in-progress state.
Olympe::Task_Flee::Execute
TaskStatus Execute(const ParameterMap ¶ms) override
Executes the atomic task for one frame.
Olympe::Task_Flee::ExecuteWithContext
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap ¶ms) override
Executes the atomic task for one frame with full runtime context.
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