Graphical Visualization as a Gamer's Tool
One interesting problem I’ve occasionally encountered when doing stuff for various games is visualizing the paths through the game. The simplest one would be the path from one adventure to another for a party. A more complicated one would be an entire campaign with various adventures broken down by either level or some other gauge of experience for the game system. One good example of the latter was posted to the Triple Ace Games site about the game setting Sundered Skies (a Savage Worlds setting). This graph was laid out in something like Visio by hand. Each of the adventures was clustered and linked to the next adventure in the series or Plot Point. Another example is from the Warhammer Fantasy RPG (before Fantasy Flight Games) where each Career could only go to a select few other careers. Rather than flipping back and forth through the several hundred page Career Compendium to try and find the path from a starting career to the desired advanced career I found a program called GraphViz. GraphViz has a subprogram called Dot. Dot reads in a “dot” file that describes a series of graphs, nodes and edges to generate an output file. What Dot tries to do is lay out the various nodes to minimize edges crossing each other. A simple dot file would look like the following:
digraph G { a1 -> a2 -> b2; a2 -> c2; }
a1, a2, b2, and c2 are all nodes. A1 points to a2. A2 points to both b2 and c2. These pointers are edges. Another nice property of the Dot language, if you define a node type or an edge type and then create nodes or edges, they inherit the properties of the nearest declarations that apply. This is similar to how CSS works for html. So, setting the edge color to red
digraph G { edge [color = red]; a1 -> b2; a1 -> a2 -> a3; edge [color = black]; b2 -> c1; edge [style = dotted]; c1 -> a1; }
Before declaring the edge will cause the edge to also be in that style. Notice that the edge from c1 to a1 is both black and dotted. In the case of the Career Compendium, each career was a node. Each connection from that career to the other careers that a player could go to from it was an edge. I was grateful that the PDF of the career index made it easy to strip out the careers and their paths with a little PERL know-how. The only problem with the graph that Dot created from the "dot" file was that to print it out with the font still readable for the various careers would have required a poster about 25' x 14'. At the time I didn’t have that much familiarity with the "language" to help reorganize and cluster the various Careers and I was just plotting the raw information that my very basic PERL script was setting up from the PDF data. We ended up only playing the campaign for a short amount of time before moving on to a new set of adventures. The next, short-lived campaign was also in the Warhammer Fantasy world. This time the setting was on the far continent of Lustria. This added the lizardmen from the Warhammer Fantasy setting along with their career paths. Since these career paths were specific to each type of lizard, it was far easier to graph the mappings. The largest collection of careers was the Skink’s, but even with all of them in a single graph the result was a much more manageable picture. Lizardman Careers Dot file This creates a 2500 x 1900 image with all the careers for the various lizards. The nice thing about doing this is that it showed there were some problems in the career files like incorrect career names in some of the others as well as careers showing entries from others but those careers not having an exit listed out to the former career. e.g. Thug said that it had an entry from Warrior, but Warrior didn’t list Thug as an exit. Lizardman Careers PNGOriginally each map was created as a standalone file, but with a bit more learning they could be created together in one map. Changing the colors of the edges for each type of lizard allows the tracks to be followed more easily while all being on one map with some of the lizards sharing careers. The next usage came up just recently. We’re doing a campaign in the Battletech system. Starting in the year 3050, the Clan Invasions, and going forward we’re playing small squads (a Lance vs. a Star in most fights) in the larger war. Overall our fights won’t have any effect on the larger events of the Invasion. The campaign is composed of two types of battles, Missions and Touchpoints. Missions are generic battles that just occur somewhere in the overall Invasion. Touchpoints are missions that can only be selected once each and take place in a specified time point of the Invasion. The winner of a match is the one that chooses the next fight that is to occur. The interesting challenge in creating this graph was in how to track the information that occurred for each side (XP gained, pilots killed, mechs destroyed, etc…). Graphviz allows the incorporation of basic HTML into the graphs. To do so you create a node that is of type plaintext
digraph G { node [shape=plaintext]; }
From this one can create a node and use the label to fill it with html
digraph G { node [shape=plaintext]; mission1 [label = < <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR> <TD COLSPAN="3" PORT="name">Mission: Recon</TD> </TR> <TR> <TD BGCOLOR="blue" PORT="is">House Steiner</TD> <TD></TD> <TD BGCOLOR="red" PORT="c">Clan Wolf</TD> </TR> </TABLE> > ]; }
The "PORT=" section in the table creates a place in the graph that edges can either link to or from when going from one node to another. To link a node from a port or to a port can be done like
digraph G { node [shape=plaintext]; mission1 [label = < <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR> <TD COLSPAN="3" PORT="name">Mission: Recon</TD> </TR> <TR> <TD BGCOLOR="blue" PORT="is">House Steiner</TD> <TD></TD> <TD BGCOLOR="red" PORT="c">Clan Wolf</TD> </TR> </TABLE> > ]; mission1:is -> mission2; mission2 -> mission1:c; }
I use the ports to connect from the winner of one battle to the next chosen mission to keep track of who won and therefore who chooses the next mission track. The big problem with the graph was that I couldn’t keep all the mission types and their paths in the graph as it was just too busy with too many edges having to cross each other or merge to meet up at certain nodes. So, while the main dot file does list all the various missions, I only put in the links for the upcoming tracks. On either side of the completed tracks are the results for each side. Objectives obtained, points spent to get into the mission, cost of resupply or repair of mechs from that fight, etc... Battletech Tournament Tree Dot File Battletech Tournament Tree PNG If this was going to be a longer lasting campaign or had more teams/sides involved in the battles I would probably write a small program to ease maintenance of the dot file and tracking of the overall campaign.