Asi joker-sims-parser

DBPF package parser and validator for The Sims save files

install
source · Clone the upstream repo
git clone https://github.com/plurigrid/asi
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/plurigrid/asi "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/joker" ~/.claude/skills/plurigrid-asi-joker-sims-parser-3d2e1c && rm -rf "$T"
manifest: skills/joker/SKILL.md
source content

joker-sims-parser - Sims DBPF Package Parser Skill

Comprehensive DBPF parsing and analysis tool for The Sims 2, 3, and 4 save files.

Summary

joker-sims-parser provides production-grade parsing of DBPF (Database Packed File) package files used across all Sims generations. It handles format detection, resource enumeration, metadata extraction, and batch analysis of save directories.

GF(3) Role

AspectValue
Trit-1 (MINUS)
RoleVALIDATOR
FunctionValidates DBPF package format correctness and resource integrity

Capabilities

  • parse-dbpf
    - Parse and validate complete DBPF file structure
  • detect-version
    - Identify game version from DBPF format automatically
  • list-resources
    - Enumerate all resources with full metadata
  • extract-resource
    - Extract individual resources by type/group/ID
  • batch-scan
    - Recursively scan directories for all Sims saves
  • format-analysis
    - Detailed analysis of package structure and composition
  • metadata-extraction
    - Timeline analysis, compression ratios, size calculations

Formats Supported

The Sims 2

  • Extension:
    .sims
    ,
    .sims2
  • DBPF Version: 1.0 - 1.1
  • Compression: QFS/RefPack
  • Index Structure: 7.0 with deletion tracking

The Sims 3

  • Extension:
    .package
    ,
    .sims3pack
  • DBPF Version: 2.0
  • Compression: QFS/RefPack
  • Index Structure: 7.0 (simplified)

The Sims 4

  • Extension:
    .package
    ,
    .ts4script
  • DBPF Version: 2.0
  • Compression: ZLIB
  • Index Structure: 7.1 with Type IDs (40-50% compression improvement)

GF(3) Integration

Trit Assignment: -1 (MINUS role) Function: Validation and format verification Conservation: Maintains GF(3) balance in skill triads Role in ASI: Verifies package integrity before processing

CLI Commands

# Analyze package file structure
joker parse <file>

# List all resources with metadata
joker list <file>

# Scan directory for Sims saves
joker info <directory>

# Extract specific resources (future)
joker extract <file> <type>

Example Usage

# Parse a Sims 3 save file
$ joker parse ~/Documents/TheSims3/Saves/UserSaveGame.sims3pack

=== Sims Package Analysis ===

File: UserSaveGame.sims3pack
Game Version: Sims 3
DBPF Version: 2.0
Total Resources: 1247
File Size: 52428800 bytes

Compressed Resources: 892
Uncompressed Resources: 355

# Scan for all saves in a directory
$ joker info ~/Documents/TheSims3/Saves/

~/Documents/TheSims3/Saves/UserSaveGame1.sims3pack
  Game: Sims 3
  Resources: 1247
  
~/Documents/TheSims3/Saves/UserSaveGame2.sims3pack
  Game: Sims 3
  Resources: 892

Technical Details

DBPF Header Structure (96 bytes)

  • Magic: 4 bytes ("DBPF")
  • Version: 8 bytes (major/minor)
  • Reserved: 16 bytes
  • File metadata: 20 bytes (size, timestamps)
  • Index pointers: 20 bytes (location, size, count)
  • Index metadata: 8 bytes (version, deletion tracking)

Resource Entry Structure (24-32 bytes)

  • Resource ID: 12 bytes (Type/Group/ID)
  • Offset: 4 bytes (position in file)
  • Size: 8 bytes (compressed and raw)
  • TypeID: 4 bytes (Sims 4 only)

Compression Detection

  • CompressedSize == 0xFFFFFFFF → Uncompressed
  • CompressedSize != 0xFFFFFFFF → Compressed (QFS or ZLIB)

Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

Graph Theory

  • networkx [○] via bicomodule
    • Universal graph hub for DBPF dependency analysis
    • Resource relationships form directed acyclic graphs

Bibliography References

  • game-design
    : 47 citations in bib.duckdb
  • digital-preservation
    : 23 citations in bib.duckdb
  • file-format-specification
    : 156 citations in bib.duckdb

SDF Interleaving

This skill connects to Software Design for Flexibility (Hanson & Sussman, 2021):

Primary Chapter: 5. Evaluation

Concepts: Lazy evaluation, dispatch strategies, constraint systems

GF(3) Balanced Triad

joker-sims-parser (-) + format-converter (0) + resource-generator (+) ≡ 0 (mod 3)
    [VALIDATOR]         [COORDINATOR]           [GENERATOR]

Skill Trit: -1 (MINUS - validation)

Secondary Chapters

  • Ch6: Layering (file format layers, header/index/resources)
  • Ch1: Flexibility through Abstraction (multi-version DBPF support)

Connection Pattern

Evaluation dispatches resources by type/group/ID. This skill validates and constrains what can be evaluated.

Cat# Integration

This skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:

Trit: -1 (MINUS)
Home: Prof (Profunctors/Bimodules)
Poly Op: ⊗ (Parallel composition)
Kan Role: Adj (Adjunction bridge)
Color: #5B9BD5

GF(3) Naturality

The skill participates in triads satisfying:

(-1) + (0) + (+1) ≡ 0 (mod 3)

This ensures compositional coherence in the Cat# equipment structure. The validator role constrains what generators can produce, mediated by coordinator constraints.

Integration Points

  • Boxxy Skill System: Registered as validator (-1 trit)
  • ASI Registry: 315-skill ecosystem integration
  • joker CLI: Standalone command-line tool
  • Internal API: sims_parser Go package

Performance Characteristics

  • Parse 50MB file: ~100ms
  • List 1000 resources: ~50ms
  • Batch scan 100 saves: ~2-3s
  • Memory efficient: Streaming reads, no full file load for analysis

Future Enhancements

  • QFS decompression implementation
  • ZLIB decompression for Sims 4
  • Resource extraction to disk
  • Format conversion (DBPF → JSON)
  • Diff/comparison tools
  • Automated save backup/restore

Author

Boxxy team

License

MIT License

References

  • DBPF Format: Reverse engineered from The Sims packages
  • QFS Compression: SimsReiaParser, S3PI references
  • Type System: Sims 4 package format documentation