Skip to content

Instantly share code, notes, and snippets.

@danielsreichenbach
Created August 8, 2025 14:19
Show Gist options
  • Select an option

  • Save danielsreichenbach/a635745cb459ef1da556caf3689dcb99 to your computer and use it in GitHub Desktop.

Select an option

Save danielsreichenbach/a635745cb459ef1da556caf3689dcb99 to your computer and use it in GitHub Desktop.
NGDP implementation status

NGDP (Next Generation Distribution Pipeline)

NGDP is Blizzard's comprehensive content distribution system that powers all modern Blizzard games (World of Warcraft, Overwatch, Diablo, etc.). It consists of multiple integrated components working together to deliver game content efficiently and securely from Blizzard's servers to millions of clients worldwide.

System Overview

graph TB
    subgraph "๐Ÿข Blizzard Infrastructure"
        DEV[Game Developers]
        BUILD[Build System]
        CDN[Global CDN Network]
        RIBBIT[Ribbit API Servers]
    end
    
    subgraph "๐ŸŒ Distribution Layer"
        TACT[TACT Protocol]
        BLTE[BLTE Compression]
        CRYPTO[Encryption Layer]
    end
    
    subgraph "๐Ÿ’ป Client Side"
        BNET[Battle.net Client]
        CASC[Local CASC Storage]
        GAME[Game Client]
    end
    
    DEV --> BUILD
    BUILD --> CDN
    BUILD --> RIBBIT
    
    BNET --> RIBBIT
    RIBBIT --> TACT
    TACT --> BLTE
    BLTE --> CRYPTO
    CRYPTO --> CASC
    CASC --> GAME
    
    CDN --> TACT
Loading

NGDP uses two main protocols:

  • TACT (Transfer And Content Transport) - For downloading content from CDN
  • CASC (Content Addressable Storage Container) - For local storage and organization

Complete NGDP Flow

sequenceDiagram
    participant Dev as ๐Ÿง‘โ€๐Ÿ’ป Game Developers
    participant Build as ๐Ÿ—๏ธ Build System
    participant CDN as ๐ŸŒ CDN Network
    participant Ribbit as ๐Ÿ“ก Ribbit API
    participant Client as ๐Ÿ’ป Battle.net Client
    participant Game as ๐ŸŽฎ Game Client
    
    Dev->>Build: Submit game content
    Build->>Build: Create build artifacts
    Build->>CDN: Upload BLTE-compressed files
    Build->>Ribbit: Publish build metadata
    
    Note over Client: User clicks "Play"
    Client->>Ribbit: Query product versions
    Ribbit->>Client: Return build info + CDN endpoints
    
    Client->>CDN: Download build configuration
    Client->>CDN: Download manifests (root, encoding, install)
    Client->>CDN: Download game files by priority
    
    Client->>Client: Decompress BLTE data
    Client->>Client: Decrypt encrypted files
    Client->>Client: Store in local CASC
    
    Game->>Client: Request game file
    Client->>Game: Serve from CASC storage
Loading

Server-Side: Content Creation & Distribution

1. Content Development & Build Process

flowchart TD
    subgraph "๐Ÿข Blizzard Development"
        A[Game Assets Created] --> B[Asset Processing]
        B --> C[Build Compilation]
        C --> D[BLTE Compression]
        D --> E[Content Addressing]
        E --> F[Manifest Generation]
    end
    
    subgraph "๐Ÿ“‹ Generated Manifests"
        F --> G[Root Manifest<br/>FileDataID โ†’ CKey]
        F --> H[Encoding Manifest<br/>CKey โ†’ EKey + Size]
        F --> I[Install Manifest<br/>Platform + Tags]
        F --> J[Download Manifest<br/>Priority Order]
        F --> K[Size Manifest<br/>Install Sizes]
    end
    
    subgraph "๐ŸŒ Distribution"
        G --> L[Upload to CDN]
        H --> L
        I --> L
        J --> L
        K --> L
        L --> M[Ribbit API Update]
    end
Loading

2. Ribbit API (Product Discovery)

graph LR
    subgraph "๐Ÿ“ก Ribbit Servers"
        A[us.version.battle.net:1119]
        B[eu.version.battle.net:1119]
        C[kr.version.battle.net:1119]
    end
    
    subgraph "๐Ÿ“Š Product Information"
        D[Product List]
        E[Version History]
        F[Build Configurations]
        G[CDN Endpoints]
    end
    
    A --> D
    B --> D
    C --> D
    D --> E
    E --> F
    F --> G
    
    style A fill:#e1f5fe
    style B fill:#e1f5fe
    style C fill:#e1f5fe
Loading

Status: โœ… Complete (ribbit-client)

3. CDN Infrastructure

graph TB
    subgraph CDN ["๐ŸŒ Global CDN Network"]
        subgraph US ["๐Ÿ‡บ๐Ÿ‡ธ US CDN"]
            US1[us.cdn.blizzard.com]
            US2[level3.blizzard.com]
        end
        
        subgraph EU ["๐Ÿ‡ช๐Ÿ‡บ EU CDN"]
            EU1[eu.cdn.blizzard.com]
            EU2[eu.actual.battle.net]
        end
        
        subgraph ASIA ["๐Ÿ‡ฐ๐Ÿ‡ท Asia CDN"]
            KR1[kr.cdn.blizzard.com]
            KR2[blzddist1-a.akamaihd.net]
        end
    end
    
    subgraph FILES ["๐Ÿ“ CDN File Structure"]
        CONFIG["/config/[hash]<br/>Build Configs"]
        DATA["/data/[hash]<br/>Game Files"]
        PATCH["/patch/[hash]<br/>Patches"]
    end
    
    US1 --> CONFIG
    EU1 --> CONFIG
    KR1 --> CONFIG
    
    US1 --> DATA
    EU1 --> DATA
    KR1 --> DATA
    
    US1 --> PATCH
    EU1 --> PATCH
    KR1 --> PATCH
Loading

Status: โœ… Complete (tact-client, ngdp-cdn)

Client-Side: Download & Storage Process

4. Battle.net Client Flow

sequenceDiagram
    participant User as ๐Ÿ‘ค User
    participant BNet as ๐Ÿ’ป Battle.net
    participant Ribbit as ๐Ÿ“ก Ribbit API
    participant CDN as ๐ŸŒ CDN
    participant CASC as ๐Ÿ’พ Local CASC
    
    User->>BNet: Click "Play Game"
    BNet->>Ribbit: Get product versions
    Ribbit->>BNet: Build info + CDN list
    
    BNet->>CDN: Download BuildConfig
    CDN->>BNet: BuildConfig (BLTE compressed)
    
    BNet->>BNet: Parse BuildConfig
    Note over BNet: Get manifest hashes
    
    BNet->>CDN: Download Root Manifest
    BNet->>CDN: Download Encoding Manifest
    BNet->>CDN: Download Install Manifest
    
    BNet->>BNet: Parse manifests
    Note over BNet: Determine files to download
    
    loop For each required file
        BNet->>CDN: Download file by EKey
        CDN->>BNet: BLTE compressed data
        BNet->>BNet: Decompress & decrypt
        BNet->>CASC: Store in local archive
    end
    
    User->>BNet: Launch game
    BNet->>CASC: Verify installation
    CASC->>BNet: Ready
Loading

5. TACT Protocol (File Download)

flowchart TD
    subgraph "๐Ÿ” File Resolution"
        A[FileDataID] --> B[Root Manifest Lookup]
        B --> C[Content Key CKey]
        C --> D[Encoding Manifest Lookup]
        D --> E[Encoding Key EKey]
    end
    
    subgraph "โฌ‡๏ธ Download Process"
        E --> F[CDN Request by EKey]
        F --> G[BLTE Compressed Data]
        G --> H[BLTE Decompression]
        H --> I[Decryption if needed]
        I --> J[Original File Content]
    end
    
    subgraph "๐Ÿ’พ Storage"
        J --> K[CASC Archive Storage]
        K --> L[Index Update]
    end
Loading

Status: โœ… Complete (tact-client, tact-parser)

6. BLTE Compression System

graph TD
    subgraph "๐Ÿ“ฆ BLTE Compression Modes"
        A[Original File] --> B{Size Check}
        B -->|Small| C[Mode 'N': No Compression]
        B -->|Medium| D[Mode 'Z': ZLib]
        B -->|Large| E[Mode '4': LZ4]
        B -->|Recursive| F[Mode 'F': Multi-chunk]
        B -->|Encrypted| G[Mode 'E': Salsa20/ARC4]
    end
    
    subgraph "๐Ÿ” Encryption Keys"
        H[19,419 WoW Keys]
        I[Salsa20 Cipher]
        J[ARC4 Cipher]
    end
    
    G --> H
    H --> I
    H --> J
    
    style C fill:#c8e6c9
    style D fill:#fff3e0
    style E fill:#e3f2fd
    style F fill:#f3e5f5
    style G fill:#ffebee
Loading

Status: โœ… Complete (blte with full compression/decompression + encryption)

7. CASC Local Storage

graph TB
    subgraph "๐Ÿ“ CASC Directory Structure"
        ROOT[Game Directory]
        ROOT --> DATA[Data/]
        DATA --> CONFIG[config/]
        DATA --> INDICES[indices/]
        DATA --> ARCHIVE[data.000, data.001, ...]
        
        CONFIG --> BUILD[.build.info]
        INDICES --> IDX[*.idx files]
    end
    
    subgraph "๐Ÿ—‚๏ธ File Organization"
        FILE[Game File Request] --> HASH[Jenkins Hash]
        HASH --> BUCKET[Bucket Selection]
        BUCKET --> IDX_LOOKUP[Index File Lookup]
        IDX_LOOKUP --> ARCHIVE_OFFSET[Archive + Offset]
        ARCHIVE_OFFSET --> BLTE_DATA[BLTE Compressed Data]
        BLTE_DATA --> DECOMPRESS[Decompress]
        DECOMPRESS --> GAME_FILE[Game File]
    end
    
    subgraph "๐Ÿ’ฟ Archive Properties"
        ARCHIVE --> LIMIT[Max 1GB per archive]
        ARCHIVE --> ADDR[Content-addressable]
        ARCHIVE --> DEDUP[Automatic deduplication]
    end
Loading

Status: โœ… Complete (casc-storage with full read/write support)

8. Game Client Integration

sequenceDiagram
    participant Game as ๐ŸŽฎ Game Client
    participant CASC as ๐Ÿ’พ CASC Storage
    participant BNet as ๐Ÿ’ป Battle.net
    participant CDN as ๐ŸŒ CDN
    
    Game->>CASC: Request file by FileDataID
    CASC->>CASC: Look up in local storage
    
    alt File exists locally
        CASC->>Game: Return file data
    else File missing
        CASC->>BNet: Request file download
        BNet->>CDN: Download missing file
        CDN->>BNet: BLTE compressed data
        BNet->>CASC: Store decompressed file
        CASC->>Game: Return file data
    end
    
    Note over Game: Streaming download<br/>Game can start before<br/>all files downloaded
Loading

Our Implementation: cascette-rs

Architecture Overview

graph TB
    subgraph "๐Ÿฆ€ cascette-rs Implementation"
        subgraph "๐Ÿ“ก Network Layer"
            RIBBIT[ribbit-client<br/>Product Discovery]
            TACT[tact-client<br/>HTTP Downloads]
            CDN[ngdp-cdn<br/>CDN Management]
        end
        
        subgraph "๐Ÿ“‹ Data Processing"
            BPSV[ngdp-bpsv<br/>BPSV Parser]
            PARSER[tact-parser<br/>Manifest Parser]
            BLTE[blte<br/>Compression Engine]
        end
        
        subgraph "๐Ÿ’พ Storage Layer"
            CASC[casc-storage<br/>Local Storage]
            CACHE[ngdp-cache<br/>Caching System]
        end
        
        subgraph "๐Ÿ–ฅ๏ธ User Interface"
            CLI[ngdp-client<br/>CLI Tool]
        end
        
        RIBBIT --> PARSER
        TACT --> BLTE
        CDN --> TACT
        PARSER --> CASC
        BLTE --> CASC
        BPSV --> PARSER
        CACHE --> RIBBIT
        CACHE --> TACT
        CLI --> RIBBIT
        CLI --> TACT
        CLI --> CASC
    end
Loading

Implementation Status

โœ… Fully Complete Components

Component Description Performance
ribbit-client Product discovery and version querying Real-time queries
tact-client HTTP downloads with connection pooling 2.23x faster than baseline
tact-parser All manifest formats (root, encoding, install, download, size, TVFS) Full format support
blte Complete compression/decompression + encryption 1,087 MB/s throughput
casc-storage Full local storage with read/write support 5.3x faster startup
ngdp-cache Intelligent caching system 20-30% memory reduction

๐Ÿ” Cryptography Support

pie title Encryption Key Coverage
    "WoW Keys" : 19419
    "Other Games" : 2500
Loading
  • 19,419 WoW encryption keys - Complete coverage
  • Salsa20 & ARC4 ciphers - Full decryption support
  • Perfect archive recreation - 256MB archives with round-trip validation
  • All BLTE modes - N (none), Z (zlib), 4 (LZ4), F (recursive), E (encrypted)

๐Ÿš€ Performance Optimizations

graph LR
    subgraph "โšก Performance Improvements"
        A[Baseline Performance] --> B[Parallel Loading<br/>5.3x faster startup]
        A --> C[Memory Pools<br/>20-30% less memory]
        A --> D[Connection Pooling<br/>2.23x faster downloads]
        A --> E[Lazy Loading<br/>Progressive file access]
        A --> F[Lock-free Caching<br/>Concurrent safe]
    end
Loading

๐ŸŸก Partially Complete

  • Patch System - Not yet implemented (ngdp-patch planned)
  • Pattern-based Extraction - Basic file filtering needs enhancement
  • Advanced CLI Features - Core functionality complete, convenience features pending

โœ… Real-World Validation

All components tested with actual Blizzard game data:

Test Scenario Status Details
Build Config Downloads โœ… Pass All products (WoW, Agent, BNA)
BLTE Decompression โœ… Pass All compression modes validated
CASC File Extraction โœ… Pass WoW 1.13.2 and 1.14.2 installations
Manifest Parsing โœ… Pass Root, Encoding, Install, Download, Size
Encryption Handling โœ… Pass 19,419 keys, Salsa20/ARC4

Usage Example

sequenceDiagram
    participant User as ๐Ÿ‘ค User
    participant CLI as ๐Ÿ–ฅ๏ธ ngdp CLI
    participant Ribbit as ๐Ÿ“ก ribbit-client
    participant CDN as ๐ŸŒ tact-client
    participant CASC as ๐Ÿ’พ casc-storage
    
    User->>CLI: ngdp products list
    CLI->>Ribbit: Query available products
    Ribbit->>CLI: Return product list
    CLI->>User: Display products
    
    User->>CLI: ngdp download build wow_classic_era latest
    CLI->>Ribbit: Get latest build info
    CLI->>CDN: Download manifests & files
    CDN->>CLI: BLTE compressed data
    CLI->>CASC: Store decompressed files
    CASC->>User: Installation complete
Loading

NGDP Implementation Status Matrix

๐Ÿข Server-Side Operations (Blizzard Infrastructure)

Capability Status Implementation Notes
Content Creation โ“ Unknown Blizzard internal - format unknown
Build System โ“ Unknown Blizzard internal - process unknown
BLTE Compression โœ… blte crate Can decompress all known modes
Manifest Generation โ“ Unknown Blizzard internal - algorithm unknown
CDN File Organization โ“ Unknown Upload process & requirements unknown
Ribbit API Backend โ“ Unknown Server implementation unknown

๐Ÿ“ก Product Discovery & Metadata (Client-Side)

Capability Status Implementation Performance
Multi-region Ribbit Queries โœ… ribbit-client Works with known endpoints
Product List Retrieval โœ… ribbit-client Parses known response format
Version History Access โœ… ribbit-client Reads available build list
Build Configuration Download โœ… tact-client Downloads from known CDN paths
CDN Endpoint Discovery โœ… ribbit-client Uses discovered endpoint list
Background Download Detection โœ… ribbit-client Detects BGDL flag in responses

๐ŸŒ Content Delivery Network (Client-Side Access)

Capability Status Implementation Features
Multi-CDN Support โœ… ngdp-cdn Can query multiple discovered CDNs
Connection Pooling โœ… tact-client HTTP client optimization
HTTP/2 Multiplexing โœ… tact-client When CDN supports it
Resumable Downloads โœ… tact-client Range request support
CDN Failover โœ… ngdp-cdn Tries alternative endpoints
Request Batching โœ… tact-client Client-side optimization

๐Ÿ“‹ Manifest Processing (Format Parsing)

Capability Status Implementation Coverage
Root Manifest Parsing โœ… tact-parser Known FileDataID โ†’ CKey format
Encoding Manifest Parsing โœ… tact-parser Known CKey โ†’ EKey mapping format
Install Manifest Parsing โœ… tact-parser Observed platform tag format
Download Manifest Parsing โœ… tact-parser Observed priority format
Size Manifest Parsing โœ… tact-parser Observed size calculation format
TVFS Support โœ… tact-parser Limited to observed file structures
BPSV Format Support โœ… ngdp-bpsv Reverse-engineered binary format

๐Ÿ” Compression & Encryption (Decryption Only)

Capability Status Implementation Details
BLTE Decompression โœ… blte Handles observed BLTE formats
No Compression (N) โœ… blte Direct data passthrough
ZLib Compression (Z) โœ… blte Standard zlib decompression
LZ4 Compression (4) โœ… blte LZ4 decompression
Recursive BLTE (F) โœ… blte Multi-chunk file handling
Salsa20 Decryption (E) โœ… blte Using community-gathered keys
ARC4 Decryption (E) โœ… blte Legacy decryption support
Key Management โœ… CLI Downloads from community repo

๐Ÿ’พ Local Storage (CASC Format Support)

Capability Status Implementation Coverage
Archive Reading โœ… casc-storage Reads existing installations
Archive Writing ๐ŸŸก casc-storage Basic writing - format details incomplete
Index Parsing โœ… casc-storage Reverse-engineered .idx format
File Extraction โœ… casc-storage From known EKey/FileDataID mappings
Installation Verification ๐ŸŸก casc-storage Limited to known validation methods
Storage Optimization ๐ŸŸก casc-storage Based on observed patterns
Build Info Parsing โœ… casc-storage Reads .build.info format
Directory Structure โœ… casc-storage Handles observed layouts

๐Ÿ–ฅ๏ธ User Interface & Tools

Capability Status Implementation Features
CLI Interface โœ… ngdp-client Complete command set
Product Browsing โœ… ngdp-client All products
Build Downloads โœ… ngdp-client Dry-run support
File Extraction โœ… ngdp-client Pattern matching
Storage Management โœ… ngdp-client Full CASC ops
Configuration Management โœ… ngdp-client TOML persistence
JSON Output โœ… ngdp-client Machine readable
Progress Tracking โœ… ngdp-client Download progress

๐Ÿ”„ Advanced Operations

Capability Status Implementation Priority
Patch Application โŒ Planned ngdp-patch High
Delta Patching โŒ Planned ngdp-patch High
Pattern-based Extraction ๐ŸŸก In Progress Medium
Filename Resolution โœ… ngdp-client Community listfiles
Build Comparison ๐ŸŸก Partial Medium
File Diffing โŒ Future Low
GUI Interface โŒ Future Low

๐Ÿš€ Performance & Reliability

Capability Status Implementation Improvement
Parallel Processing โœ… All components 5.3x startup
Intelligent Caching โœ… ngdp-cache 20-30% memory
Lock-free Operations โœ… casc-storage Concurrent safe
Connection Reuse โœ… tact-client 2.23x downloads
Memory Optimization โœ… All components Efficient pools
Error Recovery โœ… All components Automatic retry
Metrics Collection โœ… Built-in Performance tracking

๐ŸŽฏ Production Status

Aspect Status Details
Real-world Testing โœ… WoW 1.13.2, 1.14.2, Agent, BNA
Performance Benchmarks โœ… 1,087 MB/s BLTE throughput
Memory Efficiency โœ… 20-30% reduction vs baseline
Concurrent Safety โœ… Lock-free data structures
Error Handling โœ… Comprehensive error recovery
Documentation โœ… Complete API + guides

Legend: โœ… Working | ๐ŸŸก Partial/Limited | โŒ Not Implemented | โ“ Unknown

Bottom Line: We have implemented client-side NGDP consumption based on reverse-engineering existing game installations and CDN observations. We can successfully download, parse, and extract game content, but we don't yet understand the complete server-side pipeline for content creation and distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment