Script Changes for Next Build

We’ve been promising ourselves to be more forthcoming about changes like this before a release is out, since although modding is not officially supported, we can appreciate that those who have already undertaken some work would prefer that not to break :^)

Big Changes that might break mods next build:

  • Random(range) as a global function is removed, use XORRandom(range) instead.
  • There is no direct equivalent of Random(seed, val) any more – for the simple reason that such a function doesn’t really make sense anyway. Create a random object with your seed and call NextRanged() on it.
  • Random(seed) creates a RNG object, use Next(), NextRanged(range) and NextFloat() to get values out of it
  • Noise(seed) creates a 2d noise map, use Sample(x,y) or Sample(vec) and Fractal(x,y) and Fractal(vec) to get values out of it. Values for the noise map are between zero and one, we’re considering allowing specifying the range in constructor.

Hopefully the change is worth it, Random objects like this allow much more stable generation of values, you can have a random generator for each tree or all the trees on the map, instead of sharing the state between every object in the game, and between play sessions. Overall this should allow us to make map generators where the seed actually matters, which is pretty important :^)

As a side note, this has lead to changes in a very large many of the vanilla scripts, some 57 individual scripts were affected, most of them in multiple places, producing over 500 lines of compiler error spew – please understand that for any change that breaks the interface, we very likely have to make more code changes than the entire modding community combined – we always have a rationale for making changes that break the interface, and we’ll try to explain them as best we can as we make them in the future – ideally giving you a few days notice if we can.


Leave a comment

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

Social Media

Stay up-to-date with our latest news - make sure to follow us on Social Media!