Skip to content

Commit d3bd48e

Browse files
DanMatclaude
andcommitted
Rebuild Castle natively as a top-down maze chase & rescue
Replace the Akihabara game engine with a dependency-free canvas game that keeps the original's heart (lost in a castle, dodge the mummies, find your friend) and builds it into a full arcade loop: - 8 escalating levels, each a freshly generated maze (recursive-backtracker), with a camera that follows the player. - Enemy variety with BFS pathfinding: shambling mummies (chasers), fast bats, and patrolling guards. - Rescue-and-escort objective: grab the key, reach your friend (who then follows your trail), and escort them to the exit before the timer runs out. - Torchlight fog-of-war on darker levels, spike traps, gems (with combos), hourglasses (+time), and Freeze / Sprint / Torch power-ups. - Lives, no-hit bonuses, a minimap, and a shared online leaderboard (gameId 'castle'); localStorage fallback. - All art drawn procedurally — no image assets. Removes the Akihabara engine, soundmanager and old sprites. Add community-standard files: rich README, MIT LICENSE, SECURITY, CONTRIBUTING, CODE_OF_CONDUCT, PR + issue templates, screenshot and social preview. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e074559 commit d3bd48e

85 files changed

Lines changed: 1404 additions & 29909 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Report something that isn't working correctly
4+
title: "[Bug]: "
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Describe the bug
10+
11+
A clear and concise description of what the bug is.
12+
13+
## Steps to reproduce
14+
15+
1. Start a game / reach level '...'
16+
2. Do '...'
17+
3. See the problem
18+
19+
## Expected behavior
20+
21+
What you expected to happen.
22+
23+
## Actual behavior
24+
25+
What actually happened.
26+
27+
## Screenshots / clip
28+
29+
If applicable, add screenshots or a short clip to help explain the problem.
30+
31+
## Environment
32+
33+
- Browser: [e.g. Chrome 120, Safari 17]
34+
- OS: [e.g. macOS 14, Windows 11]
35+
- Device: [e.g. Desktop, iPhone 15]
36+
- Leaderboard: [localStorage / Supabase]
37+
38+
## Additional context
39+
40+
Add any other context about the problem here.

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Question or discussion
4+
url: https://github.com/DanMat/Castle/discussions
5+
about: Ask questions and discuss ideas here instead of opening an issue.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea, a new enemy, power-up or level twist
4+
title: "[Feature]: "
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Is your feature request related to a problem?
10+
11+
A clear description of the problem or idea. Ex. "I wish Castle had [...]"
12+
13+
## Describe the solution you'd like
14+
15+
A clear and concise description of what you want to happen. For a new enemy or
16+
power-up, describe its behavior and how it fits the difficulty curve.
17+
18+
## Describe alternatives you've considered
19+
20+
Any alternative solutions or features you've thought about.
21+
22+
## Additional context
23+
24+
Add any other context, mockups, or screenshots about the feature request here.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- Thanks for contributing! Please fill this out to help review your change. -->
2+
3+
## Description
4+
5+
<!-- What does this PR do? Why is it needed? -->
6+
7+
## Related issue
8+
9+
<!-- e.g. Closes #12 -->
10+
11+
## Type of change
12+
13+
- [ ] Bug fix
14+
- [ ] New feature / new enemy / level twist
15+
- [ ] Balance / difficulty tweak
16+
- [ ] UI / styling change
17+
- [ ] Documentation
18+
- [ ] Refactor / cleanup
19+
20+
## Checklist
21+
22+
- [ ] I tested a full run: title → play → rescue → escort → level clear → game over → initials → leaderboard
23+
- [ ] I verified it works at **mobile width** (touch controls)
24+
- [ ] The leaderboard still works with **and** without Supabase configured
25+
- [ ] No new dependencies, build step, or image assets were introduced
26+
- [ ] The code matches the existing style
27+
28+
## Screenshots
29+
30+
<!-- If this is a visual change, add before/after screenshots or a short clip. -->

‎CODE_OF_CONDUCT.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment include:
18+
19+
- Demonstrating empathy and kindness toward other people
20+
- Being respectful of differing opinions, viewpoints, and experiences
21+
- Giving and gracefully accepting constructive feedback
22+
- Accepting responsibility and apologizing to those affected by our mistakes
23+
- Focusing on what is best for the overall community
24+
25+
Examples of unacceptable behavior include:
26+
27+
- The use of sexualized language or imagery, and sexual attention or advances
28+
- Trolling, insulting or derogatory comments, and personal or political attacks
29+
- Public or private harassment
30+
- Publishing others' private information without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Enforcement Responsibilities
35+
36+
Community leaders are responsible for clarifying and enforcing our standards and
37+
will take appropriate and fair corrective action in response to any behavior
38+
that they deem inappropriate, threatening, offensive, or harmful.
39+
40+
## Scope
41+
42+
This Code of Conduct applies within all community spaces, and also applies when
43+
an individual is officially representing the community in public spaces.
44+
45+
## Enforcement
46+
47+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
48+
reported to the community leaders responsible for enforcement at
49+
**dannymatthew@gmail.com**. All complaints will be reviewed and investigated
50+
promptly and fairly.
51+
52+
## Attribution
53+
54+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
55+
version 2.1, available at
56+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.

‎CONTRIBUTING.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing to Castle
2+
3+
Thanks for your interest in improving this project! It's a small, dependency-free
4+
game, so contributing is easy.
5+
6+
## Getting started
7+
8+
1. **Fork** the repository and **clone** your fork.
9+
2. Open `index.html` directly in a browser, or serve the folder:
10+
```bash
11+
python3 -m http.server 8000 # then visit http://localhost:8000
12+
```
13+
3. Create a branch for your change:
14+
```bash
15+
git checkout -b feature/my-improvement
16+
```
17+
18+
## Guidelines
19+
20+
- **No build step, no dependencies.** Keep it plain HTML, Canvas and vanilla JS.
21+
All art is drawn procedurally — please don't add image assets.
22+
- **New levels / enemies are welcome.** Level parameters live in `js/levels.js`
23+
(pure data); mazes are generated from them. Enemy types are handled in
24+
`updateEnemies` / `drawEnemies` in `js/game.js`.
25+
- **Don't break the leaderboard contract.** `js/leaderboard.js` is shared with
26+
other games; keep its public API (`top`, `submit`, `qualifies`, `mode`) stable
27+
and keep the localStorage fallback working when Supabase isn't configured.
28+
- **Test a full run** (title → play → rescue → escort → level clear → game over
29+
→ initials → leaderboard) and check **mobile width** before opening a PR.
30+
31+
## Submitting changes
32+
33+
1. Commit with a clear, descriptive message.
34+
2. Push to your fork and open a **pull request** against `main`.
35+
3. Fill out the pull request template and describe *what* changed and *why*.
36+
4. Link any related issue (e.g. `Closes #12`).
37+
38+
## Reporting bugs & ideas
39+
40+
Use the [issue templates](.github/ISSUE_TEMPLATE) to file a bug report or
41+
suggest a feature (a new enemy, power-up or level twist). Please include steps
42+
to reproduce and your browser/OS for bugs.
43+
44+
By contributing, you agree that your contributions will be licensed under the
45+
project's [MIT License](LICENSE).

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 DanMat
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,74 @@
1-
# Castle
2-
A HTML5 game developed using akihabara game engine. The main character of the game gets lost in a castle. Use the arrow keys to evade the mummies and find his friend.
1+
# Castle 🏰🕯️
2+
3+
> A top-down maze **chase & rescue** — you're lost in a haunted castle. Dodge the mummies, grab the key, rescue your friend and escort them to the exit before the timer runs out.
4+
5+
[![Play the demo](https://img.shields.io/badge/▶_Play-Live_Demo-ffcf6b?style=for-the-badge)](https://danmat.github.io/Castle/)
6+
&nbsp;
7+
![Vanilla JS](https://img.shields.io/badge/Vanilla_JS-no_dependencies-f7df1e)
8+
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
9+
10+
<p align="center">
11+
<img src="docs/screenshot.png" alt="Castle gameplay — a hero in a top-down stone maze with chasing mummies, gems, a friend to rescue and a minimap" width="720" />
12+
</p>
13+
14+
## What is it?
15+
16+
The original Castle was a little Akihabara-engine maze game. This is a ground-up
17+
rebuild in **dependency-free vanilla JavaScript** on a plain canvas that keeps
18+
the heart of it — run through a castle, dodge the mummies, find your friend —
19+
and layers on a full arcade loop: **8 generated levels**, torchlight fog, keys,
20+
power-ups, spike traps, a **rescue-and-escort** objective and an online
21+
leaderboard. All art is drawn procedurally (no image assets).
22+
23+
## How to play
24+
25+
- 🎮 **Move** with WASD / arrow keys (or drag on touch). The **camera follows you**.
26+
- 👻 **Mummies, bats and guards** chase you — one touch costs a life (you have 3).
27+
- 🗝️ Grab the **key**, find and **rescue your friend**, then **escort them to the glowing exit** before time runs out.
28+
- 💎 Collect **gems** for score (chain them for a **combo**) and **⏳ hourglasses** for more time.
29+
- ⚡ **Power-ups**: *Freeze* stops the mummies, *Sprint* speeds you up, *Torch* widens your view.
30+
- ⚔️ Dodge **spike traps**, and lean on the **minimap** to navigate.
31+
32+
## Features
33+
34+
- 🧩 **8 escalating levels** — each a freshly generated maze (endlessly replayable).
35+
- 🕯️ **Torchlight / fog-of-war** on the darker levels for real "lost in a castle" tension.
36+
- 👥 **Enemy variety** — shambling mummies (chasers), fast bats, patrolling guards.
37+
- 🤝 **Rescue & escort** — your friend follows your trail once found.
38+
- 🏆 **Online leaderboard** (time + treasure + no-hit bonuses) with retro initials entry.
39+
- 🕹️ Keyboard + touch, fully responsive.
40+
41+
## High scores
42+
43+
The leaderboard uses your browser's **localStorage** out of the box and shares
44+
an online board across all of these games via a free **Supabase** project. See
45+
[`docs/supabase.sql`](docs/supabase.sql) for the schema and
46+
[`js/config.js`](js/config.js) for where the project URL + public key go — the
47+
board is namespaced by `gameId`, so Castle's scores are separate.
48+
49+
## Play locally
50+
51+
It's a static site — no build step:
52+
53+
```bash
54+
git clone https://github.com/DanMat/Castle.git
55+
cd Castle
56+
python3 -m http.server 8000 # then visit http://localhost:8000
57+
```
58+
59+
## How it works
60+
61+
| File | Responsibility |
62+
| --- | --- |
63+
| `js/game.js` | Canvas engine: maze generation, camera, movement/collision, chasing-enemy pathfinding (BFS), fog, items, escort, HUD, state machine. |
64+
| `js/levels.js` | Pure-data level parameters (size, enemies, timer, torch radius, theme). |
65+
| `js/leaderboard.js` | Reusable high-score store (Supabase REST + localStorage fallback). |
66+
| `js/config.js` | Supabase URL/key and game id. |
67+
68+
## Credits
69+
70+
Rebuilt in vanilla JavaScript from the original Akihabara-engine version.
71+
72+
## License
73+
74+
[MIT](LICENSE) © DanMat

‎SECURITY.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Security Policy
2+
3+
## Supported versions
4+
5+
This is a small, static, client-side game. The latest version on the `main`
6+
branch is the only supported version.
7+
8+
## A note on the leaderboard
9+
10+
Castle can post high scores to a shared **Supabase** backend. The Supabase
11+
**anon/publishable key** in `js/config.js` is *designed to be public* — the
12+
database is protected by row-level-security policies (see `docs/supabase.sql`).
13+
Publishing that key is expected and is not a vulnerability.
14+
15+
As with any client-side leaderboard, scores can be spoofed by a determined user.
16+
The validation constraints in the RLS policy stop casual tampering; server-side
17+
game validation is intentionally out of scope for an arcade board.
18+
19+
## Reporting a vulnerability
20+
21+
If you discover a genuine security issue (for example a cross-site scripting
22+
vector in how initials or leaderboard rows are rendered, or a way to bypass the
23+
RLS policies), please report it privately rather than opening a public issue.
24+
25+
- Use GitHub's [private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability)
26+
("Report a vulnerability" under the repository's **Security** tab), **or**
27+
- Email the maintainer at **dannymatthew@gmail.com**.
28+
29+
Please include a description, steps to reproduce, and the browser/version. You
30+
can expect an initial response within **7 days**.

‎akihabara/buttons.png‎

-481 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)