How balatro-paperback/paperback works
Main Components
• Mod Loader & Main Entry: At the top level, “paperback.lua” serves as the entry point for the mod. It is responsible for bootstrapping the mod and integrating it with the base game.
• Configuration: “config.lua” is the configuration file that defines global settings and mod initialization parameters.
• Assets: The “assets” folder holds supporting files (images, shaders, sounds). This forms the asset management component that the rendering and audio layers will use.
• Localization: The “localization” folder contains language files (en-us, fr, pt_BR, ru) for translating mod text and dialogues.
• Metadata & Contribution: Files like “metadata.json”, CODE_OF_CONDUCT.md, CONTRIBUTING.md, etc., mark the project’s governance and versioning but are peripheral to the runtime design. They provide context on collaboration rather than the architecture itself.
Relationships and Component Interactions
• The Mod Loader (“paperback.lua”) first initiates by reading the “config.lua” file to set up global parameters.
• It then loads the various content modules from the “content” folder. Each of these modules (cards, jokers, enhancements) registers its definitions into the mod’s runtime.
• The Assets component supplies visuals and sounds to the mod. When a particular piece of content (say, a joker card or booster) is instantiated, it will reference assets defined under the “assets” folder.
• Localization files are loaded by the mod early in the initialization phase so that all textual content is translated for the appropriate locale.
• Utilities and hooks provide a mechanism to integrate with the base game’s event loop, override UI elements, or respond to in-game events. They connect the mod’s custom logic with the streaming of real-time events.
Architectural Patterns and Design Principles
• Modular Design: Each distinct type of content (jokers, decks, cards, etc.) is isolated in its own folder, encouraging separation of concerns.
• Data-Driven Design: Much in-game behavior appears to be driven by Lua scripts and data definitions (in the “content” subfolders). This allows for easy extension and tweaks without changing core logic.
• Plug-and-Play Architecture: The utilities and hooks are likely designed to integrate with existing game loops, allowing you to insert or override functionality provided by the base game.
• Clear Dependency Separation: Assets, localization, and utilities are clearly separated, which means each component can be updated or maintained independently.
• A central “Mod Loader” node representing “paperback.lua”.
• A “Configuration” node (config.lua) feeding into the Mod Loader.
• A complex “Content Management” section depicting individual modules (joker, booster, deck, minor_arcana, paperclip, etc.).
• “Assets” node that links to content modules.
• “Localization” node showing language support files.
• “Utilities & Hooks” node linking back to the mod loader and content modules for custom game interactions.
• Optional side notes indicating external documentation and community support (GitHub contributions, Discord, Wiki).
This detailed approach will give you the clarity required to both develop and communicate the mod's architecture effectively. Happy diagramming!