Write web app to make the game:
Title: ASCII Base Battle - A Real-Time Strategy Game

Description:

Create an HTML5 game where two bases send armies against one another, engaging in combat until one base is destroyed. The game is presented using ASCII art to visually represent different unit types and bases. The player commands one base, while the opposing base is controlled by an AI. The game leverages a JavaScript physics library (e.g., Matter.js) to handle collisions and ensure smooth movement of units across the battlefield.

Core Features:

Game Setup:
The game canvas displays a side view of the battlefield with two bases located on opposite sides (left for player, right for AI).
Bases are represented using ASCII art [BASE] and display their current health points (HP).
Unit Types:
Soldier: Basic melee unit.
Cost: 50 gold
Speed: Medium
Health: Low
Damage: Moderate
ASCII Art: >@ (player), @< (AI)
Archer: Ranged unit with higher damage but lower health.
Cost: 75 gold
Speed: Fast
Health: Very low
Damage: High
ASCII Art: }-@ (player), @-{ (AI)
Heavy Unit: A tank unit with high health and damage but slower speed.
Cost: 100 gold
Speed: Slow
Health: High
Damage: High
ASCII Art: =>@ (player), @<= (AI)
Gold Economy:
Players start with a set amount of gold (e.g., 200 gold).
Gold is required to deploy units, with each unit type costing a specific amount.
Gold is earned by:
Defeating enemy units (+10 gold per unit).
Damaging the enemy base (+20 gold per successful attack).
Over time (e.g., +5 gold every few seconds as passive income).
Unit Deployment:
The player can deploy units by clicking buttons corresponding to each unit type, provided they have enough gold.
The AI will deploy units at regular intervals and can choose different unit types.
Movement and Combat:
Units move horizontally across the battlefield at constant speeds specific to their unit type.
The physics engine (e.g., Matter.js) handles smooth movement and collision detection.
When units from opposing sides collide, they engage in combat:
Each unit inflicts damage based on its damage attribute.
Units have health points and are destroyed when their health reaches zero.
Units continue moving if there is no opposing unit in their path.
Base Interaction:
If a unit reaches the enemy base, it deals damage directly to the base's health.
Bases have a finite amount of health (e.g., 100 HP).
The game ends when one base's health reaches zero.
User Interface:
Display the player's current gold prominently on the screen.
Show the health of both the player's base and the AI's base.
Provide buttons for deploying each type of unit, labeled with the unit's name and cost.
Use ASCII art to represent units and bases on the canvas.
Physics and Collision Handling:
Use a JavaScript physics engine (e.g., Matter.js) to manage unit movement and collisions.
Disable gravity to ensure units move horizontally without falling.
Implement collision filters to prevent units from the same side from colliding with each other.
Units are set as sensors so they do not physically block each other's movement.
AI Behavior:
The AI deploys units at intervals or based on certain conditions.
It randomly selects unit types to deploy, potentially with a strategy to counter the player's units.
Additional Features:

Passive Gold Income:
Implement a passive gold income system where the player receives a small amount of gold at regular intervals.
This ensures the player can continue to deploy units even if they are not earning gold from combat.
Upgradable Units and Bases:
Allow the player to upgrade their units and base using gold.
Upgrades could improve unit health, speed, damage, or reduce unit cost.
Base upgrades might increase maximum health or add defensive capabilities.
Special Abilities:
Introduce special abilities or spells that the player can activate using gold or a cooldown system.
Examples include healing units, damaging enemy units, or temporarily boosting unit speed.
Health Bars:
Display health bars above units to provide visual feedback on their remaining health.
Enemy Variety:
Add more diverse AI units with unique behaviors or abilities.
For example, a unit that can temporarily stun player units or a unit that can heal other AI units.
Game Levels or Waves:
Structure the game with levels or waves of increasing difficulty.
Each level could introduce new challenges, such as stronger AI units or environmental obstacles.
Sound Effects and Music:
Incorporate sound effects for unit deployment, combat interactions, and base damage.
Add background music to enhance the gaming experience.
Visual Enhancements:
Use colors effectively to distinguish between unit types and sides.
Animate ASCII characters to simulate movement or attacks.
Implement particle effects for explosions or impacts using ASCII symbols.
Statistics and Scoreboard:
Display game statistics such as units deployed, units destroyed, gold earned, and time elapsed.
Show a final score at the end of the game based on performance.
Difficulty Settings:
Allow the player to select a difficulty level at the start of the game.
Adjust AI behavior, gold income, or unit strength based on the selected difficulty.
Tutorial and Instructions:
Provide a brief tutorial or instructions to help new players understand the game mechanics.
Pause and Restart:
Implement a pause functionality to allow players to pause the game.
Include options to restart the game or return to the main menu.
Implementation Notes:

HTML and Canvas Setup:
Use an HTML <canvas> element to render the game visuals.
Set up the canvas with appropriate dimensions and styles for the game.
JavaScript Structure:
Organize code using functions and objects to represent units, bases, and game logic.
Use event listeners for user interactions (e.g., button clicks for deploying units).
Implement game loops and rendering using requestAnimationFrame.
Physics Engine Usage:
Use Matter.js or a similar physics library to handle movement and collision detection.
Disable gravity (set engine.gravity.y = 0) to prevent units from falling.
Set units as sensors (isSensor: true) and use collision filters to manage interactions.
ASCII Art Representation:
Carefully design ASCII characters to represent different units and their orientations.
Utilize colors (fillStyle) to differentiate between player units and AI units.
Game Balance:
Adjust unit costs, stats, and gold income to ensure balanced gameplay.
Playtest the game to refine values and improve the player's experience.