Make Your Games Expandable WIth Command Pattern

Published: 15 July 2024
on channel: Freedom Coding
972
49

Command pattern will help you to make your games more expandable, separate your code into multiple pieces, and allow you to queue up commands, undo or redo them if you need to. This pattern consists of 5 elements. First is the client that creates the commands. Second is the invoker which executes the commands. Third is the command itself which can be an interface from which all the commands inherit. Fourth is the concrete command, such as move, run, attack, and so on. The fifth one is the receiver which gets called from the concrete command and contains all the logic. The command pattern is widely used in all kinds of games and apps. Today, I will teach you how to use it with Unity and C# on a simple example of a turn-based game.

Project Files - https://github.com/Freedom-Coding/Des...

👍 Like and 🔔Subscribe for More Unity and C# Tutorials    / @freedomcoding  

🌟 Support My Work and Unlock Exclusive Content! 🌟
👉 Patreon:   / freedomcoding  

🎮 Join Our Developer Community!
💬 Discord:   / discord  

💖 Support Me Financially
☕ PayPal, Revolut: marek.freedom.coding@gmail.com

Website - https://www.freedom-coding.com

Timestamps:
00:00 Intro
00:18 What Is Command Pattern?
00:46 Understanding Command Pattern
02:35 Client (player inputs)
03:00 Command (interface)
03:29 Concrete Command (move)
04:20 Invoker (command manager)
06:30 Receiver (player mover)
08:42 Code Overview
09:48 Testing
10:34 Adding More Commands
11:51 Conclusion


On this page of the site you can watch the video online Make Your Games Expandable WIth Command Pattern with a duration of hours minute second in good quality, which was uploaded by the user Freedom Coding 15 July 2024, share the link with friends and acquaintances, this video has already been watched 972 times on youtube and it was liked by 49 viewers. Enjoy your viewing!