Skip to content

WIP: Full random rework

tertu marybig requested to merge tertu/SRB2:full-random-rework into next
  • There is now one RNG algorithm that supports multiple states. By default, one is used for each of M_Random and P_Random. This is built into SRB2 so there should be now no difference between random number generation on any platform, unlike before. The algorithm used is sfc32, which is proven to both be very fast and very high quality.
  • Each of the SRB2-controlled random number generators are seeded once using a high-quality OS-provided random number source , except on Windows DDraw.
  • RNG calls can now be inlined.
  • RandomKey and RandomRange have been reimplemented in a way that provides uniform output.
  • Lua bindings for the RNG library, allowing Lua scripts to create independent RNG states. This is useful for randomizers and procedural generation.
  • Adjustments have been made in other parts of the engine (demos, network code) to support these changes.
  • A couple things that looked like bugs to me were changed (involving blink probabilities on the title screen).
  • Unrelated change: allow FixedMul and FixedDiv2 to be inlined for NOASM builds, which provides a minor performance boost.
Edited by tertu marybig

Merge request reports

Loading