4

Around the year 1990, I played the game Empire on a VAX/VMS system. It was a turn-based, text-based-map wargame that later inspired Civilization and Xconq.

What was particularly memorable about this game was how predictable its random number generator was. If I performed a series of attacks during my turn, there was a certain pattern to which ones would succeed or fail. The pattern was a repeating cycle of maybe 8 to 20 attacks. After discovering the pattern, I planned my attacks for each turn, making sure I had sacrificial units for the attacks that were bound to fail. I could easily defeat the computer, which apparently did not have my insight.

What algorithm did Empire use to determine the outcome of attacks? Was it simply a linear congruential RNG (or the least significant bits thereof)? Something worse? How often would it produce a repeating pattern?


Related:

3
  • If you used it on VAX VMS can you update Wikipedia to say it's one of the platforms? Feb 27, 2021 at 8:02
  • @OmarL: The Wikipedia article already mentions VMS in the "History and Development" section.
    – DrSheldon
    Feb 27, 2021 at 9:55
  • Apparently there are quite a few VMS empire versions (the original Fortran, a C port, a rewritten C port), and they might use different ways of randomness, so it might help if you can remember which version it was.
    – dirkt
    Feb 27, 2021 at 18:52

2 Answers 2

5

From the DECUS VMS Fortran source, the random routine RND() is as follows:

    FUNCTION RND(IHIGH)
C
    IMPLICIT INTEGER(A-Z)
    INTEGER*2 TIME(4)
    EQUIVALENCE (TIME(2),SEED)
    REAL MTH$RANDOM
    DATA SEED/0/
    IF (SEED.EQ.0) CALL SYS$GETTIM(TIME)
    RND=IFIX(MTH$RANDOM(SEED)*IHIGH)
    END

According to David Deley's How Computers Generate Random Numbers, MTH$RANDOM is a linear congruential RNG defined as:

SEED = (69069*SEED + 1) mod 2**32
X = SEED/2**32

A brief look through the code suggests that the computer's 'random' decisions might be far less random than one might hope, and seem mostly to be based on munged values of the existing game state. But this is merely a first impression of over 5000 lines of Vax Fortran code.

1
  • 1
    I guessed MTH$RANDOM as the obvious (to a former VMS programmer) answer to the actual generator. But that in itself doesn't seem sufficient to explain the limited attack repertoire. Perhaps your "first impression" answers that. Feb 27, 2021 at 17:04
0

1990? Are you sure it wasn't 1980? The game you describe sounds a lot more like those from the start of the 80s rather than the end. 😂

Regardless, according to the ever reliable Wiki, there were only 10 main random number generators around at the time:

https://en.wikipedia.org/wiki/List_of_random_number_generators

If we go back to 1980, that goes down to 5.

I suspect most systems of that era were using variations of Lehmer or LFS generators. But it sounds like that game had a particularly bad implementation if you could predict it like that.

My best theory is that it did stuff like add two or more random "dice rolls", much like popular tabletop RPGs of the time. This severely alters the probability into a much more predictable bell-curve and most likely explains the effect you experienced.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .