1
0
Fork 0
Go to file
Pabloader b866e0a5de RPG engine improvements: caching, cloning, versioning, query overloads
- Condition parse cache: each unique string parsed once (Map<string, ParsedCondition>)
- executeAction: throw on missing type/malformed action/missing action; warn-only on
  destroyed entity (legitimate mid-flight case)
- World.query() overloads for 2 and 3 component types: query(A, B) → [Entity, A, B]
- World.once()/off() consistency: #onceWrappers map lets off(event, original) correctly
  remove handlers registered via once()
- World.cloneEntity(source, newId?): deep-clones all components via structuredClone,
  onAdd() fires normally on the new entity
- isEntityContext() type guard alongside isEvalContext()
- Inventory.getVariables() cache: invalidated on add()/remove()
- QuestLog.getVariables() cache: invalidated on any status transition or _advance()
- QuestLog.entries() explicit Generator return type
- Variables JSDoc: clarifies when to use Variables vs typed Component<TState>
- @component({ name?, version? }) object overload in registry
- registerMigration(name, from, to, fn): chained migrations run automatically on
  deserialize when saved version < current version
- Serialization wire format: ComponentData carries version, WorldData carries
  schemaVersion; mismatched schemaVersion throws a descriptive error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 09:28:05 +00:00
backend Integrate backend into storywriter 2026-04-16 15:36:29 +00:00
build Decorators and components 2026-04-28 11:58:25 +00:00
src RPG engine improvements: caching, cloning, versioning, query overloads 2026-04-29 09:28:05 +00:00
test/common Image model selection 2026-04-14 16:14:54 +00:00
.clang-format Image data c api 2025-05-19 14:48:03 +00:00
.clangd Migrate to WASI 2025-06-10 07:42:00 +00:00
.gitignore Remove asmscript from build 2025-05-08 23:40:53 +03:00
AGENTS.md Chat interface 2026-03-19 20:44:49 +00:00
README.md New storywriter started 2026-03-19 14:22:46 +00:00
bun.lock ui kit 2026-04-10 08:43:14 +00:00
compile_flags.txt Compile flags 2025-06-25 13:39:22 +00:00
package.json Integrate backend into storywriter 2026-04-16 15:36:29 +00:00
tsconfig.json Decorators and components 2026-04-28 11:58:25 +00:00

README.md

TS-Games

Custom framework/build system for simple single-file TypeScript games.

Installing dependencies

bun install

Make a game

  • Create your game folder in src/games
  • Create src/games/<yourgame>/index.ts with default exported function.

Running:

bun start

Navigate to http://localhost:3000 to see the list of your games. Game rebuilds on each reload.

Building

bun run build <project>

Will create <project>.html in dist folder.

Or to select project from list:

bun run build

Features

  • Bun ♥

  • TypeScript

  • Building into single .html file without any dependencies, all assets are inlined as data-urls.

    • src/games/<yourgame>/assets/favicon.ico is used as page icon if present.
  • TSX supported with Preact, because it's lightweight.

  • Import images as HTMLImageElement

    • PNG & JPG
      import spritesheet from './assets/spritesheet.png';
      console.log(spritesheet); // <img src="data:..." />
      
  • Import audio as HTMLAudioElement

    • WAV, MP3 & OGG
      import heal from './assets/heal.ogg';
      console.log(heal); // <audio src="data:..." />
      heal.play()
      
  • Import CSS

    • Regular CSS

      import "./assets/styles.css";
      
    • CSS modules is supported

      import styles from './assets/styles.module.css';
      console.log(styles.awoo); // G7sddg_awoo
      
      export default <div className={styles.root}></div>;
      
    • Modern CSS features are transpiled

      • Nested CSS
        .root {
            display: flex;
            .row {
                display: flex;
                flex-direction: row;
            }
        }
        
      • Vendor prefixed if needed
    • Import fonts (see example in src/common/assets/vga.font.css)

      import "./assets/lcd.font.css";
      

Publishing

  • Make sure you have scp installed (it most certainly is)

  • Make .env file

    PUBLISH_LOCATION=ssh.example.com:/var/www/games/
    PUBLISH_URL=https://example.com/
    
  • Run build & publish

    bun run build <project>
    

    Or to select project from list:

    bun run build