Skip to content

Implement Core Package System #20

@toymak3r

Description

@toymak3r

Overview

Design and implement a comprehensive package system for Goethe dialog files that supports metadata, validation, and efficient distribution.

Background

Currently, Goethe dialog files are distributed as individual YAML files. A package system will enable better organization, metadata management, and distribution of dialog content.

Requirements

Package Format Design

  • Define package format specification (.gdkg files)
  • Design package header structure with metadata
  • Implement package versioning system
  • Create package validation schema

Core Implementation

  • Implement Package class in src/engine/core/package/package.cpp
  • Add corresponding header in include/goethe/package.hpp
  • Implement package creation and extraction utilities
  • Add package validation and integrity checking

Package Features

  • Metadata Support
    • Package name, version, author, description
    • Creation date, modification date
    • Dependencies and requirements
    • Tags and categories
  • Content Management
    • Multiple dialog files per package
    • Asset bundling (images, audio, etc.)
    • Dependency resolution
    • Content validation
  • Package Operations
    • Create package from directory
    • Extract package to directory
    • List package contents
    • Validate package integrity
    • Update package metadata

Command-Line Tools

  • Enhance gdkg_tool with package operations
  • Add package creation commands
  • Add package extraction commands
  • Add package validation commands
  • Add package listing commands

Testing

  • Unit tests for package system in src/tests/test_package.cpp
  • Integration tests with existing dialog system
  • Performance tests for large packages
  • Error handling tests
  • Cross-platform compatibility tests

Documentation

  • Package format specification
  • API documentation for package system
  • Command-line tool documentation
  • Package creation and usage examples

Technical Details

Package Format Structure

GDKG Package Format:
- Header (32 bytes): Magic, version, flags, metadata offset
- Metadata Section: JSON/YAML metadata
- Content Section: Compressed dialog files and assets
- Index Section: File locations and checksums
- Footer: Package checksum and validation data

API Design

class Package {
public:
    Package();
    ~Package();
    
    // Package creation
    static Package create(const std::string& name, const std::string& version);
    void add_file(const std::string& path, const std::vector<uint8_t>& data);
    void set_metadata(const PackageMetadata& metadata);
    bool save(const std::string& path);
    
    // Package loading
    static Package load(const std::string& path);
    std::vector<uint8_t> get_file(const std::string& path);
    PackageMetadata get_metadata() const;
    std::vector<std::string> list_files() const;
    
    // Validation
    bool validate() const;
    bool verify_integrity() const;
};

struct PackageMetadata {
    std::string name;
    std::string version;
    std::string author;
    std::string description;
    std::vector<std::string> tags;
    std::map<std::string, std::string> dependencies;
    std::chrono::system_clock::time_point created;
    std::chrono::system_clock::time_point modified;
};

Performance Targets

  • Package creation: <1 second for 100MB content
  • Package loading: <500ms for 100MB content
  • Memory usage: <2x package size during operations

Acceptance Criteria

  • Package system compiles and links successfully
  • All tests pass
  • Package creation and extraction work correctly
  • Metadata is properly stored and retrieved
  • Package validation detects corruption
  • Command-line tools work as expected
  • Documentation is complete and accurate

Priority

High - This is part of the short-term roadmap and essential for distribution.

Labels

  • enhancement
  • package-system
  • distribution
  • short-term
  • high-priority

Estimated Effort

  • Development: 3-4 weeks
  • Testing: 1-2 weeks
  • Documentation: 1 week

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions