Rolling Dice

Between working on Galactic Impact the first time in the late 20-aughts and today, I’ve done a lot more board gaming than video gaming, and that’s also where the bulk of my ‘game design’ brain has been. Comparing that world with video games is an interesting exercise, especially because there’s a lot of conversation about “app integrations” on the board game front these days.

This all came to mind as I was dove in to rebuilding “population growth” for Player’s “Worlds” in Galactic Impact. In the old version I did a blanket percentage growth calculation — for example, if the target was 1% growth, multiply the population by 1.01, save that as a the new population and call it a day. Got the job done, but was completely deterministic, which is somewhat unrealistic for population growth. (Also unrealistic when using that same calculation to determine the numbrer of deaths on account of hostile atmospheres).

Board games use dice as a primary way to generate random values, so I wondered if something similar would be feasible here, on a larger scale. For a lark, I tapped out one of Ruby’s shorthands for generating a whole slew of random numbers. Specifically, 100 values between 1 and 100:

Array.new(100) { rand(1..100) }

This spat out a nice looking list of numbers, but I was worried about how sustainable this would be for larger volumes of values. I checked the current US Population growth rate (0.6%) and used that as a baseline, but converted it to “permille“, so I would have a whole number (6) to work with, then took a look at the size of Ships I had created, to see what kind of population a new Outworld might have during its first update phase. A mid-size ship was 2500 people, so I ran the following:

Array.new(2500) {rand(0..999)}

This is a little bit (a lot bit) like rolling a 1000-sided die for each ‘person’ on the planet. If we decided that the permille growth is “6”, we can increase population for every ‘person’ who rolled a 994 (1000-6) or higher. Also easy to pull the deaths with this, if we say the “death rate” on a planet with no atmosphere (like the moon) is 7‰, any ‘person’ who rolled less than 7 is killed off. No longer deterministic! At some point, the law of averages will mush all these outcomes together, so if there are performance issues at higher population counts, I can address that, but I did some quick benchmarking and this method is (I think) fast enough in Ruby up to at least 1 million die rolls… in tabletop terms: 1,000,000d1000!

Now I’m left trying to picture what that would look like to roll a million dice at once on Board Game Night ????

Leave a Comment

Your email address will not be published. Required fields are marked *