NewGRF development tools

From OpenTTD
Jump to: navigation, search

You have several options for creating NewGRFs. Of the two main coding methods, NML is easier and is recommended for new NewGRF creators.


Coding with NML

  • NewGRF meta language (NML) is a high-level, text-based language. It is easier to write and read than NFO, and is recommended for new NewGRF creators. It is the only toolchain which supports term-evaluations and expressions and is especially suited for GRFs offering user parameters.
  • There is an easy-to-follow tutorial for creating NewGRFs with NML.

Coding with NFO

  • grfcodec - A tool which encodes and decodes GRFs into plain images and plain (meta-)data (NFO) and vice versa. It comes bundled with NFORenum, a linter and syntax checker for NFO files. You can compare this toolchain roughly with an assembler/disassembler.
  • m4nfo - a high-level language frontend based on the powerful M4 macro processor. It produces low-level nfo byte-code, to generate newGRFs by use of grfcodec. Layed out as a set of small modules, it keeps implementation lightweight (M4: 143kB, m4nfo module 'trains': 50kB), yet supports the full range from plain nfo to higher abstraction levels while producing efficient user-controllable code. m4nfo is user-expandable and gives full access to the underlying M4 macro processor, allowing for all types of templating applications. By handling distributed source files and linking of pre-compiled grf part files, it significantly reduces development time and makes m4nfo especially applicable for the large projects, with additional support of dependency-tracking build utilities like make. In existence since 2009, m4nfo is constantly maintained, available for Windows, OSX and Linux (see M4 availability).
  • Grf2Html - a tool to generate a browser-viewable HTML representation from a GRF. It can be used for in-depth analysis, semantical checking of GRFs and studying their behaviour. As such it is especially suited to learn writing NewGRFs by looking and understanding GRFs written by others. However, it is of limited use when you decide for the high level language NML, as it will probable overwhelm you with details which are abstracted by NML.
  • GRFMaker - UNMAINTAINED! A tool which abstracts from the NFO and allows to generate GRF files without diving into near-hex editing. It is a graphical tool which presents GRFs in a abstracted way while hiding some details. All coding is done via graphical interface; however it only supports/offers a subset of what is possible with NewGRFs.
    Unfortunately this seems to result in the biggest drawback of this toolchain: No advanced GRF coder uses it, so there is about noone who can help you with it. GRFMaker related question threads on the forums often get a reply, how to do something with NFO and/or NML; but none is able to translate that into GRFMaker. :(

Creating graphics

  • PixelTool - a voxel-based sprite editor and rendering tool which simplifies drawing sprites considerably.
  • Voxel object workflow - Timberwolf's video tutorials about using Magicavoxel to draw and render sprites
  • TTDViewer - a simple tool which just displays your .pcx or .png graphics. However, it also does the TTD palette animation and offers you to dynamically apply recolourings like company colours to the image. As it will reload the image whenever it changes on disk, you can use it parallel to your drawing program to get a quick preview, especially when you use the special animated colours of the TTD palette or you use recolourings such as company colours.
  • GRF Wizard - A graphical user interface for the grfcodec executable. Provides a simple and easy GUI for encoding and decoding GRF files, with some options such as palette conversion.

Further resources

Personal tools