ZScript_Basics

ZScript Basics: A Guide for Non-Programmers (from a non-programmer)

This guide is a beginner-friendly introduction to ZScript, a primary coding language used to code gameplay, UI and menus in GZDoom source port.

☕ Support me:

Important notes

  1. This document was written by a person who learned to use ZScript without any prior programming experience. I strive to use the correct terminology and not dumb things down but I may also purposefully overexplain certain things or initially present them in a simplified manner for the sake of beginner-friendliness.
  2. While most code examples in the guide are made to be runnable, it’s not recommended to use them as is: many of them are purposefully inefficient, and the guide tends to iterate over them, improving various aspects while explaining new techniques. Examples are meant to be just that: examples—not ready-made solutions.
  3. This document is a guide, not a wiki. As such, it’s designed to be read from beginning to end. Chapters are not self-contained and often rely on information explained earlier in the guide, so it’s not recommended to skip anything. The only exception to this is the appendix chapters that can be found at the end—they contain additional information that may be referenced throughout the guide, so you may familiarize yourself with the contents of those chapters as needed.

🔶 CHOOSE YOUR PATH 🔶

Table of Contents

  1. Where to start

  2. Defining ZScript classes

  3. Why ZScript?

  4. Classes instead of actors

  5. How to see your classes in the game

  6. Anonymous functions

  7. Variables and data types

  8. Pointers and casting

  9. Custom functions and function types

  10. Virtual Functions

  11. Event Handlers

  12. Player, PlayerInfo and PlayerPawn

  13. Inventory

  14. Weapons, PSprite and overlays

  15. Arrays and linked lists

  16. Constants

  17. HUD

Appendix chapters