Skip to content

Commit 678db35

Browse files
Edwin ChanEdwin Chan
authored andcommitted
Initial commit
1 parent 6ca2afa commit 678db35

59 files changed

Lines changed: 8881 additions & 1320 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy.yml‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v6
27+
with:
28+
node-version: 22
29+
cache: npm
30+
31+
- name: Configure GitHub Pages
32+
uses: actions/configure-pages@v5
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Check
38+
run: npm run check
39+
40+
- name: Test
41+
run: npm run test
42+
43+
- name: Build
44+
run: npm run build
45+
46+
- name: Upload GitHub Pages artifact
47+
uses: actions/upload-pages-artifact@v4
48+
with:
49+
path: dist
50+
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
.npm-cache/
23
.DS_Store
34
dist/
45
.env

‎ARCHITECTURE.md‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Architecture
2+
3+
## Overview
4+
5+
Cosmic Crusader is a static Vite multi-page application. The interactive home route progressively enhances complete semantic portfolio HTML with a modular vanilla Three.js experience. `/posts.html` remains an independently usable normal page.
6+
7+
```text
8+
portfolio.ts
9+
├── Vite HTML transform ──> crawlable index/posts HTML
10+
├── ContentPanel ─────────> readable modal content
11+
└── World ────────────────> celestial destinations
12+
13+
InputController ──> FlightController ──> Spacecraft + Camera
14+
│
15+
World interactables ─> ProximitySystem ─> HUD / ContentPanel
16+
│
17+
QualityManager ─────> World + SpaceRenderer
18+
```
19+
20+
## Build-time content
21+
22+
`src/data/portfolio.ts` is the verified structured source. The custom Vite HTML plugin in `vite.config.ts` renders:
23+
24+
- The complete 2D/crawlable portfolio in `index.html`
25+
- The posts list in `posts.html`
26+
- JSON-LD for the person, site, and real projects
27+
28+
Runtime code does not fetch or scrape portfolio content.
29+
30+
## Runtime ownership
31+
32+
`PortfolioApp` owns application lifetime and creates the following independent modules:
33+
34+
- `SpaceRenderer`: WebGLRenderer, composer, restrained bloom/vignette, resize, disposal
35+
- `World`: solar system, destinations, instances, procedural environment, interaction registry
36+
- `Spacecraft`: original ship geometry, anchors, engine effects, disposal
37+
- `InputController`: keyboard, mouse/pointer lock, touch look, normalized actions
38+
- `FlightController`: acceleration, damping, boost, braking, orientation, camera, autopilot, collision recovery, reset
39+
- `ProximitySystem`: nearest/inspectable object selection by surface distance
40+
- `QualityManager`: device-based presets and sampled-frame-rate downshifts
41+
- `HUDController`: telemetry, radar state, proximity prompt, projected destination markers
42+
- `ContentPanel`: content selection, native dialog/focus lifecycle, route synchronization
43+
- `NavigationController`: menu, map, autopilot selection, graphics/accessibility settings
44+
- `TouchControls`: joystick and large touch actions
45+
- `AudioManager`: muted-by-default procedural engine and UI audio
46+
47+
Every Three.js geometry, material, texture, animation loop, listener, and AudioContext has a disposal owner.
48+
49+
## Frame order
50+
51+
The animation loop uses a clamped delta and performs:
52+
53+
1. Pause immediately when the document is hidden.
54+
2. Update procedural world animation and orbiters.
55+
3. Find the nearest interaction/collision candidate.
56+
4. Update flight, boost, damping, autopilot, collision prevention, and reset range.
57+
5. Recompute proximity and input context.
58+
6. Consume bounded UI actions such as inspect, map, camera, and reset.
59+
7. Update the chase/cockpit camera.
60+
8. Update HUD, audio, and sampled quality.
61+
9. Render once through the selected graphics path.
62+
63+
High-frequency vectors remain in the simulation layer; the page is not rerendered by a UI framework.
64+
65+
## Routing
66+
67+
GitHub Pages-friendly query state keeps important locations shareable:
68+
69+
- `/?destination=home`
70+
- `/?destination=projects`
71+
- `/?destination=projects&item=ib-question-bank`
72+
- `/?destination=writing`
73+
- `/posts.html`
74+
75+
`pushState`, `replaceState`, and `popstate` synchronize content panels without requiring SPA rewrites. The former placeholder `/posts/example-post.html` is preserved as a noindex redirect to `/posts.html`.
76+
77+
## Accessibility model
78+
79+
- Build output contains all important text and links before JavaScript starts.
80+
- WebGL failure or visitor choice reveals the complete 2D portfolio.
81+
- Native dialogs provide modal semantics; explicit focus containment and restoration are implemented.
82+
- Menus, radar markers, maps, links, settings, and panels are keyboard reachable.
83+
- Reduced motion, reduced camera movement, high contrast, postprocessing disable, and guided exploration are available.
84+
- Touch mode uses large labeled controls and prevents page scrolling while piloting.
85+
86+
## Graphics and performance
87+
88+
| Feature | Low | Medium | High | Auto |
89+
| --- | --- | --- | --- | --- |
90+
| Pixel ratio cap | 1.0 | 1.45 | 1.85 | Device selected |
91+
| Stars | 1,200 | 2,800 | 5,200 | Device/frame selected |
92+
| Asteroids | 60 | 120 | 180 | Device/frame selected |
93+
| Postprocessing | Off | Available | Available | Adaptive |
94+
| Shadows flag | Off | Off | Enabled for future selective use | Adaptive |
95+
96+
Stars use buffered point layers; asteroids use one `InstancedMesh`; nebulae use small generated canvas textures. The main Three.js application is dynamically imported after the semantic shell. No large model, texture, video, or audio download exists.
97+
98+
## Deployment
99+
100+
`npm run build` produces `dist/`. GitHub Actions runs `npm ci`, checks, tests, builds, and deploys the artifact to GitHub Pages. `public/CNAME` binds the artifact to `portfolio.mycosmic.dev`; no application server or VPS is involved.

‎ASSET_CREDITS.md‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Asset Credits
2+
3+
## Original procedural runtime work
4+
5+
The following assets are source-authored in this repository and created at runtime without downloaded models, textures, or audio files:
6+
7+
- Low-poly scout spacecraft, cockpit, wings, engines, navigation lights, and trails
8+
- Sun, five destination bodies, project moons, achievement beacons, archive rings, and communications station
9+
- Star layers, asteroid instances, nebula canvas textures, shooting stars, orbital lines, and solar flares
10+
- Solar surface, atmosphere/rim, bloom, vignette, scan, radar, reticle, and holographic interface effects
11+
- Engine hum and interface tones produced with the Web Audio API
12+
- Compass-style inline favicon and code-native HUD symbols
13+
14+
Source locations: `src/scene/`, `src/shaders/`, `src/audio/`, and `src/styles/`.
15+
16+
## Runtime software
17+
18+
### Three.js
19+
20+
- Use: WebGL renderer, scene graph, geometry, materials, math, cameras, and native postprocessing utilities
21+
- Project: <https://threejs.org/>
22+
- Source: <https://github.com/mrdoob/three.js>
23+
- License: MIT
24+
- Installed version: see `package-lock.json`
25+
26+
## Fonts
27+
28+
The site requests these fonts through Google Fonts and includes robust system fallbacks:
29+
30+
### Orbitron
31+
32+
- Use: display titles and brand lockup
33+
- Source: <https://fonts.google.com/specimen/Orbitron>
34+
- License: SIL Open Font License 1.1
35+
36+
### Oxanium
37+
38+
- Use: body copy and readable interface text
39+
- Source: <https://fonts.google.com/specimen/Oxanium>
40+
- License: SIL Open Font License 1.1
41+
42+
### IBM Plex Mono
43+
44+
- Use: telemetry, labels, controls, and technical metadata
45+
- Source: <https://github.com/IBM/plex>
46+
- License: SIL Open Font License 1.1
47+
48+
## Generated images
49+
50+
### Public social preview
51+
52+
- Runtime path: `public/og-image.png`
53+
- Use: Open Graph and Twitter/X social preview
54+
- Created specifically for this portfolio with OpenAI image generation on 10 July 2026
55+
- External source asset: none
56+
- Terms: <https://openai.com/policies/terms-of-use/>
57+
58+
### Design references
59+
60+
The following OpenAI-generated images are retained as documentation-only visual specifications and are not loaded by the website:
61+
62+
- `docs/design/concept-desktop.png`
63+
- `docs/design/concept-panel.png`
64+
- `docs/design/concept-mobile.png`
65+
66+
They guided composition, palette, typography, HUD density, panel anatomy, and responsive controls. The runtime recreates the direction through HTML, CSS, geometry, particles, and shaders rather than embedding the concepts.
67+
68+
## External media inventory
69+
70+
- External 3D models: none
71+
- External textures/environment maps: none
72+
- External sound/music files: none
73+
- External project screenshots: none
74+
- Stock imagery: none
75+
76+
Add future assets here before shipping them, including creator, direct source, exact license, attribution, modifications, and redistribution terms.

‎CNAME‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎IMPLEMENTATION_PLAN.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Implementation Plan and Status
2+
3+
- [x] Audit the live homepage, posts page, metadata, links, deployment, and upstream repository.
4+
- [x] Extract verified biography, teams, projects, achievements, writing state, and contact links.
5+
- [x] Generate desktop, content-panel, mobile, and social-preview visual direction.
6+
- [x] Introduce Vite, strict TypeScript, modular vanilla Three.js, linting, and tests.
7+
- [x] Build the procedural solar system, ship, flight, camera, boost, braking, reset, collision safety, and autopilot.
8+
- [x] Add proximity targeting, project moons, achievement beacons, map, radar, projected markers, and direct navigation.
9+
- [x] Add readable modal content, browser history, mobile controls, procedural audio, and graphics presets.
10+
- [x] Add semantic build-time HTML, posts route, JSON-LD, canonicals, social metadata, sitemap, robots, manifest, and 2D fallback.
11+
- [x] Add GitHub Pages deployment for `portfolio.mycosmic.dev`, README, architecture, and asset credits.
12+
- [x] Pass TypeScript, ESLint, unit tests, and production build.
13+
- [x] Browser-test launch, menu, project switching, direct URLs, map/autopilot, settings, fallback, posts, and 390×844 responsive layout.
14+
15+
Optional future enhancements are limited to real content additions, verified project preview images, and real published posts. No placeholder project, achievement, or article should be promoted as portfolio content.

‎README.md‎

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,125 @@
1-
# Personal Site
1+
# Cosmic Crusader — Solar Portfolio
22

3-
A small, static personal website. Architects Daughter font, warm neutrals, soft card-based layout.
3+
An interactive, explorable 3D portfolio for Cosmic Crusader. Visitors can pilot a procedural scout ship through a miniature solar system or use the conventional menu and complete 2D fallback.
44

5+
Production domain: `https://portfolio.mycosmic.dev/`
56

7+
## Stack
8+
9+
- Vite multi-page static build
10+
- Strict TypeScript
11+
- Modular vanilla Three.js
12+
- Three.js native postprocessing (`EffectComposer`, restrained bloom, vignette)
13+
- Semantic HTML/CSS overlays for HUD, dialogs, mobile controls, and fallback content
14+
- Vitest and ESLint
15+
- GitHub Pages deployment through GitHub Actions
16+
17+
No server, database, VPS, runtime scraping, external 3D model, texture pack, or audio file is required.
18+
19+
## Local development
20+
21+
Requirements: Node.js 22 or newer and npm.
22+
23+
```bash
24+
npm ci
25+
npm run dev
26+
```
27+
28+
The development server uses `http://127.0.0.1:4173/`.
29+
30+
Useful commands:
31+
32+
```bash
33+
npm run check # TypeScript + ESLint
34+
npm test # Unit tests
35+
npm run build # Production build in dist/
36+
npm run preview # Preview dist/ on 127.0.0.1:4174
37+
```
38+
39+
## Controls
40+
41+
Desktop:
42+
43+
- `W` / `S`: forward and reverse thrust
44+
- `A` / `D`: yaw
45+
- Mouse: steer while pointer lock is active
46+
- Arrow up/down: pitch without a mouse
47+
- `Q` / `E`: roll; near an inspectable object, `E` inspects instead
48+
- `Shift`: boost
49+
- `Space`: brake
50+
- `F`: chase/cockpit camera
51+
- `Enter` or nearby `E`: inspect
52+
- `M`: solar-system map
53+
- `R`: reset the ship
54+
- `Esc`: release pointer lock or close the active surface
55+
56+
Touch:
57+
58+
- Virtual joystick for thrust and yaw
59+
- Drag the scene to steer
60+
- Large Boost, Brake, Inspect, Camera, and Map controls
61+
- Guided mode is enabled by default on coarse-pointer devices
62+
63+
## Content
64+
65+
Verified portfolio content lives in [`src/data/portfolio.ts`](src/data/portfolio.ts). It contains the real biography, team links, three projects, two achievements, current writing state, contact links, and presentation-safe destination coordinates.
66+
67+
The project never scrapes the live site at runtime. Vite injects the structured data into the production HTML during the build so crawlers, no-JavaScript visitors, and the 2D fallback receive the important text directly.
68+
69+
To add a future post:
70+
71+
1. Add a real static post route.
72+
2. Add its verified title, date, description, and URL to `portfolio.posts`.
73+
3. Run `npm run check`, `npm test`, and `npm run build`.
74+
75+
The posts list and writing panel update from that data automatically.
76+
77+
## Architecture
78+
79+
- `src/core/`: app orchestration, settings, shared types
80+
- `src/scene/`: renderer, procedural world, stars, ship
81+
- `src/shaders/`: solar/atmosphere and postprocessing shaders
82+
- `src/systems/`: input, flight, proximity, quality, pure math
83+
- `src/ui/`: HUD, radar markers, dialogs, menu/map/settings, touch controls
84+
- `src/audio/`: muted-by-default procedural Web Audio
85+
- `src/styles/`: game UI, fallback, and posts styling
86+
- `src/tests/`: content, quality, and proximity tests
87+
- `public/`: custom domain, robots policy, sitemap, manifest, social image
88+
89+
See [`ARCHITECTURE.md`](ARCHITECTURE.md) for system boundaries and frame order.
90+
91+
## Accessibility and fallback
92+
93+
- Semantic portfolio content is present in built HTML.
94+
- All important sections have direct links and menu access.
95+
- Native modal dialogs trap focus; focus returns when they close.
96+
- Visible keyboard focus, high-contrast mode, reduced motion, reduced camera movement, and postprocessing disable controls are available.
97+
- WebGL failure, slow initialization, or a visitor preference can switch to the complete 2D portfolio.
98+
- The posts page remains an independently usable normal web page.
99+
100+
## Performance
101+
102+
Low, Medium, High, and Auto presets control pixel ratio, particle counts, asteroid instances, and postprocessing. Auto considers viewport size, pointer type, device pixel ratio, CPU concurrency, and sampled frame rate. Animation work pauses while the tab is hidden, repeating objects are buffered/instanced, and the Three.js application is lazy-loaded after the HTML/CSS shell.
103+
104+
## GitHub Pages deployment — no VPS required
105+
106+
The workflow in `.github/workflows/deploy.yml` checks, tests, builds, and deploys `dist/` to GitHub Pages.
107+
108+
Repository setup:
109+
110+
1. Push this project to `CosmicCrusader23/cosmic`.
111+
2. In GitHub: **Settings → Pages → Build and deployment → Source → GitHub Actions**.
112+
3. Set the custom domain in GitHub Pages to `portfolio.mycosmic.dev`.
113+
4. In Cloudflare create:
114+
- Type: `CNAME`
115+
- Name: `portfolio`
116+
- Target: `CosmicCrusader23.github.io`
117+
- Proxy status: **DNS only** initially
118+
- TTL: `Auto`
119+
5. Wait for GitHub to provision the certificate, then enable **Enforce HTTPS**.
120+
121+
The built artifact includes `public/CNAME`, which contains `portfolio.mycosmic.dev`. The DNS target must not include the repository name.
122+
123+
## Assets
124+
125+
Runtime 3D art and audio are procedural and source-authored. All external software/font sources and the generated social preview are documented in [`ASSET_CREDITS.md`](ASSET_CREDITS.md).

0 commit comments

Comments
 (0)