You may have noticed from the last couple of articles that I have an interest in both role-playing games and programming. I am taking a quick break from writing code for the Connexions RPG, which is primarily intended to played around a table or in your living room, to mention why the two things (designing Connexions and writing code) go very well together.
One obvious reason is the goal to allow you to play the game how you want to play it. Writing code that implements the Connexions base rules and models elements means that it can be reused to create either an online table for the game, or possibly a full CRPG down the road.
But that is not why I am doing it at the moment…
My primary focus when I started writing code was to have the ability to rapidly test numbers thousands of times, tweaking the values for cases that I thought would apply during the game. For example, one of my unit tests simply runs a variety of Mechanics across all the Difficulties for sample characters of varying abilities. This allows me to see how often someone of a particular ability level succeeds at a task of some type with all the different ways to determine results.
For example, I decide to create a dice-pool based mechanic, and I don’t know what type of dice, how many based on what character elements, or what is “good” and what is “bad” when rolling. I can quickly extend my Mechanic class, drop in the rules I think will work, attach it to my unit test, and have 10,000 results waiting for me in seconds.
There is an additional benefit to modelling the game in code – it helps map out the interconnectedness of the rules. Since I am using an object oriented language, I have to think about (and some programmers will recognize these statements) “what is-a character?”, “a character has-a characteristic” along with even more basic “do I have all the steps outlined to do X”. Computers generally only do what you tell them. If I cannot run a simulation in a computer, I am missing some detail as to how it is supposed to work.
For example, a player wants to have their character walk a high wire on a very windy day. The computer model forces us to ask some specific questions. First, how good is the character at walking a tightrope? What characteristics do we need to determine that? Second, how does walking a high wire compare with other tasks? If it is harder than some, but easier than others, how do the rules address that? Third, what is the impact of the wind on the attempt? How do you model the “makes it harder”? Do you penalize the character’s abilities? Do you reduce the results?
Ultimately, you need to answer “how do the answers above impact the other decisions?” A computer model, with unit and regression tests, allows you to play with those answers fearlessly.
Okay, break over! Back to work on the Connexions RPG.
Latest posts by Larry (see all)
- Warframe Missions: Part 2 – Other Inner Planet Missions - December 22, 2015
- Review: Assassin’s Creed Black Flag - November 22, 2015
- Warframe Missions: Part 1 – the Basic Missions - November 19, 2015