Skip to content
Therenas edited this page Oct 26, 2022 · 21 revisions

This project aims to teach you about building custom interfaces in Factorio. It does so in two parts: First, a chapterized tutorial that guides you through the process, starting at the very basics of element creation and interaction handling. Second, it provides a loose collection of advanced topics that you can use to expand your knowledge.

The main tutorial is intended to be done sequentially, as each chapter builds on the previous ones, while the advanced topics can be done in any order.

Before You Get Started

This tutorial presupposes that you are familiar with the very basics of modding in Factorio. If you are not, you can learn about it in the general modding tutorial. You don't necessarily need to go through the tutorial mod itself, as it mostly concerns itself with data stage modding. It doesn't hurt though. This other tutorial also goes into how events and the global table work.

This is also neither a programming nor a Lua tutorial, please have a look at external resources like this Lua tutorial instead. The tutorial also makes use of localised strings, which won't be explicitly explained. You should also be familiar with the basics of how the Factorio global table works as we'll be using it to store some data.

Lastly, it is important to note that this is not a style guide. It shows you how the technical side of building a GUI works, but not necessarily which pre-made styles to use and how to properly lay out your interface. Please refer to Raiguard's style guide for a proper style guide after you've got the basics shown in this tutorial down.

Following Along

During the course of this tutorial, you'll be building a small GUI that illustrates the concepts that are being taught. To make it easier to follow along, you'll find a zipped version of the mod to download after every chapter. It can be used to verify the code you wrote, or just be run directly to save you the effort of putting the snippets of code together yourself. It's probably better for your understanding though if you integrate each chapter's code on your own.

We'll be starting from a bare-bones project that you can download here. It has a basic info.json, a control.lua file that disables the freeplay intro cinematic, a data.lua that adds some style prototypes, and locale file that we'll be using down the line. If you're not familiar with how to set up the basic structure of a mod, please refer to the general modding tutorial to learn about it before you proceed.

Main Tutorial

These are the chapters that make up the bulk of this tutorial. It will guide you through all the relevant steps of creating a GUI, including the creation, styling and updating of the individual elements, and the reaction to user actions. This process is pretty involved, so please take your time. Creating custom interfaces in Factorio requires you to learn a lot of the general concepts involved in modding, so if this is your first time working on a mod, it'll take you a bit to get going.

Advanced Topics

This is a collection of topics that go into some of the more advanced parts of GUI modding. They can be read and understood on their own, and are unrelated to the main tutorial. They do however presuppose a certain level of knowledge about working with GUIs in Factorio, so feel free to work through the main tutorial to get up to speed.