|
| | RandomSpawner (const SpawnSettings &settings, std::uint64_t seed) |
| | Creates a spawner whose first spawn is one random interval away.
|
| |
| void | update (const Tick &tick, std::vector< Vec2 > &spawns) |
| | Moves time forward by one tick and lists the spawns that fall in it.
|
| |
| core::Random & | random () noexcept |
| | Random numbers of the spawner, to decide more about the spawned entities.
|
| |
| const SpawnSettings & | settings () const noexcept |
| | Spawn line and intervals.
|
| |
| float | until_next () const noexcept |
| | Time left before the next spawn.
|
| |
Decides when and where entities spawn, the same way for the same seed.
It owns a core::Random seeded once: the spawn times and points depend only on the seed and on the time spent, so a server started with a recorded seed replays the same game, and a test can check exact spawns. It creates no entity itself: update() lists the points due this tick and the game creates what it wants there, like trigger_weapons() does for shots. Use random() to draw anything else about the new entities (a phase, a type), so that it also follows the seed. Spawns fall on the first tick at or after their time, so the same seed gives the same points at any tick rate.