Implementar sistema de variación por rebote individual

- Corregir coeficiente base: ahora TODAS las pelotas tienen el mismo (0.75)
- Añadir constantes configurables en defines.h:
  * BASE_BOUNCE_COEFFICIENT = 0.75f (igual para todas)
  * BOUNCE_VARIATION_PERCENT = 0.05f (±5% por rebote)
  * LATERAL_LOSS_PERCENT = 0.02f (±2% pérdida lateral)
- Implementar funciones generateBounceVariation() y generateLateralLoss()
- Aplicar variación aleatoria en cada rebote individual:
  * Superficie de gravedad: rebote con ±5% variación
  * Otras superficies: pérdida lateral 0-2%
- Añadir pérdida lateral perpendicular en todos los rebotes
- Actualizar debug display para mostrar coeficiente LOSS

Efecto: Pelotas idénticas divergen gradualmente por variaciones microscópicas
acumulativas, eliminando sincronización de forma natural y realista.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-18 16:52:24 +02:00
parent dec8d431f5
commit 78656cf17d
5 changed files with 278 additions and 64 deletions

View File

@@ -555,15 +555,20 @@ void render() {
std::string surface_text = balls[0]->isOnSurface() ? "SURFACE YES" : "SURFACE NO";
dbg_print(8, 40, surface_text.c_str(), 255, 0, 255); // Magenta para debug
// Línea 4: Dirección de gravedad
// Línea 4: Coeficiente de rebote (loss)
float loss_val = balls[0]->getLossCoefficient();
std::string loss_text = "LOSS " + std::to_string(loss_val).substr(0, 4); // Solo 2 decimales
dbg_print(8, 48, loss_text.c_str(), 255, 0, 255); // Magenta para debug
// Línea 5: Dirección de gravedad
std::string gravity_dir_text = "GRAVITY " + gravityDirectionToString(current_gravity);
dbg_print(8, 48, gravity_dir_text.c_str(), 255, 255, 0); // Amarillo para dirección
dbg_print(8, 56, gravity_dir_text.c_str(), 255, 255, 0); // Amarillo para dirección
}
// Debug: Mostrar tema actual
std::string theme_names[] = {"SUNSET", "OCEAN", "NEON", "FOREST"};
std::string theme_text = "THEME " + theme_names[static_cast<int>(current_theme)];
dbg_print(8, 56, theme_text.c_str(), 255, 255, 128); // Amarillo claro para tema
dbg_print(8, 64, theme_text.c_str(), 255, 255, 128); // Amarillo claro para tema
}
SDL_RenderPresent(renderer);