22#include <unordered_map>
158 float frequency = 2.0f,
float amplitude = 50.0f);
This file contains the component definitions.
Centralized entity lifecycle management system for R-Type server.
This file contains the entity definitions.
This file contains the interface for systems.
This file contains the Registry class declaration.
Abstract class for system.
Class for managing entities and their components.
Server-authoritative enemy AI system managing all enemy behaviors.
float getDistanceToNearestPlayer(float x, float y) const
Calculate distance to nearest player.
std::unordered_map< std::uint32_t, float > m_bossSpreadTimers
Boss spread shot timing per boss ID.
std::unordered_map< std::uint32_t, float > m_enemyMovementTimers
Movement timing per enemy ID.
EnemyAISystem(ecs::Registry ®istry, EntityManager &entityManager)
Constructor.
void updateAdvancedEnemyAI(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime)
Update AI logic for advanced enemy type.
void applySineWaveMovement(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime, float frequency=2.0f, float amplitude=50.0f)
Apply sine wave vertical movement pattern.
void tryShoot(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime)
Attempt to shoot projectile at player.
ecs::Registry & m_registry
ECS registry reference.
void applyAggressiveMovement(ecs::Entity enemy, float deltaTime, float speed=150.0f)
Apply aggressive pursuit movement toward nearest player.
EnemyAISystem & operator=(EnemyAISystem &&)=delete
Deleted move assignment operator (non-movable)
bool canShoot(ecs::Entity enemy) const
Check if enemy is able to shoot (cooldown and component checks)
EnemyAISystem & operator=(const EnemyAISystem &)=delete
Deleted copy assignment operator (non-copyable)
float m_aggressiveness
Global aggressiveness multiplier (affects pursuit speed)
void setAggressiveness(float value)
Set global enemy aggressiveness multiplier.
EnemyAISystem(const EnemyAISystem &)=delete
Deleted copy constructor (non-copyable)
EntityManager & m_entityManager
Entity manager for spawning projectiles.
void update(ecs::Registry ®istry, float deltaTime) override
Update the enemy AI system (called each frame)
EnemyAISystem(EnemyAISystem &&)=delete
Deleted move constructor (non-movable)
void updateBasicEnemyAI(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime)
Update AI logic for basic enemy type.
~EnemyAISystem() override=default
Destructor.
ecs::Entity findNearestPlayer(float x, float y) const
Find the nearest player entity to a given position.
std::uniform_real_distribution< float > m_shootChance
Random distribution for shoot probability.
void clampToScreen(ecs::Entity enemy)
Clamp enemy position to visible screen bounds.
std::mt19937 m_rng
Random number generator for shooting patterns.
void updateBossAI(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime)
Update AI logic for boss enemy type.
float getAggressiveness() const
Get current aggressiveness setting.
void applyZigzagMovement(std::uint32_t enemyId, ecs::Entity enemy, float deltaTime)
Apply zigzag diagonal movement pattern.
Central entity lifecycle manager for the R-Type game server.
EnemyBehavior
Enumeration of enemy movement and behavior patterns.
@ SINE_WAVE
Sine wave vertical oscillation pattern (intermediate)
@ STATIONARY
Stay in place and shoot at players (turret-like)
@ AGGRESSIVE
Actively pursue nearest player (advanced behavior)
@ STRAIGHT
Move straight left at constant speed (basic behavior)
@ ZIGZAG
Zigzag diagonal movement pattern (erratic)