Designing a card game has honestly called on more of my programmer skills than thinking about video games. Card games are surprisingly a lot like enterprise web applications. Cards go through lifecycles and have callback functions and methods similar to an object going through its lifecycle in any enterprise application.
Lifecycle Hooks & Callback Functions
Objects in an enterprise software application, such as components in Angular or React, go through a lifecycle as they are instantiated, go through state changes, and are eventually destroyed. Each of these has a “lifecycle hook”, which is a function that is called when that particular lifecycle event happens.
In card game terms, these are similar to effects that trigger when a card enters the battlefield, leaves the battlefield, is tapped, or attacks or blocks. Trigger conditions are lifecycle hooks for cards.

A callback function is one that triggers when another object goes through some type of change. It’s subscribing to another object’s state, then doing something when that object does something.
Continue reading









