1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Script Changes for Next Build

Discussion in 'Announcements' started by DevBlogger, Sep 17, 2013.

  1. DevBlogger

    DevBlogger KAG DevBlog Feed Bot

    Messages:
    136
    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.

    Max/Geti

    Original DevBlog post.
     
    Beepo, Gurin, Ramsis and 7 others like this.
  2. Iamaclay

    Iamaclay Shark Slayer

    Messages:
    148
    Thanks for being upfront :thumbs_up:
     
  3. Boea

    Boea Such Beta

    Messages:
    653
    So you learned from Data's mistake of honestly not giving a fuck.