Shoot for the Stars Devlog 28: Task Manager
Upon making some steady progress with the combat system of Shoot for the Stars, we’ve decided to share some of the inner workings of this section of the game with you.
All automated actions that occur during battle are dictated through an event system deemed the “Task Manager” object. Unlike a standard event system where objects subscribe to an event and events are distributed to every object subscribed to it, we instead are sending special events called tasks that contain targets for the events to act on. This allows us to accommodate the target-based nature of the card game, and make sure only the intended objects receive the results of each individual task.
The “Task Manager” not only is in charge of making sure objects receive their tasks, but also controls timing of these events. To guarantee order of effect as well as making the game flow in a coherent way for the player, the “Task Manager” also waits for all targets of the latest task to complete that task before allowing execution of the next task in its queue.
Beyond just executing the various actions a card effect may be capable of, it’s also imperative that cards be able to check the conditions for activation of those effects. To that end we have also created a condition tracker object. The condition tracker itself is a fairly simple object, containing a list of all conditions currently met that is appended to each time any sort of action occurs. Once a special task is sent to the “Task Manager” for check timing, all card objects will check their effects for condition activation from the condition tracker. After all cards have been processed, all potentially usable effects will be queued up for activation, and the condition tracker will be cleared.
All visible(and some invisible) objects on the battlefield are encapsulated inside special listener objects for receiving tasks. These listeners know how to parse task data sent to them from the “Task Manager” so every object may act uniquely and independently from each other when receiving tasks. All spaces on the field are an interlinked web of listeners that are aware of their adjacent spaces to aid in quick effect resolution as well as helping the player’s cursor know where to move when scrolling.
That’s all for this week’s look into the machinations of TerraZone: Shoot for the Stars. Next week look forward to sitting in on a class in the TerraZone universe. Until then, make sure to subscribe to our Twitter so you can always stay informed on the latest TerraZone related news and get a heads up on when the next Devlog releases. Have a Happy New Year and see you next week TerraZone fans!