Skip to main content

SpawnPlacer.ixx File

Abstract interface for determining spawn positions. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacespawn

Entity spawning infrastructure for the helios engine. More...

namespacebehavior

Spawn behavior strategies for positioning and initializing entities. More...

Classes Index

classSpawnPlacer

Abstract interface for determining spawn positions. More...

Description

Abstract interface for determining spawn positions.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file SpawnPlacer.ixx
3 * @brief Abstract interface for determining spawn positions.
4 */
5module;
6
7#include <optional>
8
9export module helios.engine.runtime.spawn.behavior.SpawnPlacer;
10
11import helios.engine.runtime.spawn.types.SpawnPlanCursor;
12import helios.engine.runtime.spawn.types.SpawnContext;
13import helios.math;
14import helios.engine.ecs.EntityHandle;
15
18
19 /**
20 * @brief Abstract interface for determining spawn positions.
21 *
22 * @details SpawnPlacer defines the strategy for calculating where a spawned
23 * entity should be placed in the world. Implementations can provide various
24 * placement strategies:
25 *
26 * - **RandomPlacer:** Random position within level bounds
27 * - **FormationPlacer:** Grid or pattern-based placement
28 * - **EmitterRelativePlacer:** Offset from emitter position
29 * - **FixedPlacer:** Predetermined spawn points
30 *
31 * Example implementation:
32 * ```cpp
33 * class RandomPlacer : public SpawnPlacer {
34 * public:
35 * vec3f getPosition(const Guid& guid, const aabbf& bounds,
36 * const SpawnPlanCursor& cursor,
37 * const SpawnContext& ctx) override {
38 * return Random::pointInBounds(bounds);
39 * }
40 * };
41 * ```
42 *
43 * @see SpawnProfile
44 * @see SpawnInitializer
45 * @see SpawnContext
46 */
47 class SpawnPlacer {
48
49 public:
50
51 virtual ~SpawnPlacer() = default;
52
53 /**
54 * @brief Calculates the spawn position for an entity.
55 *
56 * @param entityHandle The handle of the entity being spawned.
57 * @param gameObjectBounds The bounding box of the entity to spawn.
58 * @param environmentBounds The level bounds to spawn within.
59 * @param cursor The current position within the spawn batch.
60 * @param spawnContext Context data including optional emitter info.
61 *
62 * @return The world position for the spawned entity.
63 */
65 const helios::engine::ecs::EntityHandle& entityHandle,
66 const helios::math::aabbf& gameObjectBounds,
67 const helios::math::aabbf& environmentBounds,
68 const SpawnPlanCursor& cursor,
69 const SpawnContext& spawnContext
70 ) = 0;
71
72 /**
73 * @brief Called when the spawn system is reset.
74 *
75 * @details Override to reset any internal state (e.g., RNG seeds).
76 * The default implementation is a no-op.
77 */
78 virtual void onReset() noexcept {
79 // noop
80 }
81 };
82
83}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.