Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Task_RequestPathfinding.h
Go to the documentation of this file.
1/**
2 * @file Task_RequestPathfinding.h
3 * @brief Atomic task that asynchronously requests a path via PathfindingManager.
4 * @author Olympe Engine
5 * @date 2026-02-24
6 *
7 * @details
8 * Task_RequestPathfinding submits an async pathfinding request on the first
9 * tick and polls for completion on subsequent ticks. When the request
10 * completes the path string is written to the "Path" LocalBlackboard key.
11 *
12 * Parameters (ParameterMap):
13 * "Target" (Vector) - destination position (required)
14 * "AsyncDelay" (Float) - simulated delay in seconds (optional, default 0.0)
15 *
16 * LocalBlackboard reads:
17 * "Position" (Vector) - current entity position (required)
18 *
19 * LocalBlackboard output:
20 * "Path" (String) - straight-line path string "(sx,sy,sz)->(tx,ty,tz)"
21 *
22 * Returns:
23 * Running on the first tick (request submitted) and while waiting.
24 * Success once the path is written to "Path".
25 * Failure if required parameters or BB keys are missing.
26 *
27 * Abort() cancels the in-flight request.
28 *
29 * C++14 compliant - no C++17/20 features.
30 */
31
32#pragma once
33
34#include <cstdint>
35
36#include "../../IAtomicTask.h"
37#include "../../Pathfinding/PathfindingManager.h"
38
39namespace Olympe {
40
41/**
42 * @class Task_RequestPathfinding
43 * @brief Async pathfinding task that polls PathfindingManager for completion.
44 */
46public:
48
50 const ParameterMap& params) override;
51
52 TaskStatus Execute(const ParameterMap& params) override;
53
54 void Abort() override;
55
56private:
57 PathfindingManager::RequestID m_requestID; ///< Active request ID (0 = none)
58 bool m_hasRequest; ///< True after first-tick submission
59};
60
61} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Abstract interface for a single atomic unit of work.
Definition IAtomicTask.h:63
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition IAtomicTask.h:67
uint64_t RequestID
Unique identifier for a pathfinding request.
Async pathfinding task that polls PathfindingManager for completion.
void Abort() override
Aborts the task, releasing any in-progress state.
TaskStatus Execute(const ParameterMap &params) override
Executes the atomic task for one frame.
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap &params) override
Executes the atomic task for one frame with full runtime context.
PathfindingManager::RequestID m_requestID
Active request ID (0 = none)
bool m_hasRequest
True after first-tick submission.
< Provides AssetID and INVALID_ASSET_ID
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition IAtomicTask.h:38
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().