The Wargame Engine Behind Barren Planet
Saturday, 10th April 2021
Barren Planet is based on two libraries. One is CGALIB, the graphics library used by my existing game, Ossuary. The other, CWG, provides the basic game rule mechanics behind Barren Planet and, hopefully, future games too. I want to talk about CWG in this post.
CWG controls the battlefield. It defines the unit types that will be present in the battlefield, and the terrain types that will be present on the map. It holds the map itself, and a list of units currently fighting. When instructed, it can move units around the map, cause them to fire at one another, and amend or destroy units according to the outcome of each attack. It can also be instructed to build units and repair units if there are suitable support units on the map.
CWG doesn't have any knowledge or interest in graphical representation or user interface. It doesn't currently have any AI, although I hope to add some AI in the future. It won't concern itself with anything on the strategic level outside the battlefield, like how we got here or from where the players got the resources to build and repair the units. It is there purely to handle the internal representation of the battlefield during the course of a game.
Barren Planet is the first game that will provide a home for this library. Barren Planet will provide the setting and define the unit and terrain types. It will provide a means to link one battle to another. Barren Planet does this with a story line that branches according to the outcome of each battle. But these mechanics are left to the host game, another game based on CWG might instead provide a strategic level map where the players choose which points to attack or defend, or maybe a Risk-style map with regions where military units are positioned and stationed.
CWG is largely finished, although the development of Barren Planet is exposing bugs and oversights that need to be fixed before the library is offered for general download. The question of how much AI will be implemented in CWG, and how much will be left to the host game, is still open. So CWG will probably be made available at the same time as Barren Planet. Keep an eye out here for further developments.