State

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

State

We call the state of a program a snapshot of all the data loaded in the computer's memory that belongs to the program. It's the sum of all the values assigned to all the variables in the program.

It can also mean a group of variables; for example, the "player's state" is the group of all variables that describe the player's position, health, and so on.

NOTE:

In the context of a Finite State Machine, a state is a specific condition or situation in which a system can be.

Imagine a very simple program with a single variable that never changes its value. The program's state is always a single piece of data, 1.

var initial_value := 1

Let's add a line that changes the value of the variable. At the beginning, the state is 1, but after the _ready() function is executed, it becomes 2.

var initial_value := 1

func _ready() -> void:
    initial_value = 2

In a real program, the state is much more complex. In a Godot game, there may be hundreds or thousands of nodes, each with dozens of properties like their position, rotation, material, and so on.

A snapshot of all those values at a given point in time is the game's state at that time. A part of this could be written to disk; we refer to this as serializable state.

Become an Indie Gamedev with GDQuest!

Don't stop here. Step-by-step tutorials are fun but they only take you so far.

Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!