Pack The Court

Itch.IO
Published on:

You've been elected president of the kingdom! Now, along with your Wizard of Judicial Affairs, you'll need to help your court tackle each slate of "cases": mythical beasts spawned from the worries of your citizens. The better you tailor the makeup of your court to the desires of the populace, the better you'll score at besting these monsters. And, after each slate of beasts, you'll unlock new spells and, of course, seats with which to PACK THE COURT!

Developed with: Unity, C#, Github Version Control

Development time: 3 weeks

Team size: 4 people (hybrid)

As a submission to the 2024 Civic Engagement game jam, our goal for the game was to highlight the institutional obstacles and incentives that block justice system reform in the United States. To accomplish this, we designed the game around a core dilemma: the player’s initial characters are poorly equipped to solve late-game challenges. With this in place, we provided the player with a tempting set of morally questionable abilities (e.g. bribes) that present an easy solution. The end result puts the player in the position of a politician incentivized toward problematic behavior by long-lasting institutional issues. For presenting this issue in an approachable and engaging way, Pack the Court! won the Civic Engagement jam.

Code Sample - Generating Charts

Each monster has a color, which is compared against the armor color of each member of the player's party. Given the court grows to over a hundred justices by the end of the game, we needed to provide players an easy way of visualizing their perforamnce. With this in mind, I set about creating a bar chart that updates in real time for each round.

See it in action

To start with, we split up the justices into three tiers based on how closely their armor color matches the color of the monster (eg. red is a good match to red, a partial match to orange, and a poor match to blue). We count how many justices fall into each tier and pass those values into the following function:

//this function is called to draw the bar chart
//we pass in three dictionaries. each dictionary entry represents a color paired with the number of judges who match that color
//the three dictionaries - best, OK, and bad - refer to the colors that fully match the current enemy (best), partially match (OK), and don't match at all (bad)
public void SetValues(Dictionary<SColor,int> bestCount, Dictionary<SColor, int> okCount, Dictionary<SColor, int> badCount)
{
//reset the bar chart from its previous state
ClearSegments();
cumulativeLeftEdges = 0;
totalWidth = GetComponent<RectTransform>().sizeDelta.x;
//calculate the total number of judges (and their colors) being considered
int numOfColors = dictionarySum(bestCount) + dictionarySum(okCount) + dictionarySum(badCount);
//draw each bar chart section
DrawSection(bestSection, bestCount, numOfColors);
DrawSection(okSection, okCount, numOfColors);
DrawSection(badSection, badCount, numOfColors);
}
void DrawSection(BarSection section, Dictionary<SColor,int> colorCounts, int numOfColors)
{
//find what percentage of judges are in this tier (best, OK, or bad)
float percentage = dictionarySum(colorCounts) / (float)numOfColors;
//calculate the size and position of this section
sectionWidth = totalWidth * percentage;
float leftEdge = cumulativeLeftEdges + (sectionWidth/2f);
//set the size and position of the UI object itself
section.SetValues(colorCounts, sectionWidth, leftEdge);
//each section needs to be drawn directly next to the previous section, so we add this section's width for the next go around
cumulativeLeftEdges += (sectionWidth);
}

Since our game was designed for browsers, performance was a big concern during development. To avoid re-doing the same calculations, the values from this function are re-used to draw a pie chart elsewhere in the game representing these same values - and that pie chart is itself sampled as the texture for a shader proportionally representing the colors of the justices' armor in the form of a crystal ball.