Skip to content

Add AvaloniaUI cross-platform mod editor (KfxModStudio) + Transfer Package#23

Closed
Copilot wants to merge 13 commits intofeature/3676-custom-soundsfrom
copilot/vscode-ml3q0j1l-lgts
Closed

Add AvaloniaUI cross-platform mod editor (KfxModStudio) + Transfer Package#23
Copilot wants to merge 13 commits intofeature/3676-custom-soundsfrom
copilot/vscode-ml3q0j1l-lgts

Conversation

Copy link

Copilot AI commented Feb 1, 2026

Community needs graphical tooling to author and convert mods to the new .kfxmod binary format. Command-line tools exist but lack discoverability and ease of use.

Implementation

Core Application (tools/KfxModStudio/)

  • Cross-platform C# .NET 10.0 + AvaloniaUI 11.3 desktop app
  • MVVM architecture with CommunityToolkit
  • Binary format I/O with 100% compatibility to C implementation via marshaling

Binary Format Support (Services/)

  • ModPackReader: Reads 64-byte header, decompresses zlib metadata, parses JSON
  • ModPackConverter: Scans folders, generates metadata, writes binary format
  • CRC32 validation and async I/O throughout

Data Models (Models/ModPackModels.cs)

  • C# equivalents of all C structures from src/config_modpack.h
  • Binary marshaling for header (64 bytes, byte-perfect match)
  • JSON serialization for metadata with all fields

UI Design (Views/MainWindow.axaml)

  • Left panel: Quick actions (Convert Folder, Open Mod)
  • Center tabs: Metadata editor, file list, preview pane, raw JSON
  • Dark Fluent theme with workshop icon from FXGraphics

Example Usage

// Load existing .kfxmod
var modPack = await ModPackReader.LoadAsync("tempest_keeper.kfxmod");
Console.WriteLine($"Loaded: {modPack.Metadata.Name} v{modPack.Metadata.Version}");

// Convert folder to .kfxmod
var metadata = ModPackConverter.CreateDefaultMetadata(folderPath, "my_mod");
await ModPackConverter.ConvertFolderToKfxModAsync(
    sourceFolder, outputFile, metadata, 
    ModPackCompression.Zlib, progress);

Architecture Decisions

  • Binary marshaling over manual parsing for header to guarantee byte alignment
  • Zlib in BCL (System.IO.Compression) rather than external dependencies
  • Async-first for all file I/O to support progress reporting
  • MVVM with stubs for file pickers - platform dialogs need Avalonia.Storage integration

Documentation

  • README.md: Features, build instructions, architecture
  • DESIGN.md: UI mockups, workflows, future enhancements (map viewer, dependency graph)
  • FRONTEND_SUMMARY.md: Technical details, compatibility notes
  • UI_PREVIEW.txt: ASCII art mockups since headless build cannot screenshot

Transfer Package

Added for separate repository deployment:

  • keeperfx-modstudio-transfer.zip (47 MB) - Complete transfer package containing:
    • Full KfxModStudio source code (~800 lines C#)
    • All documentation files (README, DESIGN, FRONTEND_SUMMARY, UI_PREVIEW)
    • Example Tempest Keeper campaign (343 files, 64 MB)
    • Reference documentation (mod_binary_format.md, mod_implementation.md, analysis)
    • C reference files (config_modpack.h/c)
    • Pre-configured .gitignore for C# projects
  • MODSTUDIO_TRANSFER.md - Comprehensive transfer instructions and package overview
  • TRANSFER_INSTRUCTIONS.md (inside zip) - Step-by-step setup guide for new repository

The transfer package enables easy migration to https://github.com/Cerwym/keeperfx-modstudio with a single initial commit.

Outstanding Work

File picker dialogs require Avalonia.Storage platform integration. Commands and UI are wired but dialogs are stubbed. Map layout viewer designed but needs map format parser from game engine.

Original prompt

In the tempfolder I have provider an extrmely feature filled campaign made by a member of the community.

I want you to tell me EVERYTHING it does, how the mod system comes in to play for each part introduced, land effects, new creatures, new sounds, new VA, scripts, everything.

I want you to tell me how things are interconnected.

Then with this understanding, I want you to consider my proposal to create an open, binary format, to make mod submission, disocverability, extensibility and updatability easier.

My idea with this system is to make it easier to deliver updates to mods, i.e, the 'mod' can be tracked in an external system like a CDN and we can make the game itself aware when updates to mods are available.
With this system we would also be able to introduce metadata into the binary format so that we can start to make mods more modular, i.e, we can make a campaign 'DEPEND' on mods, rather than including them with the campaign itself. Think of my rough idea and also consider how other games have made a mod format to deliver the very same kind of approach

Created from VS Code.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits February 1, 2026 12:39
…ies, and CDN support

Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Copilot AI changed the title [WIP] Propose open binary format for mod submissions Implement binary mod package format with dependency resolution and CDN updates Feb 1, 2026
Copilot AI requested a review from Cerwym February 1, 2026 12:49
Copilot AI and others added 3 commits February 1, 2026 14:53
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Copilot AI changed the title Implement binary mod package format with dependency resolution and CDN updates Add AvaloniaUI cross-platform mod editor (KfxModStudio) Feb 1, 2026
@Cerwym
Copy link
Owner

Cerwym commented Feb 1, 2026

@copilot , this is a good start.

I created a repo for this under my account, https://github.com/Cerwym/keeperfx-modstudio for this new project.

If you can, please transfer what we've done in this session, if you can't please make it easy for me to transfer our session and changes (including the example mod i gave you) over, maybe through a zip, so i can push to my repo, locally

Co-authored-by: Cerwym <1760289+Cerwym@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 1, 2026

@copilot , this is a good start.

I created a repo for this under my account, https://github.com/Cerwym/keeperfx-modstudio for this new project.
...

I've created a complete transfer package for you!

Download the zip file: keeperfx-modstudio-transfer.zip (47 MB) - Available in this PR

What's included:

  • Complete KfxModStudio C# source code (~800 lines)
  • All 4 documentation files (README, DESIGN, FRONTEND_SUMMARY, UI_PREVIEW)
  • Example Tempest Keeper campaign (343 files, 64 MB)
  • Reference documentation (mod_binary_format.md, mod_implementation.md, etc.)
  • C reference files (config_modpack.h/c)
  • Detailed TRANSFER_INSTRUCTIONS.md with step-by-step setup
  • .gitignore template for C# projects

Quick setup:

# 1. Download and extract the zip
unzip keeperfx-modstudio-transfer.zip

# 2. Clone your new repo
git clone https://github.com/Cerwym/keeperfx-modstudio.git
cd keeperfx-modstudio

# 3. Copy contents (or follow detailed instructions in the zip)
cp -r keeperfx-modstudio-transfer/KfxModStudio/* .
# ... see TRANSFER_INSTRUCTIONS.md for full details

# 4. Build and test
dotnet restore
dotnet build

See MODSTUDIO_TRANSFER.md in this PR for a complete overview. The zip contains everything needed to set up the new repository with one initial commit!

Commit: ab01adf

Copilot AI changed the title Add AvaloniaUI cross-platform mod editor (KfxModStudio) Add AvaloniaUI cross-platform mod editor (KfxModStudio) + Transfer Package Feb 1, 2026
@Cerwym
Copy link
Owner

Cerwym commented Feb 1, 2026

@copilot
I asked you for a comprehensive analysis of the tempest keeper mod, did you do this and create a doc for me to read?

Copy link
Author

Copilot AI commented Feb 1, 2026

@copilot
I asked you for a comprehensive analysis of the tempest keeper mod, did you do this and create a doc for me to read?

Yes! I created a comprehensive 974-line analysis document for you:

Location: docs/tempest_keeper_analysis_and_proposal.md (30 KB)

What it covers:

Part 1: Complete Tempest Keeper Analysis

  • Campaign overview (343 files, 65 MB, 6 directories)
  • File structure breakdown of all folders
  • Campaign configuration details
  • Custom Angel creature (full specs: stats, sprites, sounds, powers)
  • All configuration files explained
  • Level scripts & data (15 levels with examples)
  • Audio system (30 voice files, 7 music tracks)
  • Land view system

Part 2: System Interconnections

  • Data flow diagrams
  • Dependency chains
  • Resolution process
  • Override hierarchy

Part 3: Binary Mod Format Proposal

  • Motivation and design philosophy
  • Complete format specification
  • Metadata schema
  • Modular design examples
  • CDN update system

Part 4-6: Implementation & Comparisons

  • Code structure and tools
  • Comparison with Skyrim, Factorio, Minecraft
  • Benefits and use cases
  • Future roadmap

The document is also included in the transfer package zip (commit ab01adf).

@Cerwym Cerwym closed this Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants