Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
coverage/
dist/
# ascendants/ is a self-contained subproject with its own ESLint config,
# TypeScript settings and Prettier rules. Linting it with the React Native
# config at this repo's root reports formatting conflicts that mean nothing.
ascendants/
6 changes: 6 additions & 0 deletions ascendants/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# WebSocket relay the client connects to for online play.
# The relay only forwards inputs between two peers; it never simulates a match.
VITE_RELAY_URL=ws://localhost:8787

# Port the relay binds to (server/index.ts).
PORT=8787
46 changes: 46 additions & 0 deletions ascendants/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Lint rules.
*
* The layering rule is the one that matters most: the engine must never import
* from the renderer, the UI or the network. That boundary is what keeps the
* simulation deterministic and portable, and a lint rule enforces it far more
* reliably than a convention nobody remembers at 2am.
*/
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: { ecmaVersion: 2022, sourceType: 'module' },
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
env: { browser: true, es2022: true, node: true },
ignorePatterns: ['dist', 'node_modules', '*.cjs'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-console': ['error', { allow: ['warn', 'error'] }],
eqeqeq: ['error', 'always'],
'prefer-const': 'error',
},
overrides: [
{
files: ['src/engine/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['**/render/**', '**/ui/**', '**/net/**', '**/client/**', 'three'],
message:
'The engine must stay free of presentation and transport. Dependencies flow one way.',
},
],
},
],
// Math.random and Date.now would both break rollback determinism.
'no-restricted-globals': ['error', { name: 'Date', message: 'The simulation must not read a clock.' }],
},
},
],
};
25 changes: 25 additions & 0 deletions ascendants/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches: ['**']
pull_request:

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
- run: npm ci
- name: Typecheck
run: npm run type-check
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
8 changes: 8 additions & 0 deletions ascendants/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.env
.env.local
*.log
.DS_Store
coverage/
.vite/
117 changes: 117 additions & 0 deletions ascendants/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# CLAUDE.md — ASCENDANTS

Repo-specific operating rules. Read `README.md` first for what the game is.

---

## The one rule that breaks everything if you get it wrong

**`step()` must stay pure and deterministic.**

`src/engine/sim/step.ts` takes `(state, inputs, config)` and returns a new
state. Rollback re-runs past frames on both peers and compares checksums. If a
single operation is non-deterministic, matches desync and the failure is
silent — two players quietly playing different games.

Inside `src/engine/**` you may **never**:

- call `Math.sin`, `Math.cos`, `Math.tan`, `Math.atan`, `Math.atan2`
(use `engine/math/trig.ts` — they are implementation-defined and drift)
- call `Math.random` (use `engine/math/rng.ts`, whose state lives in `MatchState`)
- read a clock (`Date.now`, `performance.now`)
- import from `render`, `ui`, `net`, `client`, or `three`
- store `undefined` in state that gets snapshotted
- mutate a `Vec3` component in place — always assign a whole new vector
(snapshots share vector references precisely because they are immutable)

`Math.sqrt`, `Math.abs`, `Math.round`, `Math.floor`, `Math.min/max` and
`Math.imul` are all exactly specified and safe.

The lint config enforces the import boundary. It cannot catch the rest — you
have to.

After any engine change, run `npm test`. `sim/step.test.ts` and
`net/rollback.test.ts` are the guards; if either fails, determinism is broken
and nothing else matters until it is fixed.

---

## Layering

```
engine → (nothing)
net → engine
render → engine
ui → engine, render
client → everything
server → net/protocol only
```

Dependencies flow one way. No upward imports, ever.

Appearance lives in `render/design/`, not in the engine. A character's colours
must never be able to influence a hitbox.

---

## Where things live

| You want to change | Go to |
|---|---|
| Frame data, hitboxes, move properties | `engine/data/universal.ts`, `engine/data/specials/<name>.ts` |
| Character stats and pronouns | `engine/data/characters.ts` |
| Physics, meters, round timings | `engine/data/constants.ts` |
| Finisher names, the announcer callout | `engine/data/finishers.ts` |
| How a fighter looks | `render/design/index.ts` |
| How a fighter animates | `render/pose.ts` |
| Hit priority (invuln → armor → parry → block → counter) | `engine/combat/resolve.ts` |
| Netcode | `net/rollback.ts` |

Prefer data over logic. Most balance changes should be a number in a table, not
a branch in a function.

---

## Adding a character

1. Add stats, lore and `pronoun` to `engine/data/characters.ts`.
2. Add `engine/data/specials/<id>.ts` with three specials and one super, and
register it in `engine/data/moves.ts`.
3. Add an Erasure to `engine/data/finishers.ts`.
4. Add a `FighterDesign` to `render/design/index.ts`.

Move ownership is derived from the id prefix (`sei.updraft` belongs to `sei`,
`u.*` to everyone), so there is no second list to keep in sync.

New designs must pass the silhouette test: blacked out at thumbnail size, the
fighter should still be identifiable. Check the shoulder width and height
against the existing six before picking colours.

---

## Conventions

- TypeScript strict, including `noUncheckedIndexedAccess` and
`exactOptionalPropertyTypes`. No `any`.
- One file, one job. Past ~200 lines, ask whether it should be split.
- Comments explain **why**, never what. If a line needs a comment to say what it
does, rename something instead.
- Tests co-located as `Module.test.ts`.
- Frame counts, not seconds, anywhere near gameplay. A fighting game's feel
lives in exact frame advantage.

## Before committing

```bash
npm run type-check && npm run lint && npm test && npm run build
```

All four must pass.

## Commit format

```
feat(engine): add beam clash contest
fix(net): correct rollback depth accounting
chore(render): tune impact flash scale
```
21 changes: 21 additions & 0 deletions ascendants/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Cloudygetty

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading