• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.

Fun with UWPs

Hemdian

SOC-14 1K
Baron
Count
First some theory before we get to code.

One of the features I wanted to build into Universe2 was the ability for system generation to be run when some of the data on a system had already been set. If we just focus on the UWP then we see that there is a fairly complex web of relationships between different UWP digits. If atmosphere, for example, is 6 then we know that the size cannot be zero. Other digits are more complex.

So imagine if the UWP was ??8??A8-F. How would you fill in the missing pieces?

You could just roll the UWP digits in order, restarting if you got an invalid combination (or some variation on this approach). But this is inefficient and could end up rerolling indefinitely.

Here’s an alternative approach:

Let’s look at just one digit for a moment. A straight 2D roll ... or 2d6 to be specific.

Code:
2  3  4  5  6  7
3  4  5  6  7  8
4  5  6  7  8  9
5  6  7  8  9 10
6  7  8  9 10 11
7  8  9 10 11 12

Which we usually think of as...

Code:
Result  Frequency
 2      1
 3      2
 4      3
 5      4
 6      5
 7      6
 8      5
 9      4
10      3
11      2
12      1

But we could get the same frequency distribution if, instead of 2d6, we rolled 1d36 and translated the roll into a result ...

Code:
Roll  Result  Frequency
  01     2    1
02-03    3    2
04-06    4    3
07-10    5    4
11-15    6    5
16-21    7    6
22-26    8    5
27-30    9    4
31-33   10    3
34-35   11    2
  36    12    1



What does that give us? Imagine if on that original 2d6 roll any result of 10 or more, and a 5, was invalid for some reason ... but you wanted to keep the frequencies the same.

Code:
Result  Frequency
2       1
3       2
4       3
...     ...
6       5
7       6
8       5
9       4
...     ...
...     ...
...     ...

You can achieve this with a 1d26 roll. (The size of the dice is the sum of valid roll frequencies. The individual frequencies, as expressed here, remain constant regardless of changes in which are valid.)

Code:
Roll  Result
  01     2
02-03    3
04-06    4
07-11    6
12-17    7
18-22    8
23-26    9


Now extend this concept out to the whole UWP! This may vary slightly from one edition of Traveller to another but in T5 there are 16,926,659,444,736 different rolls yielding 57,957,480 unique UWPs. How do I know this? Because I’ve calculated every one ... and their frequencies. For example D840273-D occurs 15,552 times. I have all of this stored in a MS SQL Server database.

This means that rolling an unconstrained UWP can be thought of as rolling a 1d16,926,659,444,736, arranging the UWPs in order, and counting along until the sum of the frequencies matches the roll. And if you have some preconditions, like it has to be ??8??A8-F, then just select a subset and work with that. (In this case there are 47,371,464 rolls yielding 799 unique UWPs that meet this requirement.)

I used a TSQL script to generate this database. It took about 20 mins to run and I now have an MDF of 6349mb and an LDF of 31167mb (though I might be able to shrink this a bit). The database might be too large to share over the internet but the script to generate it is another matter. Be aware you may need to limit the resources available to MS SQL Server or it could make your machine unstable.

Download script

You can use the resultant table for other purposes too, like analysing UWPs. For example, you can find the highest TL that can be naturally generated and look for common characteristics in those UWP that share it. (Hint: increase population beyond a certain point and you don’t get the highest TL.)

Thoughts, observations, any bugs in the script?
 
I think it might be much more interesting to make some determinations on how systems interact since this is ignored within the rules. That is, how does the UWP of one system affect the systems nearby? I recognize that this is much more complex but it likely would be of great use to have some algorithm that makes some sort of estimate(s).

Maybe start with political, economic, and volume of travelers between them?
 
Wow. I am in awe. That's some pretty deep analysis.

I had the same issue come to mind when writing Starbase, but because I want the application to remain largely rules neutral, and because world generation scripts are arbitrarily editable by users, this kind of analysis wasn't even an option for me.

Not that I'd have had the insight and persistence to actualy do it anyway!

Edit: BTW, are any of the stats in T5 independent of any modifiers, and neither affected by or affecting any other stats? Presumably those are excluded from the database and are either fixed by the user or rolled separately post-hoc? If there are any stats that are 'leaves' on the dependency tree, only affected by other stats but not afecting any themselves, those also might be optimised out of the fixed data and generated afterwards as necessary.

Simon Hibbs
 
Last edited:
Back
Top