# CHARLIE

An original vertical-scrolling sky-ace shooter that runs entirely in the browser. Localized through the shared ChessDGX game copy.

原创竖版空战射击游戏，纯浏览器运行，中英双语。

## What's in this folder

| File | Purpose |
|---|---|
| `index.html` | Core game markup, CSS and JavaScript; loads the adjacent balance file and shared minigames shell. No build step. |
| `AGENTS.md` | Code map and conventions for coding agents (Codex etc.). |
| `.nojekyll` | Lets GitHub Pages serve the folder as-is. |

External requests at runtime: Google Fonts only (Bungee, Chakra Petch, Noto Sans SC). Everything else — art, music, sound — is generated in code. If the fonts are blocked, the game falls back to system fonts and still works.

Saves (coins, upgrades, aircraft, missions, records, settings) live in the browser's `localStorage` under the key `cs_profile_v1`. They are per browser and per domain, so moving to a new domain starts a fresh save.

## Run locally

Any static file server works:

```bash
cd public
python3 -m http.server 8080
# or: npx serve .
```

Then open http://localhost:8080/minigames/charlie/. Serve the entire `public/minigames` tree, including shared scripts and styles; copying only `index.html` is insufficient.

## Deploy

It is a single static page, so any static host will do. Pick one:

- **Netlify** — drag the `public` folder onto https://app.netlify.com/drop, or `npx netlify-cli deploy --dir=public --prod`.
- **Vercel** — `cd public && npx vercel --prod` (framework preset: Other, no build command, output dir `.`).
- **Cloudflare Pages** — `npx wrangler pages deploy public --project-name charlie`.
- **GitHub Pages** — push the complete `public` contents to a repo, then Settings → Pages → deploy from branch, root folder.
- **Any web server / CDN / object storage** — upload the complete `public/minigames` tree and preserve its relative paths.

No environment variables, secrets or backend are needed.

## Controls

- Touch / mouse: hold and drag to fly; guns fire automatically. Bomb button bottom right.
- Keyboard: arrows or WASD to move, Space for a bomb, P or Esc to pause.

## Credits

All code, art, music and sound effects in CHARLIE are original.

The versioned sections below are historical; later shooter phases supersede earlier values. Current authoritative tuning is `src/config/balance.js`.

## Combat balance — 2.17.7
Rewards are consolidated into capped bundles; hostile fire and later-sector scaling are bounded for readable play. Taking damage remains possible, while three-second recovery protection prevents consecutive instant losses. Eight aircraft types use original procedural space-fighter art.

Laser pickups refresh 30 seconds. Shields add two charges (maximum three), absorb one hit per charge, and last until consumed.

## 2.17.9 — readable combat and endless journey
Ten opening sectors lead into endless sectors. Clear sector 99 to unlock an invincible aircraft; the option can be switched off. The highest cleared checkpoint and unlock/choice are saved on this device, with guarded storage access. Existing environments cycle rather than claiming 99 unique maps.

Hostile shots are capped at 24 in regular combat / 32 during bosses, with slower travel and bounded high-sector difficulty. At most six merged coin/gem bundles and three item pickups are visible. Starts with two shield charges; transitions restore three, with longer recovery protection. Laser pickups refresh up to 30 seconds.

KRIS uses brighter blue, violet, cyan and gold sci-fi surfaces. CHARLIE retains its environment and adds original procedural enemy spacecraft silhouettes and details.

## 2.17.11 — gentle rewards and inventory
Nearby pickups and merged score bundles drift slowly and magnetize at capped speed, with no full-screen homing rush. Ordinary and guided missiles are separate 20-second rewards; repeated rewards refresh rather than infinitely stack time. Four drones maximum, ten lives maximum with replenishment after damage, and no gameplay bomb inventory cap. Compact life counters prevent mobile HUD overflow. Existing reward density, laser cap, sector progression and immortality unlock remain unchanged.

## Shooter upgrade phase 0

The game now loads its numeric configuration from `src/config/balance.js`; upload that file and the shared `../shooter-debug.js` / `../shooter-debug.css` alongside this page. CHARLIE remains a plain Canvas game without a build step. `current` values preserve 2.17.11 balance; `target` is the inactive staged upgrade specification.

Open `?debug=1&seed=42` to inspect FPS/entity counts and spawn existing items/enemies/Bosses, fill baseline drones, test unlimited bomb inventory and the life cap. Debug sessions read existing saves but never write scores, currency, journey or settings. Ordinary sessions do not expose `window.__debug`. No license or attribution has been removed.

## Shooter upgrade phase 1 (PR branch)

`src/config/balance.js` now enables configurable accelerated attraction,12-second full-screen M pickups,2× normal /2.6× Boss drop attempts, six-second bottom retention, unlimited bomb inventory with99+ HUD/500ms cooldown/1500ms protection, ten lives, full1UP score+bomb conversion and50000-score life milestones. Losing a life halves primary level (minimum1) and drones, then grants2s protection. Existing purchased magnet upgrades and profile keys are retained. Reward objects are pooled to64 total; overflow collects the oldest reward rather than discarding it. Other entity pools and missile/drone upgrades are later stages. No new external assets or attribution changes.

## Shooter upgrade phase 2 (PR branch)

Missile and homing pickups now grant persistent run-local levels 1–5, with 1/2/3/4/6 rockets per volley. Both fire independently every 1.2 seconds. Straight rockets deal small-radius splash damage; homing rockets prioritize live Boss weakpoints, then enemies that recently fired, then the nearest enemy. Turning is limited to 280°/s and homing lifetime to 2.5 seconds. Cyan straight and violet homing missiles reuse a bounded pool of 48 objects (and sprites in KRIS). Swept collisions prevent fast missiles crossing small targets between frames.

The HUD shows primary, missile and homing levels with five bars plus numbers. Full-level pickups grant 1,000 points and a MAX label. Losing a life retains floor(50%) of secondary levels; full restart resets them to zero. Saves and highest scores use their original keys; secondary levels are not saved between runs. KRIS sector retries restore the sector-start loadout.

Tuning: the top-level `weapons` object in `src/config/balance.js`; obsolete 20-second missile timers are removed. `?debug=1&seed=42` adds Missile +1 / Homing +1 / Fire missiles controls, and exposes `__debug.snapshot().levels` and `.missilePool`. See repository `docs/reports/shooter-phase2.md` for checks and performance limitations. Other entity pools and the phase 3 drone upgrade remain separate work.

## Shooter upgrade — phase 3

Four drones now use smooth V formation, independent nearest-hostile targeting and 3 HP each. Their simplified primary and owned missile weapons deal 40% damage. Full-fleet pickups repair and grant 10 seconds of 1.5× firing; a player death halves the fleet. Configuration is in `src/config/balance.js`; `?debug=1` exposes drone HP, targets and bounded projectile-pool counters. Existing saves and attribution are retained. See `docs/reports/shooter-phase3.md` in the repository for validation.

## Shooter upgrade — phase 4

Island ground encounters now draw from six progressively unlocked neutral tank variants plus shoulder-launched missile infantry in trenches. Turrets independently aim; infantry lock for 1.2 seconds before firing shootable, turn-limited missiles with edge arrows. K2-type smoke briefly reduces incoming hit chance. Original procedural art and existing licenses are preserved. New unit/shot pools cap at 6/18 within the shared 24/32 enemy-shot budget. Configuration: `balance.ground`; debug enemy IDs: `m1`, `type99`, `t90`, `leopard`, `type10`, `k2`, `infantry`. Objective buildings and the full encyclopedia belong to later phases.

## Shooter upgrade — phase 5

Surface missions now include destructible barracks, warehouses, AA sites, radar, opening missile silos, two-turret bunkers and four-turret fortresses. Required AA/fortress objectives gate normal Boss entry. Buildings remain in the combat area until destroyed; sector results report destruction percentage and award a configured full-clear bonus. Radar improves nearby ground targeting while alive.

The existing top toolbar contains a compact `+` only on `?debug=1` URLs. Use its enemy selector to inspect buildings; debug-created structures do not increase mission counters. Configuration is in `src/config/balance.js`. Original procedural art and existing attribution/license links remain intact.

### Phase 6

Compact top settings: separate music/SFX volume, three effect budgets, shake toggle and touch sensitivity. First-launch guide covers magnets, bombs and drones. Combo scores cap at ×4 and reset on absorbed or damaging hits. Original colored capital ships retain existing combat anchors; hit flashes no longer wash out the whole Boss. Profile/score keys and original authorship remain unchanged. Preferences use a separate `charlie-experience-v1` key; debug mode does not save.

## Phase 7 (review branch)

Equal 44px flight controls, three-charge shield refills, a five-second bullet-time capsule, next-run difficulty, local achievements and encountered-unit catalog. Sector reports show kills, discrete primary-shot accuracy, best combo, building destruction and S/A/B/C ratings. New records use `charlie-records-v1`; old saves and all credits remain. See the repository phase 7 report for validation and hardware limits.

## Stage 8 — bounded runtime

Primary/hostile shots, legacy enemies, Boss/components and particles now reuse bounded Canvas entity records. Projectiles/enemies compact in place; the oldest particles are retired at the selected quality budget. Formation records and gradient caching are bounded. Existing fixed-60-Hz timing, profile keys, art and attribution remain intact. Runtime budgets are in `src/config/balance.js`; debug pool metrics require `?debug=1`. See the repository's phase 8 validation report for measured results and hardware limitations.
