Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
events.hpp File Reference

Gameplay events: explosions and deaths, published on the core event bus. More...

Go to the source code of this file.

Classes

struct  aegis2d::ecs::Explosion
 An entity whose health reached zero blows up: an enemy shot down, or a player that loses a life. More...
 

Namespaces

namespace  aegis2d
 Root namespace of the engine.
 
namespace  aegis2d::ecs
 Entity-Component-System used by client and server.
 

Functions

void aegis2d::ecs::publish_explosions (core::EventBus &events, const Registry &registry, const DamageReport &report)
 Publishes an Explosion for each kill of the tick, in the order of the kills.
 
void aegis2d::ecs::publish_deaths (core::EventBus &events, std::span< const LifeLost > lost)
 Publishes each player's death of the tick.
 

Detailed Description

Gameplay events: explosions and deaths, published on the core event bus.

The gameplay systems list what happened during a tick (the DamageReport of apply_damage(), the LifeLost of handle_player_deaths()); these functions publish it on a core::EventBus, so audio and visual effects react to it without gameplay code knowing them (shots are published by the shmup module, shmup::publish_shots()):

ecs::apply_damage(registry, contacts, report);
ecs::publish_explosions(events, registry, report); // before the respawns
ecs::credit_kills(registry, report, awards);
ecs::handle_player_deaths(registry, report, lost);
ecs::publish_deaths(events, lost);
ecs::remove_casualties(registry, report);