DevGioh Card Game Rules Engine

Back in the spring semester of my freshman year, a project I made for a course was a trading card game called DevGioh (an unoriginal name parody of Yugioh). When starting to design the program with my group, I began to realize that a lot of the functionality we would need to implement for the game could be abstracted to create a rules engine for any trading card game. Seeking to create a rugged rules engine that could support a variety of card effects similar to those in Magic: The Gathering or Yugioh, I spent several weeks designing a general framework for both saving game state of card games and for providing an easy interface to create game rules with. This framework would become the lazily-named DevGioh Rules Engine (github.com).

A card game about penguins built onto of the rules engine.
A card game about penguins built onto of the rules engine.

The DevGioh Rules Engine is a system for managing rules calculations in card games, such that a card game developer won’t need to worry about programming game state recording for rules calculations, or scheduling card effects.

In its current state, the engine is fairly simple. Its main functionality allows a game designer to construct cards and rules effects by composition of smaller conditions and effects. For example, there is a Zombie effect in the DevGioh game, which allows a creature to return to the battlefield upon dying for the first time. The rules engine handles all the specifics of storing game state and provides an interface for the effect’s code to easily specify behavior. A zombie effect instance is composed of a return-to-battlefield effect which is connected to multiple conditional requirements (to check if it has just died for the first time since being played).

The structure of how the engine assembles rules effects, players, and cards is meant to be very open-ended. The engine consists of game components which can be independently modified to change engine operation. The current component set was designed to allow a lot of freedom to develop creative card effects. For example, the current turn iteration system allows for rules phases (sequences of rules actions that the game itself defines, e.g. Draw cards at the beginning of your turn) to be added dynamically at runtime (a card could, upon damaging an enemy player, grant you another combat phase).

For more information on the design patterns we used to create the engine, please check out this google slides presentation:

DevGioh Game and Rules Engine Presentation

As this was a project from my freshman year of college, the algorithms and data structures behind the scenes of state storage and rules calculations aren’t optimized, and a former lack of experience with technical features of Java such as generics has resulted in the engine design feeling a bit bloated in places. Since writing this engine, I have not seen or heard of much need for a Java-based card game rules engine. As such, I have not changed the code much at all since I initially wrote it. However, there will always a constant voice in the back of my head telling me to go back and javadoc this old project (A project for a rainy weekend).