Spotting use cases for the Event Queue pattern
As we saw in the previous section, there are numerous examples of the Event Queue pattern in game systems. Since it is a versatile pattern that allows us to create abstract queues of events, where events can be anything in our game, the usage of this pattern becomes clouded by its potential. In this section, we will see some concrete use cases so things become clearer for us. Maybe one of the following examples is exactly what you are looking for in your next project!
The Event Queue pattern plays a core role in games like turn-based strategy titles by making sure that turn resolution happens in a predictable order. When players in a strategy games issue commands such as moving units or attacking, these actions trigger a series of events such as animations and sub-events that occur as a consequence of these main actions. This provides a clear structure for players’ strategies, allowing the game to resolve each event step by step...