Skip to content

tauseefk/flashes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flashes

A "multiplayer" roguelike built with Rust/WASM core and TypeScript. It uses Y.rs crdt for storing the game state, which enables the multiplayer functionality over WebRTC.

Flashes.Demo.mp4

Prerequisites

  • Node.js
  • Rust toolchain
  • wasm-pack

Running in dev mode

  1. Compile the engine:
cd flashlighte.rs
./build.sh
  1. Build the game:
cd www
npm install
npm run dev

Directory Structure

flashes/
├─ flashlighte.rs/             // Rust workspace
│   ├─ build.sh                // compiles engine to WASM
│   ├─ batteries/              // core utilities and data structures crate
│   ├─ flashlight/             // game "engine"
│   └─ pathfinder/             // pathfinding crate
└─ www/                        // frontend
    ├─ src/                    // client side code
    └─ flashes-server/         // WebSocket signaling server

Architecture

// 1. signaling server relays peer details
// 2. peers establish WebRTC connection
// 3. peers close the server connection

┌─────────────────┐       ┌─────────────────┐
│  Client 1       │       │  Client 2       │
│                 │ ◀═══▶ │                 │
│                 │       │                 │
└─────────────────┘       └─────────────────┘
        │                         │
        ▼                         ▼
┌───────────────────────────────────────────┐
│                                           │
│             Signaling Server              │
│                                           │
└───────────────────────────────────────────┘


┌────────────────────────────────────────────────────────────────┐
│                       Client Architecture                      │
├────────────────────────────────────────────────────────────────┤
│  TypeScript Frontend (www/src/)                                │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐ │
│  │  Reactive       │  │  Render         │  │  State          │ │
│  │  Event Streams  │  │  Engine         │  │  Management     │ │
│  │  (rextream)     │  │                 │  │                 │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘ │
├────────────────────────────────────────────────────────────────┤
│  WASM Interface (www/src/globalAPI.ts)                         │
├────────────────────────────────────────────────────────────────┤
│  Rust Engine (/flashlighte.rs)                                 │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐ │
│  │  Flashlight     │  │  Pathfinder     │  │  Batteries      │ │
│  │  (Game Engine)  │  │                 │  │  (Utilities)    │ │
│  │  - CRDT         │  │                 │  │                 │ │
│  │  - shadowcast   │  │                 │  │                 │ │
│  │  - transforms   │  │                 │  │                 │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘ │
└────────────────────────────────────────────────────────────────┘

About

A "multiplayer" roguelike built with Rust/WASM core and TypeScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published