Spotting use cases for the Command pattern
We just saw the potential usefulness of the Command pattern, but outside of the abstract talks, how can it actually help us? In this section, we will see some real-world use cases for the Command pattern, especially related to games and game development.
Using commands such as undo/redo in level editors
Imagine that you have a level designer in your team and they don’t like to use the Godot Engine’s editor to design and manage levels. They ask you instead to create a custom editor or tool to help them design their levels. You create a very nice tool with the ability to create terrains, position objects, quickly scale them up and down or randomly, a grid-based design tool to create buildings, and more. The level designer goes ahead and tries to make some levels.
But they suddenly notice they can’t undo or redo their actions in the level design tool. Since design implies a lot of experimentation, and thus, testing...