An introduction to NTGML

NTT uses a custom scripting language that largely resembles that of GameMaker. I'll be calling it "NTGML" in this document for simplicity.

As result, GameMaker manual, tutorials, and most concepts can also come handy when making Nuclear Throne mods.

Anatomy of a mod

A mod is usually a directory containing one or more code files, any asset files (like images or sounds), and a main.txt file that tells the game which files to load and how.

The user can then use /load moddirectory to execute chat commands from main.txt to load the mod.

In GameMaker terms,

  1. Code files use a .ntgml file extension if they are using "modern" NTGML, or a .gml extension if they are using "legacy" NTGML.

    "Modern" NTGML usually matches features of latest GML at the time of release.

    "Legacy" NTGML is what NTT has originally used and largely resembles GML from GameMaker: Studio with some added conveniences.

    Using "legacy" NTGML will also use backwards-compatible versions of certain functions so new mods should stick to "modern" NTGML.

  2. Each loaded code file represents a program with its own scripts and global variables.

    To combine multiple files into a single program, see #pragma include.

    To have a program call scripts or access variables from another program, see #pragma using or cross-mod API.

  3. Instances and assets are shared between all mods.
  4. The game will call mod scripts on various occasions, depending on mod type.

    For example, weapon_name is called for weapon mods whenever the game needs to fetch the name of a weapon for display.

  5. Assets are loaded through code (sprite_add, sound_add, etc.)
  6. You can't create objects at runtime in GameMaker so instead there's a handful of "scriptable" objects like CustomObject, CustomEnemy, etc.

    There are also functions to bind a script to run at a specific event/depth.

Editing mods

GMEdit is recommended for making NTT mods as it can display function arguments and syntax-check the code with NTGML rules in mind.

You may also use other editors - running the /gmlapi command in chat will generate a handful of files that can be used to set up syntax highlighting and auto-completion.