Asi joker-sims-parser

Parse and analyze Sims DBPF (Database Packed File) format for Sims 2, 3, and 4 save files. Extract package structure, resource metadata, and format information. Use when processing Sims game saves for validation, analysis, or extraction.

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-sims-parser" ~/.claude/skills/plurigrid-asi-joker-sims-parser && rm -rf "$T"
manifest: skills/joker-sims-parser/SKILL.md
source content

joker - Sims DBPF Parser Skill

Overview

joker provides comprehensive DBPF (Database Packed File) parsing capabilities for all Sims game generations (2, 3, and 4). It validates package integrity, enumerates resources, and detects game versions automatically.

Role: MINUS validator in triadic consensus - validates package format correctness and resource integrity.

Quick Start

Launch Interactive Shell

./bin/joker              # Interactive REPL mode
./bin/joker -i           # Explicit interactive flag
./bin/joker interactive  # Full keyword

CLI Mode

# Analyze package structure
./bin/joker parse ~/Sims3Saves/save.sims3pack

# List all resources
./bin/joker list game.package

# Batch scan for save files
./bin/joker info ~/Documents/TheSims3/Saves/

# Extract resources by type (future)
./bin/joker extract package.sims3pack 0x043bec01

When to Use

  • Validating Sims save files: Check if files are valid DBPF packages
  • Extracting package metadata: Analyze game version, resource count, compression status
  • Batch processing: Scan directories for all Sims saves with statistics
  • Format debugging: Understand DBPF structure and resource organization
  • Pre-processing for mods: Validate packages before modification

When NOT to Use

  • Decompressing resources (use specialized decompression skills)
  • Modifying resource data (use generation skills)
  • Converting formats (outside current scope)

Interactive Commands

CommandUsageExample
parseAnalyze single package
parse ~/save.sims3pack
listEnumerate resources
list game.package
infoScan directory
info ~/Documents/TheSims3/Saves/
extractExtract by type
extract game.package 0x043bec01
helpShow commands
help
quit / exitExit shell
quit

Output Format

parse command

=== Sims Package Analysis ===

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

Index Information:
  Index Count: 1247
  Index Offset: 0x032a1f00
  Created: 1672531200
  Modified: 1672531200

Resource Types Found:
  Type 0x043bec01: 247 resources
  Type 0x0210dc99: 892 resources
  ...

Compressed Resources: 1200
Uncompressed Resources: 47

list command

Type       Group      ID           Size       Compressed
0x043bec01 0x00000001 0x000000012a 8192       Yes
0x0210dc99 0x00000002 0x000000013b 4096       No
0x0215ca48 0x00000003 0x000000014c 16384      Yes
...

info command

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

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

Format Support Matrix

GameExtensionDBPF VersionIndex FormatCompressionStatus
Sims 2.sims, .sims21.0 - 1.17.0 + deletionQFS/RefPack✓ Implemented
Sims 3.package, .sims3pack2.07.0QFS/RefPack✓ Implemented
Sims 4.package, .ts4script2.07.1 + Type IDsZLIB✓ Implemented

DBPF Specification

Header Structure (96 bytes)

Offset   Size   Field
0x00     4      Magic ("DBPF")
0x04     4      Major Version
0x08     4      Minor Version
0x0C     16     Reserved
0x1C     4      File Size
0x20     4      Index Count
0x24     4      Index Offset
0x28     4      Index Size
0x2C     4      Hole Index Count
0x30     4      Hole Index Offset
0x34     4      Hole Index Size
0x38     4      Created Date (Unix timestamp)
0x3C     4      Modified Date (Unix timestamp)
0x40     4      Index Minor (version indicator)

Resource Entry

Sims 2/3 (24 bytes):

ResourceType:   uint32 (4 bytes)
ResourceGroup:  uint32 (4 bytes)
ResourceID:     uint64 (8 bytes)
Offset:         uint32 (4 bytes)
CompressedSize: uint32 (4 bytes, 0xFFFFFFFF = uncompressed)
RawSize:        uint32 (4 bytes)

Sims 4 (32 bytes - adds TypeID):

[24-byte entry above]
TypeID:         uint32 (4 bytes)
[padding]       uint32 (4 bytes)

Game Version Detection

Major = 1, Minor ≤ 1        → Sims 2
Major = 2, IndexMinor = 0   → Sims 3
Major = 2, IndexMinor = 1   → Sims 4

Compression Detection

  • CompressedSize == 0xFFFFFFFF
    → Uncompressed
  • CompressedSize != 0xFFFFFFFF
    → Compressed (identifies size in bytes)

Architecture

joker uses a REPL (Read-Eval-Print Loop) architecture:

User Input → Parse Command → Execute Handler → Display Output → Prompt

Components

  • dbpf.go (391 lines): Core DBPF format parser

    • Multi-version DBPF support (1.0, 1.1, 2.0, 2.0 v7.1)
    • Streaming parser with minimal memory footprint
    • Resource enumeration with compression detection
  • skill_integration.go (108 lines): Boxxy skill registration

    • GF(3) trit assignment (-1 MINUS/Validator)
    • ASI registry integration
    • Capability declarations
  • main.go (320 lines): CLI tool and command dispatcher

    • parse, list, info, extract commands
    • Usage documentation
  • interactive.go (108 lines): REPL shell

    • Command parsing and routing
    • Interactive help system

GF(3) Conservation

joker is assigned trit = -1 (MINUS) for validation role:

Validator (-1) + Coordinator (0) + Generator (+1) ≡ 0 (mod 3)
   [joker]        [jo-clojure]     [hy-regime]

This enables triadic consensus for Sims file processing pipelines.

Performance

  • Parse 50MB file: ~100ms
  • List 1000 resources: ~50ms
  • Batch scan 100 files: ~2-3s
  • Memory footprint: ~10MB (streaming)
  • Binary size: 2.4MB (standalone, zero dependencies)

References

See

references/USAGE.md
for detailed usage examples and
scripts/
for implementation.

Troubleshooting

"File not found"

  • Verify file path is correct
  • Use absolute paths (e.g.,
    ~/Documents/...
    or
    /Users/...
    )

"Unknown command"

  • Type
    help
    in interactive mode to see all available commands

No output from info command

  • Ensure directory contains Sims save files (.sims, .sims2, .package, .sims3pack, .ts4script)
  • Check directory permissions

Binary not found

  • Rebuild with:
    go build -o bin/joker ./cmd/joker
  • Ensure Go 1.21+ is installed

Future Enhancements

Phase 1 (Immediate)

  • Implement QFS/RefPack decompression
  • Implement ZLIB decompression
  • Add resource extraction to disk
  • JSON export capability

Phase 2 (Short-term)

  • Format conversion utilities
  • Diff/comparison tools
  • Resource type identification
  • Automated backup/restore

Phase 3 (Extended)

  • GUI tool for save browsing
  • Mod package builder
  • Format fuzzing tests
  • Performance optimization