# 4tkbytes/dropbear architecture

> Architecture diagram of the GitHub repository 4tkbytes/dropbear, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/4tkbytes/dropbear
- Repository: https://github.com/4tkbytes/dropbear

## Overview

##### Project type and purpose
- This is a Rust-based game engine workspace (“dropbear”) that consists of three main crates:
- dropbear-engine – the core game engine library
- eucalyptus – a visual editor for authoring games, inspired by Unity/Roblox Studio
- redback-runtime – a lightweight runtime for loading and executing packaged games (.eupak files)
- The overall purpose is to let developers design scenes visually (eucalyptus), write game logic in TypeScript (via Deno), compile and package the game assets and scripts into a bundle, and then deploy/run the game using redback-runtime.

##### File structure
Top-level
- Cargo.toml – workspace manifest referencing the three crates
- .github/workflows – CI pipelines (build, docs)
- resources/ & scripts/ – shared assets and helper scripts
- ts/ – documentation source for TypeScript API
dropbear-engine/
- src/ – Rust modules for attenuation, camera, rendering (egui), lighting, input, scene graph, etc.
eucalyptus/
- src/main.rs – entry point for the editor application
- src/editor/ – UI components, docks, scene view, input handling
- src/scripting/ – TypeScript integration modules (entity, input, math)
- build.rs / dropbear.ts / template.ts – asset pipeline & packaging scripts
redback-runtime/
- (Likely a binary crate for loading .eupak and invoking dropbear-engine at runtime)

##### README for additional insights
- dropbear-engine is not yet a standalone framework but is consumed primarily by eucalyptus.
- Eucalyptus uses Deno to run TypeScript scripts to ensure type safety.
- The packaging format is “.eupak” (handled by eucalyptus’s build.rs) and consumed by redback-runtime.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Workspace Manifest
    Workspace["Cargo.toml"]:::external
    click Workspace "https://github.com/4tkbytes/dropbear/blob/main/Cargo.toml"

    %% User
    User["Game Developer"]:::external

    %% Authoring Side
    subgraph "Authoring Side"
        direction TB
        Eucalyptus["Eucalyptus Editor"]:::crate
        click Eucalyptus "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/src/main.rs"
        subgraph "Editor Modules"
            direction TB
            EditorModules["eucalyptus/src/editor"]:::crate
        end
        click EditorModules "https://github.com/4tkbytes/dropbear/tree/main/eucalyptus/src/editor"
        subgraph "Auxiliary UI & State"
            direction TB
            AuxUI["eucalyptus/src (camera, debug, logging, menu, states, utils)"]:::crate
        end
        click AuxUI "https://github.com/4tkbytes/dropbear/tree/main/eucalyptus/src"
        subgraph "Scripting Integration (Deno)"
            direction TB
            ScriptingCore["eucalyptus/src/scripting"]:::scripting
            click ScriptingCore "https://github.com/4tkbytes/dropbear/tree/main/eucalyptus/src/scripting"
            TemplateTS["template.ts"]:::assets
            click TemplateTS "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/src/template.ts"
            DropbearTS["dropbear.ts"]:::assets
            click DropbearTS "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/src/dropbear.ts"
        end
        subgraph "Asset Pipeline & Packager (.eupak)"
            direction TB
            BuildRS["build.rs"]:::assets
            click BuildRS "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/build.rs"
            BuildModules["eucalyptus/src/build"]:::assets
            click BuildModules "https://github.com/4tkbytes/dropbear/tree/main/eucalyptus/src/build"
            ShaderWGSL["shader.wgsl"]:::assets
            click ShaderWGSL "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/src/shader.wgsl"
            LightWGSL["light.wgsl"]:::assets
            click LightWGSL "https://github.com/4tkbytes/dropbear/blob/main/eucalyptus/src/light.wgsl"
        end
    end

    %% Engine Core
    subgraph "dropbear-engine Core Library"
        direction TB
        EngineCore["dropbear-engine/src/lib.rs"]:::crate
        click EngineCore "https://github.com/4tkbytes/dropbear/blob/main/dropbear-engine/src/lib.rs"
        Modules["attenuation, camera, egui_renderer, entity, graphics, input, lighting, model, resources, scene, utils, panic, buffer"]:::crate
        click Modules "https://github.com/4tkbytes/dropbear/tree/main/dropbear-engine/src"
    end

    %% Runtime Side
    subgraph "Runtime Side"
        direction TB
        Redback["redback-runtime Player"]:::crate
        click Redback "https://github.com/4tkbytes/dropbear/tree/main/redback-runtime"
    end

    %% Shared Resources & Scripts
    subgraph "Shared Assets & Scripts"
        direction TB
        Resources["resources/ (models, glTF)"]:::assets
        click Resources "https://github.com/4tkbytes/dropbear/tree/main/resources"
        Scripts["scripts/ (gen_docs.bat, gen_docs.sh)"]:::assets
        click Scripts "https://github.com/4tkbytes/dropbear/tree/main/scripts"
        TSDocs["ts/ (API docs source)"]:::assets
        click TSDocs "https://github.com/4tkbytes/dropbear/tree/main/ts"
    end

    %% CI/CD
    subgraph "CI/CD"
        direction TB
        CI1["create_executable.yaml"]:::external
        click CI1 "https://github.com/4tkbytes/dropbear/blob/main/.github/workflows/create_executable.yaml"
        CI2["docs.yaml"]:::external
        click CI2 "https://github.com/4tkbytes/dropbear/blob/main/.github/workflows/docs.yaml"
    end

    %% Connections
    User -->|Uses| Eucalyptus
    Eucalyptus -->|Calls API| EngineCore
    EngineCore -->|Modules| Modules

    Eucalyptus -->|Invokes| ScriptingCore
    ScriptingCore -->|Hooks into| Modules

    Eucalyptus -->|Packages assets| BuildRS
    BuildRS --> BuildModules
    BuildModules -->|Includes shaders| ShaderWGSL
    BuildModules --> LightWGSL
    BuildRS -->|Outputs| Packfile[".eupak"]:::assets

    Packfile -->|Loaded by| Redback
    Redback -->|Initializes| EngineCore

    Resources --> Eucalyptus
    Resources --> Redback

    Scripts -->|Docs generation| TSDocs

    CI1 --> Workspace
    CI2 --> Workspace

    %% Styles
    classDef crate fill:#AED6F1,stroke:#2980B9,color:#000
    classDef scripting fill:#A9DFBF,stroke:#27AE60,color:#000
    classDef assets fill:#F5CBA7,stroke:#D35400,color:#000
    classDef external fill:#E5E7E9,stroke:#7B7D7D,color:#000
```
