How guiymour/mindustry-extra-utilities-mod works
Main Components
• Assets: This folder holds all the non-code content such as bundles (language/localization), maps (with .msav format), scripts (organized by category like blocks, effects, power, production, turrets, etc.), shaders, and sprites. This represents the game’s resource layer and visual content.
• Source Code: Under the “src/ExtraUtilities” directory, the Java source files are organized by functionality. Notable sub-packages include:
– ai: Contains artificial intelligence logic (e.g., DefenderHealAI, MinerPointAI)
– content: Defines game elements (blocks, items, sounds, tech trees, status effects, etc.)
– graphics: Contains renderers and shader management
– input: Handles user interaction
– net: Manages network packets and synchronization for multiplayer
– ui: User interface components for displaying custom lists, images, and mod-specific menus
– worlds: Contains further subdivision into blocks (by function: distribution, effect, heat, power, production, turret, unit, etc.), consumers, drawers (for drawing world elements), and entity related classes (abilities, bullets, units, weapons, animations, etc.)
• Build and Configuration: Files like build.gradle, gradle.properties, and the Gradle wrapper indicate the build system in use. The mod configuration file (mod.hjson) and GitHub workflows (.github/workflows) support development practices and CI/CD.
Relationships and Interactions
• Core Mod Integration: At the heart, the ExtraUtilitiesMod.java likely acts as the entry point. It integrates with Mindustry’s mod loading system.
• Game Engine Integration: The mod interacts with the Mindustry game engine by adding new game objects (units, blocks, turrets, etc.) that are defined in both the Java code and referenced in the assets (sprites, maps, scripts).
• Internal Modules: Inside the mod code, there are clear separation and interactions between modules:
• AI and Unit Behavior: “ai” and “worlds/entity/unit/” manage game unit logic.
• Game Content Definition: “content” combines definitions for blocks, items, bullets, and routes new functionality (like turrets & power production).
• World and Graphics Handling: Modules under “worlds/drawer”, “graphics”, and “worlds/entity” coordinate to render effects and implement animations.
• Network Sync: The “net” package oversees any packets (e.g., CtrlMissileSyncPacket) to keep data in sync during multiplayer sessions.
• Assets and Configuration Linkage: The assets folder provides the static resources that are pulled into the game mod to visually represent or script behaviors (for example, the various scripts in assets/scripts that correlate to functionalities implemented in Java under “worlds/blocks” or “worlds/entity”).
Architectural Patterns and Design Principles
• Modular Organization: The project is organized by functionality (AI, content, net, UI, worlds, etc.), suggesting a modular structure with clear separation of concerns.
• Resource Separation: All assets (graphics, maps, scripts, translations) are kept separate from the source code. This separation makes it easier to update or replace visual game elements independently of game logic.
• Extendability: The code is designed to extend the original game’s capabilities, as evinced by packages for abilities, turrets, and extra units. The design supports adding new game elements without major rework.
Relevant Technologies and Tools
• Java: Main development language used in the “src” directory for mod development.
• Gradle: The build automation is managed via Gradle (as evidenced by build.gradle and gradle wrapper files).
• GitHub CI: There is a workflow setup in the .github/workflows directory for automating builds or tests.
• Mindustry API: The mod integrates with the Mindustry game engine through defined APIs (hooks for blocks, units, etc.).
Final Recommendations
• You capture each crucial component by creating separate nodes for:
• The Game Engine (Mindustry)
• The Mod Core and Initialization (ExtraUtilitiesMod)
• Source Code Modules: AI, Content, Graphics, Input, Network, UI, Worlds (further subdivided into blocks, entities, drawers, etc.)
• Assets: Bundles, Maps, Scripts, Shaders, Sprites
• Build and Configuration components (Gradle, GitHub workflows, mod.hjson)
• Detail interactions, such as how user inputs are handled in “input” and “ui”, how game events use the network modules for multiplayer, and how the graphics renderer pulls shaders and sprite data from assets.