alles fertig
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
|
||||
Default to using Bun instead of Node.js.
|
||||
|
||||
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
|
||||
- Use `bun test` instead of `jest` or `vitest`
|
||||
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
|
||||
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
|
||||
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
|
||||
- Bun automatically loads .env, so don't use dotenv.
|
||||
|
||||
## APIs
|
||||
|
||||
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
|
||||
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
|
||||
- `memjs` for Memcached. Memcached has no built-in Bun client.
|
||||
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
|
||||
- `WebSocket` is built-in. Don't use `ws`.
|
||||
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
|
||||
- Bun.$`ls` instead of execa.
|
||||
|
||||
## Datenmodell (Memcached)
|
||||
|
||||
Memcached kennt keine Hashes oder Sets, nur reine Key-Value-Paare. Jedes Objekt
|
||||
wird deshalb unter einem flachen Key als JSON-String abgelegt. Listen (z.B. die
|
||||
Items einer Region) landen als JSON-Array im Value unter einem eigenen Key.
|
||||
|
||||
- `player:{id}` -> JSON Objekt
|
||||
- `player:{id}:weapon` / `:armor` / `:talisman` -> JSON Array mit item_ids
|
||||
- `item:{id}`, `enemy:{id}`, `region:{id}` -> JSON Objekt
|
||||
- `region:{id}:items` / `:enemies`, `enemy:{id}:items` -> JSON Array mit ids
|
||||
- `weapon:{id}`, `armor:{id}`, `shield:{id}`, `talisman:{id}`, `item_effect:{id}`, `item_type:{id}` -> JSON Objekt
|
||||
|
||||
## Coding Style Preferences
|
||||
|
||||
- Write everything WITHOUT comments.
|
||||
@@ -1,8 +0,0 @@
|
||||
# Projekt-Dokumentation: Entwicklungsreihenfolge
|
||||
|
||||
1. Projekt init (gleicher Aufbau wie client-redit)
|
||||
2. Docker compose mit memcached
|
||||
3. Einfache verbindung (memjs)
|
||||
4. Memcached getestet (mit set und get)
|
||||
5. Init-Skript (db/init.ts) mit ~100 statischen Entitäten erstellt (gleiche Daten wie Redis, aber als flache JSON-Values)
|
||||
6. Client (index.ts) aktualisiert Player-Daten live und liest statische Gegner-Daten
|
||||
@@ -40,12 +40,12 @@ async function readSingle(_i: number) {
|
||||
}
|
||||
|
||||
async function readRegion(_i: number) {
|
||||
const region = await getJson("region:1");
|
||||
const region = await getJson("bench:region:1");
|
||||
void region?.name;
|
||||
const enemyIds = (await getJson("region:1:enemies")) || [];
|
||||
const itemIds = (await getJson("region:1:items")) || [];
|
||||
for (const id of enemyIds) await getJson(`enemy:${id}`);
|
||||
for (const id of itemIds) await getJson(`item:${id}`);
|
||||
const enemyIds = (await getJson("bench:region:1:enemies")) || [];
|
||||
const itemIds = (await getJson("bench:region:1:items")) || [];
|
||||
for (const id of enemyIds) await getJson(`bench:enemy:${id}`);
|
||||
for (const id of itemIds) await getJson(`bench:item:${id}`);
|
||||
}
|
||||
|
||||
async function writeRegion(_i: number) {
|
||||
|
||||
Reference in New Issue
Block a user