- 📅 2026-11-09T23:34:05.011Z
- 👁️ 32 katselukertaa
- 🔓 Julkinen
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Stalingrad 1942: Red Winter - AAA Web Engine</title>
<style>
:root {
--military-green: #2f3e2e;
--soviet-red: #8b0000;
--feldgrau: #4d5d53;
--ui-font: 'Courier New', Courier, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
body, html { width: 100%; height: 100%; overflow: hidden; background-color: #050505; font-family: var(--ui-font); }
#canvas-container { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }
/* HUD Cinematográfico y Minimalista */
#hud {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 30px;
}
.hud-panel {
background: rgba(10, 12, 10, 0.65);
border: 1px solid rgba(255, 255, 255, 0.15);
padding: 15px 25px;
color: #d1d7ce;
text-shadow: 0 2px 4px rgba(0,0,0,0.8);
backdrop-filter: blur(4px);
}
.top-hud { display: flex; justify-content: space-between; width: 100%; }
.compass { font-weight: bold; letter-spacing: 3px; font-size: 1.2rem; border-bottom: 2px solid var(--soviet-red); }
.bottom-hud { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
.stat-container { display: flex; flex-direction: column; gap: 8px; width: 250px; }
.stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; opacity: 0.8; }
.bar-outer { width: 100%; height: 12px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3); padding: 1px; }
.bar-inner { height: 100%; background: var(--soviet-red); transition: width 0.1s ease; width: 100%; box-shadow: 0 0 8px var(--soviet-red); }
.weapon-status { text-align: right; }
.ammo-display { font-size: 2.5rem; font-weight: bold; color: #fff; line-height: 1; }
.weapon-name { font-size: 0.9rem; color: #8fa38b; letter-spacing: 1px; margin-top: 5px; }
/* Retícula de apuntado */
#crosshair {
position: absolute;
top: 50%;
left: 50%;
width: 10px;
height: 10px;
transform: translate(-50%, -50%);
z-index: 11;
pointer-events: none;
}
#crosshair::before, #crosshair::after {
content: ''; position: absolute; background: rgba(255,255,255,0.4);
}
#crosshair::before { top: 4px; left: -10px; width: 30px; height: 2px; }
#crosshair::after { top: -10px; left: 4px; width: 2px; height: 30px; }
/* Pantallas de Estado */
#screen-overlay {
position: absolute;
top: 0; left: 0; width: 100%; height: 100%;
z-index: 20;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: radial-gradient(circle, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.9) 100%);
color: #fff;
text-align: center;
cursor: pointer;
transition: all 0.5s ease;
}
#screen-overlay.hidden { opacity: 0; pointer-events: none; }
h1 { font-size: 3.5rem; letter-spacing: 5px; color: #e0e0e0; text-shadow: 0 0 15px rgba(255,255,255,0.2); margin-bottom: 10px; }
h1 span { color: var(--soviet-red); }
.subtitle { font-size: 1.1rem; color: #a0a59e; margin-bottom: 40px; letter-spacing: 2px; }
.btn-prompt {
padding: 15px 40px;
border: 2px solid #fff;
background: transparent;
color: #fff;
font-family: var(--ui-font);
font-size: 1.2rem;
letter-spacing: 3px;
text-transform: uppercase;
cursor: pointer;
box-shadow: 0 0 10px rgba(255,255,255,0.1);
transition: all 0.3s;
}
.btn-prompt:hover { background: #fff; color: #000; box-shadow: 0 0 25px rgba(255,255,255,0.5); }
.instructions { margin-top: 30px; font-size: 0.85rem; color: #7f8c7d; line-height: 1.6; }
</style>
<!-- Carga controlada de Three.js desde CDN estable -->
<script src="https://cloudflare.com"></script>
</head>
<body>
<div id="canvas-container"></div>
<div id="crosshair"></div>
<div id="hud">
<div class="top-hud">
<div class="hud-panel compass">SECTOR: STALINGRADO - NW 42°</div>
<div class="hud-panel FPS" id="fps-counter">60 FPS</div>
</div>
<div class="bottom-hud">
<div class="hud-panel stat-container">
<div class="stat-label">Estado del Soldado</div>
<div class="bar-outer"><div id="hp-bar" class="bar-inner"></div></div>
</div>
<div class="hud-panel weapon-status">
<div class="ammo-display" id="ammo-count">7 / 35</div>
<div class="weapon-name">MOSIN-NAGANT M91/30</div>
</div>
</div>
</div>
<div id="screen-overlay">
<h1>STALINGRAD: <span>RED WINTER</span></h1>
<div class="subtitle">Simulación Gráfica WebGL2 & Shaders Cinematográficos</div>
<button class="btn-prompt" id="start-btn">Desplegar Regimiento</button>
<div class="instructions">
[W, A, S, D] Moverse • [RATÓN] Mirar alrededor • [CLIC IZQ] Disparar Fusil<br>
Requiere captura de puntero (Pointer Lock). Ajustado para simulación a 60 FPS estables.
</div>
</div>
<script>
// --- MOTOR DE CONTROL DE CALIDAD Y OPTIMIZACIÓN (ARQUITECTURA DE SUBAGENTES VIRTUALES) ---
const ENGINE_CONFIG = {
shadowMapWidth: 2048,
shadowMapHeight: 2048,
particleCount: 800,
enemyCount: 4,
playerSpeed: 0.12,
bulletSpeed: 1.8
};
// Estado Global de la Simulación
let scene, camera, renderer, clock;
let player = { hp: 100, maxHp: 100, ammo: 7, maxAmmo: 7, totalAmmo: 35, position: new THREE.Vector3(0, 1.8, 10), velocity: new THREE.Vector3() };
let input = { forward: false, backward: false, left: false, right: false };
let enemies = [];
let bullets = [];
let particles, dynamicMaterials = {};
let isEnlisted = false;
let pitch = 0, yaw = 0; // Control de cámara FPS rotacional nativa
// Post-procesado personalizado nativo por Vertex/Fragment Shaders (Evita librerías extra densas)
let postScene, postCamera, postMaterial;
// --- SISTEMA DE AUDIO (Web Audio API) ---
let audioCtx;
function initAudio() {
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
}
function playProceduralSound(type) {
if (!audioCtx) return;
const osc = audioCtx.createOscillator();
const gain = audioCtx.createGain();
osc.connect(gain);
gain.connect(audioCtx.destination);
if (type === 'shoot') {
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(320, audioCtx.currentTime);
osc.frequency.exponentialRampToValueAtTime(10, audioCtx.currentTime + 0.12);
gain.gain.setValueAtTime(0.4, audioCtx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, audioCtx.currentTime + 0.15);
osc.start(); osc.stop(audioCtx.currentTime + 0.15);
} else if (type === 'impact') {
osc.type = 'triangle';
osc.frequency.setValueAtTime(120, audioCtx.currentTime);
osc.frequency.exponentialRampToValueAtTime(40, audioCtx.currentTime + 0.08);
gain.gain.setValueAtTime(0.2, audioCtx.currentTime);
gain.gain.exponentialRampToValueAtTime(0.01, audioCtx.currentTime + 0.1);
osc.start(); osc.stop(audioCtx.currentTime + 0.1);
}
}
// --- GENERADOR DE TEXTURAS PROCEDURALES AVANZADAS ---
// Construye mapas de normales y rugosidad en Canvas dinámicos para simular asfalto, nieve con barro y metal bélico
function generateProceduralTexture(type, baseColorHex, roughness) {
const canvas = document.createElement('canvas');
canvas.width = 512; canvas.height = 512;
const ctx = canvas.getContext('2d');
ctx.fillStyle = baseColorHex;
ctx.fillRect(0, 0, 512, 512);
// Generación de ruido matemático para relieve y rugosidad
const imgData = ctx.getImageData(0, 0, 512, 512);
const data = imgData.data;
for (let i = 0; i < data.length; i += 4) {
let noise = (Math.random() - 0.5) * roughness;
data[i] = Math.min(255, Math.max(0, data[i] + noise));
data[i+1] = Math.min(255, Math.max(0, data[i+1] + noise));
data[i+2] = Math.min(255, Math.max(0, data[i+2] + noise));
}
ctx.putImageData(imgData, 0, 0);
const texture = new THREE.CanvasTexture(canvas);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
return texture;
}
// --- INICIALIZACIÓN DEL MOTOR GRÁFICO (TRIPLE A CONFIG) ---
function initEngine() {