The Command Pattern: Coding Undo/Redo | Game Engine Concepts #3 @GamesWithGabe
The Command Pattern: Coding Undo/Redo | Game Engine Concepts #3  @GamesWithGabe
Uploaded September 2020 | Updated September 2026, 3 weeks ago
Join the Discord: discord.gg/4tHeAkxNg7

In this episode I explain what the Command Pattern is and how you can use it. Before I explain what the Command Pattern is I explain what a design pattern is and reference the Gang of Four's original book, Design Patterns. After that, I explain that the Command Pattern is simply a wrapper around executing commands. I then illustrate how this can be used in conjunction with a Command History object to create an undo/redo system, record gameplay sessions, and create instant replays. I describe in detail how you might code this, then I show an actual example that I use in my code to implement undo/redo system.

The Command Pattern: gameprogrammingpatterns.com/command.html
Gang of Four Book: amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional-ebook/dp/B000SEIBB8
Command Code Example: github.com/ambrosiogabe/Cocoa/tree/master/CocoaEngine/include/cocoa/commands
Command History Code Example: github.com/ambrosiogabe/Cocoa/blob/master/CocoaEngine/cpp/cocoa/commands/CommandHistory.cpp

0:00 Intro
0:31 What is a Programming Pattern?
1:39 What is the Command Pattern?
13:39 What does the Code Look Like?

---------------------------------------------------------------------
Website: ambrosiogabe.github.io
Github: github.com/ambrosiogabe

Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)

My Recommended Game Engine Books:
Game Engine Architecture: gameenginebook.com
Game Physics Cookbook (Read this before the next physics book): amazon.com/Game-Physics-Cookbook-Gabor-Szauer/dp/1787123669
Game Physics (Ian Millington): amazon.com/Game-Physics-Engine-Development-Commercial-Grade/dp/0123819768
Game Programming Patterns (Free): gameprogrammingpatterns.com

My Recommended Beginning Game Programming Books:
JavaScript Game Design: apress.com/gp/book/9781430247166

My Recommended Java Books:
Data Structures/Algorithms: amazon.com/Data-Structures-Algorithms-Java-6th-ebook/dp/B00JDRQF8C
LWJGL (Free, but I haven't read this thoroughly): lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content

Outro Music: bensound.com/royalty-free-music
The Command Pattern: Coding Undo/Redo | Game Engine Concepts #3Scene Panel Drag & Drop (ImGui) | Coding a 2D Game Engine in Java #43Pointers in 16 Minutes | C++ For Java Devs Ep. 8Linking and Header Files  | C++ For Java Devs Ep. 3Maintenance | Coding Geometry Dash in Java #10How to Use Box2D Physics | Coding a 2D Game Engine in Java #48Switching Languages | Cocoa Engine Devlog #2How Shaders Work (in OpenGL) | How to Code Minecraft Ep. 3Translate and Scale Gizmo | Coding a 2D Game Engine in Java #35Moving the Snake | Java Snake Part 6Spritesheets | Coding Geometry Dash in Java #6Bubble Sort | Python for Absolute Beginners #11
GamesWithGabe |

The Command Pattern: Coding Undo/Redo | Game Engine Concepts #3

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER