Two major aspects of Oolite are driven by random numbers:
- The default populator and customizations of it like Skilled NPCs, Deep Space Pirates, ...
- Market prices and quantities.
Randomness in games has several roles:
- Give you a chance when you are in a dire situation, or transform a normal situation into a challenge,
- Introduce variety without using complex computations and by extension to simulate complexity (this results from Kolmogorov's randomness and complexity: a piece of data is said random if the shortest program that can generate it is larger than the data itself, and the complexity of a piece of data can be measured by the length of the shortest program that can generate it).
Default Oolite scripts and OXPs often use system properties as probability weights or even directly. However, the government type/economy type/Tech level trinity is very often used, because those properties are what one sees on the galactic charts.
There are two issues with this:
- Systems "lack personality": Xexedi is not a nice system because it's Xexedi, but because it's a high tech rich industrial corporate system. Other high tech rich industrial corporate systems will look
mostly like Xexedi because OXPs introduce features using the same deterministic criteria everywhere. Also, because many OXPs add features using a similar logic, rich high TL tend to be overcrowded and poor low TL systems tend to be deserts.
- Whenever randomness is used, neither OXPs nor players can make smart choices. A side effect is that randomness cannot be too random because it would be too arbitrary and/or very hard to deal with, so we end up with the infamous computer-fur trade and with dead Jamesons in Cobra III ships who did nothing very wrong.
Oolite's scripting interface has a function that allows to avoid those issues: pseudoRandomNumber()
. This function takes a "meaningless" number and returns a random constant for a given system. This function can be understood as providing additional properties to the system; writing something like average_planet_temp=pseudoRandomNumber(0)*20
would completely make sense. I'd like to promote its use by showing an example where it shines.
Deterministic markets. Commodity prices can be computed with a simple deterministic formula. For instance (1+ sin t)*universal_average_price
, where t
is the in-game time. It looks uninteresting at first because it would make prices the same everywhere at a given time. However, because it depends on time and because it takes time to travel from system to system, what players see is prices that vary randomly, at least at first. I think it won't take long before they figure out how it works and how to use that knowledge to plan their moves and maximize their profits reliably, though.
One can make it a little bit more complex by introducing system-specific constants like the period, phase or magnitude of the oscillations with pseudoRandomNumber()
. One can still use something like economy type to offset a bit the universal_average_price and some easy predictability for the player, but one should also throw a pseudoRandomNumber()
in the mix to give each system its own flavor.
With about a dozen of commodities and both prices and quantities for each to compute, the TL/GT/ET trinity won't provide enough "entropy" anyway, so pseudoRandomNumber()
is almost mandatory. So we can have simple formulas with hidden constants that yield numbers that look more-or-less random but aren't. Different methods, same results?
One thing that determinism allow, for instance, is "multiplay". One can play with two (or more) commanders: one two scoot ahead prices (and other deterministic system features like the skill level of the local pirates; it only takes a little script that changes a variable of Skilled NPCs), and one to actually trade. This requires to keep both commanders in the same in-game time window, so one can hardly call it a cheat or an exploit.
A second opportunity one can think of is to turn annoying masslocking NPC traders into valuable sources of information, with OXPs like Broadcast Comms. This is possible only because other OXPs can query the prices and quantities for any past (and future) time, any system and any commodity. This goes beyond the current "I've heard there's good price at Xexedi", which the players can easily figure out themselves. Alternatively, it can translates into an MFD displaying the current prices in nearby systems. That could be a solution to boredom on the lanes.
are two different things because complexity can make a deterministic system difficult to predict to the point it looks random. Complexity in turn doesn't mean complex programming; it can result from many simple interactions. This phenomenon is known as emergence
. Although a sufficiently complex deterministic system and a weighed random system can look the same, as far as video games are concerned, the deterministic approach is more interesting because providing tools to help players with the complexities of the game is more valuable than providing tools to shield players from the unfairness of a random generator.