|
1 | | -# Personal Site |
| 1 | +# Cosmic Crusader — Solar Portfolio |
2 | 2 |
|
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. |
4 | 4 |
|
| 5 | +Production domain: `https://portfolio.mycosmic.dev/` |
5 | 6 |
|
| 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