January 2025
Intermediate to advanced
304 pages
8h 28m
English
In games, many classes use a single class to perform common procedures. This is known as a service class. For instance, in Godot Engine, we have the Input class, a singleton that offers services related to input that any class can access. Another example is the Engine class, which provides data about the very engine itself to any class interested in knowing it; the Engine class is also a singleton. When we have singletons that provide services, especially if these services are provided through layers of indirection to other classes, we call them service locators. Well, this is not precisely what a service locator is, but it’s a way of understanding its purpose.
In this chapter, we ...
Read now
Unlock full access