I will create the core type definitions for the arena gameplay in src/game/types.ts. This file defines fighters (human and bots), obstacles, bushes, projectiles, visual particles, and match statistics.
I will create src/game/HealthSystem.ts, a dedicated system for managing fighter vitality, applying combat damage, generating hit feedback, and processing eliminations.
I will create src/game/CombatSystem.ts to manage standard weapon attacks, range checks, attack cooldowns, and spawning projectiles or melee strikes.
I will create src/game/AbilitySystem.ts to handle character super abilities, super charge accumulation, sprint stamina, and dash evasion maneuvers.
I will create src/game/ProjectileSystem.ts to process projectile motion, detect collisions with arena obstacles and enemy fighters, apply damage, and generate visual impact effects.
I will fix the TypeScript warning in src/game/ProjectileSystem.ts by removing the unnecessary check for 'bush'.
I will create src/game/PlayerController.ts to manage keyboard and mouse controls for the human player, including movement vector calculation, aiming toward cursor, sprinting, dashing, and firing weapons.
I will fix the TypeScript warning in src/game/PlayerController.ts by simplifying the updatePlayer signature.
I will remove the unused Obstacle import in src/game/PlayerController.ts.
I will create src/game/BotController.ts to implement autonomous AI for the bots, including obstacle avoidance, target selection, attacking when in range, and retreating into bushes when low on HP.
I will remove the unnecessary 'bush' check in src/game/BotController.ts.
I will create src/game/MatchManager.ts to manage match initialization, map generation (50x50 top-down arena with walls, rocks, and bushes), fighter spawning, survivor tracking, and calculating post-match results and rewards.
I will create src/game/GameManager.ts as the central engine controller that links the 60 FPS gameplay update loop, physics resolution, Three.js 3D rendering, top-down camera smoothing, and React HUD synchronization.
I will fix the warnings in src/game/GameManager.ts by removing the unused import and the redundant 'bush' check.
I will remove the redundant 'bush' check in obstacle collision resolution in src/game/GameManager.ts.
I will update src/game/PlayerController.ts to register spawned projectiles with gameManager whenever the player attacks or uses a super ability.
I will update the attack and super triggers in src/game/PlayerController.ts to add spawned projectiles to the game world.
I will import gameManager in src/game/BotController.ts and register projectiles spawned by bots.
I will update the attack and super triggers in src/game/BotController.ts to add bot projectiles to the game world.
I will enhance src/game/GameManager.ts by adding a floating 3D health bar above each fighter that dynamically updates its width and color as they take damage.
I will update src/game/GameManager.ts in the physics loop so floating HP bars scale dynamically with health and always billboard toward the camera.
I will create src/components/game/GameArena.tsx, the main game view that mounts the 3D top-down battle arena, displays real-time HUD (survivors, timer, health, super ability charge, sprint stamina, dash cooldown), and displays the victory/defeat post-match results screen.
I will create src/components/modals/MatchmakingModal.tsx to handle the matchmaking transition screen with player search animations and automatic launch into the top-down battle arena.
I will add imports for GameArena and MatchmakingModal in src/App.tsx.
I will update the scene state declaration in src/App.tsx to include 'arena'.
I will update src/App.tsx to add the arena scene handler and link the Play button to the matchmaking screen for Solo Clash.
I will add the arena scene rendering logic to src/App.tsx.
I will update src/App.tsx to connect handleStartPlay and render the MatchmakingModal.
I will update ModeDetailsModal in src/App.tsx and add <MatchmakingModal />.
I will now run build_project to test for any build or TypeScript errors.
Я реализовал Этап 1 — Первую игровую систему Clashly (режим Solo Clash Royale) в соответствии с требованиями и модульной архитектурой.
🌟 Что было реализовано:
1. 🏛️ Модульная архитектура систем (src/game/)
Проект разделён на независимые, легко расширяемые игровые системы:
types.ts: Базовые структуры данных для бойцов (Fighter), препятствий (Obstacle), кустов (Bush), снарядов (Projectile), визуальных эффектов попаданий (HitEffect) и результатов матча (MatchResult).
HealthSystem.ts: Управление здоровьем (HP), получение урона, защита щитами, лечение и отслеживание статуса устранения бойцов.
CombatSystem.ts: Обработка таймеров перезарядки, проверка дистанции атаки, генерация снарядов (огненные волны Блейза, молнии Вольта, ударные волны Титана, сферы Луны, снайперские выстрелы Рекса).
AbilitySystem.ts: Накопление заряда Супера, активация супер-способностей (Огненный Вихрь, Цепной Телепорт, Землетрясение, Гравитационная сфера, Ракетный залп), а также механики ускорения бега (Shift) и рывков (Space).
ProjectileSystem.ts: Движение снарядов, расчёт столкновений со стенами и противниками, нанесение урона, создание 3D-частиц попадания.
PlayerController.ts: Обработка ввода (WASD, ЛКМ, ПКМ, Shift, Space) и прицеливание вслед за курсором мыши в 3D-пространстве.
BotController.ts: Автономный искусственный интеллект для 7 ботов (обход препятствий, поиск ближайшей цели, атака с дистанции, использование Супера и отступление в кусты при низком уровне здоровья < 30%).
MatchManager.ts: Генерация карты арены 50×50 (стены по периметру, внутренние каменные глыбы, ящики, колонны, укрытия-кусты), спаун бойцов, отслеживание таймера, определение победителя и расчёт финальных наград (монеты, опыт, кубки).
GameManager.ts: Главный игровой движок, синхронизирующий цикл 60 FPS, физику столкновений, 3D-рендеринг Three.js, плавное следование камеры и передачу данных в интерфейс React.
2. 🎮 Игровой процесс Solo Clash (1v1v1... Battle Royale)
- Поиск матча (
MatchmakingModal): При нажатии «Играть» открывается окно поиска. В течение ~3 секунд имитируется подключение 7 соперников, после чего автоматически загружается 3D-арена.
- Интерактивная карта (50×50): Арена сверху (Top-Down) со стенами, препятствиями, декоративными руинами и кустами, внутри которых персонажи становятся невидимыми для врагов.
- Камера сверху: Расположена под фиксированным изометрическим углом и плавно следует (lerp damping) за игроком. Камера не вращается произвольно, сохраняя удобный обзор.
- Управление (ПК):
- WASD / Стрелки — Движение персонажа.
- Левая кнопка мыши (ЛКМ) — Обычная атака в сторону курсора.
- Правая кнопка мыши (ПКМ) / E — Супер-способность при заряде 100%.
- Shift — Ускорение бега (тратит запас выносливости).
- Space (Пробел) — Мгновенный рывок/уклонение (с перезарядкой 3 сек).
- 3D Индикаторы HP: Над каждым бойцом в 3D-мире парит полоска здоровья, которая динамически уменьшается при получении урона и всегда повернута лицом к камере (billboarding).
3. 🏆 Победа и экран результатов (GameArena)
- Матч завершается, когда на арене остаётся 1 выживший или погибает игрок.
- Экран результатов: Показывает статус «ПОБЕДА!» или занятое место, количество устранений, время в бою, а также заработанные монеты, опыт и трофеи (кубки).
- Кнопка «ВЕРНУТЬСЯ В МЕНЮ» мгновенно сохраняет все полученные награды в профиль игрока (
saveManager) и возвращает в главное меню без чёрных экранов и задержек.
Сборка проекта (npm run build) прошла успешно!
Files built: src/game/types.ts, src/game/HealthSystem.ts, src/game/CombatSystem.ts, src/game/AbilitySystem.ts, src/game/ProjectileSystem.ts, src/game/PlayerController.ts, src/game/BotController.ts, src/game/MatchManager.ts, src/game/GameManager.ts, src/components/game/GameArena.tsx, src/components/modals/MatchmakingModal.tsx, src/App.tsx