Proposed enhancements to the iw4x-toolkit MCP server. Sourced from two streams:
- Restricted environment modding (e.g. porting Bot Warfare into Promod, where many engine/script functions are stripped or redefined).
- Post-integration feedback from real modding sessions using the toolkit.
Modding for restricted environments like Promod involves a painful "game-crash-and-log" cycle:
- Apply a change or stub.
- Pack the mod.
- Launch the game.
- Wait for the engine to fail on an Unknown Function or Already Defined error.
- Extract the log and repeat.
This trial-and-error process is the primary bottleneck for porting complex mods. The tools below are designed to eliminate it.
- Functionality: Scans all
.iwdfiles in a game/mod directory and indexes every function definition (func() { ... }). - Result: A searchable map of every function available in the base game and the target mod (e.g. Promod).
- Impact: Eliminates "Already Defined" errors. We would know exactly which functions exist before attempting to stub them.
- Functionality: Statically analyzes a
.gscfile and identifies every function call that is:- Not defined locally.
- Not defined in any
#includefile. - Not found in the indexed Environment Symbol Map.
- Impact: Converts the "one crash at a time" cycle into a "batch fix." All 50 missing functions can be identified and fixed in a single build.
- Note: Extends the existing
gsc_lint— consider whether this is agsc_lintflag or a separate tool.
- Functionality: Scans all IWD files in a mod directory and reports any script calls that cannot be resolved by any of the indexed archives.
- Benefit: Reduces the manual effort of indexing multiple archives one-by-one. Provides a "safety score" for the entire mod.
- Relationship: Combines
iwd_index_symbols+gsc_find_orphansinto a single mod-wide pass.
- Functionality: Based on
gsc_find_orphansoutput, automatically generates a_compat.gscwith weak-redirection stubs or common proxy implementations (e.g.waittill_any,isReallyAlive,isUsingRemote). - Distinguishes: Engine built-ins (which need stubs in
_bot_utility.gsc) vs. script calls (which may need a stub or an include change). - Benefit: Rapidly resolves common integration boilerplate — almost always required when merging legacy mods.
- Feature: Enhancement to
gsc_lint. - Description: Detect when two functions are defined with the same name but different casing (e.g.
isReallyAlivevsisreallyalive). GSC is case-insensitive, so this causes a script compile error. - Experimental result: Current
gsc_lintreturns "No issues found!" for case-variant duplicates. This is a known gap. - Benefit: Prevents invisible bugs and compile crashes when an AI or developer accidentally duplicates a function with different capitalization.
- Functionality: An improved linter that understands modern GSC features used in high-end mods:
- Function pointers:
[[ func_ptr ]]() - Array literals and shorthand syntax.
- Dynamic includes.
- Function pointers:
- Impact: Reduces false-positive noise. Current linter flags valid modern GSC as syntax errors, making it useless for finding real logic flaws in those files.
- Feature: Enhancement to
gsc_lint(or a newgsc_lint_projectmode). - Description: Allow
gsc_lintto read an active mod directory and warn about::calls to functions that no longer exist in the modified environment. - Experimental result:
gsc_lintcaught syntax errors but did not warn thatbuildweaponnamewas missing from the broader project context — the error only appeared at game launch. - Benefit: Catches cross-file dependency errors before the game is even launched.
- Functionality: Parse
.menufiles (UI layer) and identify whatscriptmenusResponseevents they send to the GSC engine. - Benefit: Bridges the gap between UI interaction and GSC logic — makes it easier to understand how custom menus (like Promod's) trigger script events.
- Relationship: Complements the planned
2C: Menu File Validatorin the TODO roadmap.
- Functionality: Generate a Mermaid or text-based call graph for a GSC file, showing how functions call each other and which external scripts they depend on.
- Benefit: Vital for understanding complex, undocumented mods with deeply nested function calls.
- Functionality: Direct integration with the game engine's stdout to pipe compile errors into the AI context with file/line mapping.
- Impact: Instantly directs the developer to the exact line of a crash, without manual log extraction.
Tip
Implementing the Symbol Oracle (iwd_index_symbols) and Orphan Detector (gsc_find_orphans) alone would reduce "Promod Cleanse" time from hours to minutes — a single comprehensive batch fix replaces the crash-and-repeat loop.
The tool can't create new IWDs from scratch. IWD files are just ZIP archives