# Fireing — Enhanced (Weapons, Power-ups, Leaderboard, CI/CD)
Playable HTML5 canvas shooter — enhanced with:
- Multiple weapons (Pistol, Shotgun, Spread, Rapid)
- Power-ups & pickups (health, shield, weapon pickups, rapid-fire buff)
- Several enemy types (normal, fast, tank, kamikaze) and wave scaling
- Optional online leaderboard via Firebase Realtime Database (opt-in)
- PWA manifest + Service Worker for offline caching
- Build/minify with esbuild and npm scripts
- GitHub Actions workflow to auto-deploy to GitHub Pages
- SVG icons included
Files included
- index.html
- style.css
- game.js (main, dev)
- manifest.json
- sw.js
- icon-192.svg, icon-512.svg
- leaderboard-config.json (optional, contains your RTDB URL)
- leaderboard-config.example.json
- package.json
- firebase-client.js (module to handle auth + submit)
- firebase-client-snippet.html (compat snippet)
- firebase.json (hosting rewrites)
- functions/ (Cloud Function example)
- README.md (this file)
Firebase / Leaderboard (filled for your project)
- Firebase project id: firing-f71f7
- Realtime DB URL (example used in repo): https://firing-f71f7-default-rtdb.firebaseio.com
- Client-side Firebase config is present in `firebase-client.js` and `firebase-client-snippet.html` (initialized with the values you provided).
- A sample Cloud Function `functions/submitScore` is included and wired in `firebase.json` via a hosting rewrite for `/submitScore`. The client module will POST to `/submitScore` and the function verifies the user's ID token before writing to the RTDB.
Quick start (no build)
1. Open `index.html` in your browser (double-click). Basic play works.
2. For full PWA / service worker behavior, serve files via a static server (recommended).
Recommended local dev (Node)
1. Install dev deps: `npm ci`
2. Run a static server (live-server recommended):
- `npm run start`
3. Play at the printed local URL.
Deploy Firebase Functions & Hosting (optional)
1. Install Firebase CLI and login: `npm i -g firebase-tools && firebase login`
2. Initialize (if not already): `firebase init`
- Choose Hosting and Functions; ensure functions language is JavaScript and node engine >=18.
3. Deploy:
- `firebase deploy --only functions,hosting`
- The hosting rewrite maps `/submitScore` to the `submitScore` Cloud Function so the client can POST to `/submitScore`.
GitHub Pages
- This repository is configured to be published as a GitHub Pages site at:
https://thejankilal.github.io/firing/
(Enable Pages in the repo settings or use the included GitHub Actions workflow to publish `dist/` to `gh-pages`.)
Security notes
- The Realtime Database is accessed directly in the simple client POST flow (if `leaderboard-config.json` is used). For production, prefer the Cloud Function approach (included) which requires a valid Firebase ID token — the function verifies the token and then writes to the DB.
- Make sure your RTDB rules are appropriate for your use case. For testing you can allow public reads/writes, but for production lock it down:
```json
{
"rules": {
".read": false,
".write": false
}
}- When using the Cloud Function, enforce additional server-side validation if needed.
If you'd like I can:
- Add authenticated leaderboard UI (list top scores via the function)
- Add GitHub Actions workflow (auto-build + deploy to gh-pages)
- Provide sample RTDB rules tuned for this leaderboard pattern
- Replace SVG icons with generated PNGs
Enjoy — drop these files into the repo thejankilal/firing and follow deploy steps above.