feat(entities): migrar la configuració del player a data/entities/player/player.yaml

This commit is contained in:
2026-05-25 08:32:49 +02:00
parent 9f278772bb
commit 6447932212
18 changed files with 396 additions and 121 deletions
+7 -6
View File
@@ -3,8 +3,6 @@
#pragma once
#include "core/defaults/entities.hpp"
namespace Defaults::Enemies {
// Cuerpo físico común (valores por defecto del constructor)
@@ -78,10 +76,13 @@ namespace Defaults::Enemies {
// Spawn safety and invulnerability system
namespace Spawn {
// Safe spawn distance from player
constexpr float SAFETY_DISTANCE_MULTIPLIER = 3.0F; // 3x ship radius
constexpr float SAFETY_DISTANCE = Defaults::Entities::SHIP_RADIUS * SAFETY_DISTANCE_MULTIPLIER; // 36.0f px
constexpr int MAX_SPAWN_ATTEMPTS = 50; // Max attempts to find safe position
// Safe spawn distance from player. Antic: SHIP_RADIUS(12) * 3 = 36 px.
// SHIP_RADIUS ha migrat al YAML del player; aquesta constant es
// mantindrà fixa fins al PR de migració dels enemics a YAML, on
// passarà a derivar-se en runtime del player_config.
constexpr float SAFETY_DISTANCE_MULTIPLIER = 3.0F;
constexpr float SAFETY_DISTANCE = 36.0F;
constexpr int MAX_SPAWN_ATTEMPTS = 50; // Max attempts to find safe position
// Invulnerability system
constexpr float INVULNERABILITY_DURATION = 3.0F; // Seconds
+1 -1
View File
@@ -8,7 +8,7 @@ namespace Defaults::Entities {
constexpr int MAX_ORNIS = 15;
constexpr int MAX_BULLETS = 50;
constexpr float SHIP_RADIUS = 12.0F;
// SHIP_RADIUS migrat a data/entities/player/player.yaml (physics.collision_radius).
constexpr float ENEMY_RADIUS = 20.0F;
constexpr float BULLET_RADIUS = 3.0F;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace Defaults::Game {
// Friendly fire system
constexpr bool FRIENDLY_FIRE_ENABLED = true; // Activar friendly fire
constexpr float COLLISION_BULLET_PLAYER_AMPLIFIER = 1.0F; // Hitbox exacto (100%)
constexpr float BULLET_SPEED = 700.0F; // Velocidad escalar (px/s). Pascal: 7 px/frame × 20 FPS
// BULLET_SPEED migrat a data/entities/player/player.yaml (weapon.bullet_speed).
// Transición LEVEL_START (mensajes aleatorios PRE-level)
constexpr float LEVEL_START_DURATION = 3.0F; // Duración total
+4 -12
View File
@@ -5,10 +5,10 @@
namespace Defaults::Physics {
constexpr float ROTATION_SPEED = 3.14F; // rad/s (~180°/s)
constexpr float ACCELERATION = 400.0F; // px/s²
constexpr float MAX_VELOCITY = 180.0F; // px/s
constexpr float FRICTION = 20.0F; // px/s²
// NOTA: els paràmetres específics de la nau del player (rotation_speed,
// acceleration, max_velocity, death_impact_factor) viuen ara a
// data/entities/player/player.yaml. La migració d'aquests fitxers va
// començar amb la nau; els enemics i les bales són els següents.
// Bullet — impacto físico contra enemigo (impulse mass-aware).
// Model: el impulse és el moment lineal de la bala (m·v) multiplicat per
@@ -18,14 +18,6 @@ namespace Defaults::Physics {
constexpr float IMPACT_MOMENTUM_FACTOR = 3.0F; // Factor de transferència de moment bala→enemic
} // namespace Bullet
// Ship → enemy: impuls explícit aplicat a l'enemic en el moment exacte
// que la nau mor per col·lisió amb ell (afegit per damunt del rebot
// natural de PhysicsWorld, que ja és present però subtil amb la
// damping de la nau).
namespace Ship {
constexpr float DEATH_IMPACT_MOMENTUM_FACTOR = 0.3F;
} // namespace Ship
// Explosions (debris physics)
namespace Debris {
constexpr float SPEED_BASE = 80.0F; // Velocidad inicial (px/s)
-33
View File
@@ -1,33 +0,0 @@
// ship.hpp - Configuració de la nau (invulnerabilitat, parpelleig)
// © 2026 JailDesigner
#pragma once
namespace Defaults::Ship {
// Invulnerabilidad post-respawn
constexpr float INVULNERABILITY_DURATION = 3.0F; // Segundos de invulnerabilidad
// Parpadeo visual durante invulnerabilidad
constexpr float BLINK_VISIBLE_TIME = 0.1F; // Tiempo visible (segundos)
constexpr float BLINK_INVISIBLE_TIME = 0.1F; // Tiempo invisible (segundos)
// Frecuencia total: 0.2s/ciclo = 5 Hz (~15 parpadeos en 3s)
// Cuerpo físico
constexpr float MASS = 10.0F; // Masa de referencia para choques
constexpr float RESTITUTION = 0.6F; // Rebote moderado contra paredes
constexpr float LINEAR_DAMPING = 1.5F; // Fricción exponencial (s⁻¹)
constexpr float ANGULAR_DAMPING = 0.0F; // Rotación 100% por input (no inercial)
// Empuje visual: escala proporcional a la velocidad (0..200 px/s → 1.0..1.5)
// Mantiene la sensación del Pascal original.
constexpr float VISUAL_PUSH_DIVISOR = 33.33F; // SPEED / DIVISOR = empuje visual
constexpr float VISUAL_SCALE_DIVISOR = 12.0F; // SCALE = 1 + (PUSH / DIVISOR)
// Estat "ferit": entre primera col·lisió amb enemic i recuperació o segona col·lisió mortal.
namespace Hurt {
constexpr float DURATION = 15.0F; // Segons en estat ferit (provisional)
constexpr float BLINK_HZ = 10.0F; // Freqüència parpelleig color normal ↔ ferit
} // namespace Hurt
} // namespace Defaults::Ship
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Defaults::Trail {
constexpr int POOL_SIZE = 200;
constexpr float SPEED_THRESHOLD_PX_S = 54.0F; // 30% de Physics::MAX_VELOCITY (180)
constexpr float SPEED_THRESHOLD_PX_S = 54.0F; // 30% de player.yaml::physics.max_velocity (180 px/s)
constexpr float EMIT_INTERVAL_S = 0.04F; // ~25 Hz nominal
constexpr float EMIT_JITTER_S = 0.015F; // ±15 ms al cooldown
constexpr float POSITION_JITTER_PX = 2.5F; // jitter al punt de naixement