$ show FunkinCrew/polymod
Polymod is a Haxe library that enables modding for games and applications by intercepting asset loading and providing a runtime scripting system. It supports multiple game engines (OpenFL, Lime, HEAPS, NME, Flixel, and custom backends) through a clean abstraction layer of backends and file systems. The core API (Polymod.init, scan, loadMod) allows developers to define mod root directories, load mod metadata, and apply asset replacements, text merges (XML, JSON, CSV, TSV), and script modifications. A notable feature is the integrated HScript interpreter (a fork of the language) that allows mods to define classes, override methods, and extend game logic at runtime. The codebase is well-structured with clear separations of concerns (backends, file systems, format parsers, utilities) and includes extensive sample projects demonstrating integration with various frameworks. However, it lacks a formal test suite, contains some debugging artifacts (trace calls), and relies on heavy macro metaprogramming for scripted class generation, which increases maintenance risk across Haxe compiler versions. The dependency on Lime/OpenFL internals and platform-specific conditionals makes the code somewhat brittle, though the core abstractions remain reusable.
The LLM identified 4 files worth highlighting for reuse:
Implements low-level ZIP central directory and local file header parsing, enabling on-demand file extraction without full decompression. Reusable across any Haxe project needing ZIP file reading with minimal memory.
Parses and compares version strings using semantic versioning rules. Supports complex version matching with operators and dependency rules. Extractable for any project needing version constraint checking.
Provides a case-insensitive string-keyed map implementation, using a predefined set of keys for efficient lookups. Useful for cross-platform file path handling where case sensitivity varies.
Defines the contract for framework-specific asset backends, allowing Polymod to operate across multiple game engines. The interface abstracts asset loading and modification, making it easy to add new backend implementations.