You are not logged in.
Pages: 1
I've been using this code (found it on github I believe) for dungeon generation in my game Glory Borne.
Awesome! Love that solution both aesthetically and functionally over the others.
///next_pow2(val);
return power(2,clamp((ceil(log2(argument0))),1,100000000000000000000));
I know this script already exists here but this one is about 3x as fast as the old one below.
/// next_pow2(n)
//
// Returns the next power-of-two greater than or equal to a given value.
//
// n positive integer
//
/// GMLscripts.com/license
{
var n = argument0 - 1;
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
n |= (n >> 8);
n |= (n >> 16);
n |= (n >> 32);
return n + 1;
}
///dlerp(va1,val2,amount,dt);
return lerp(argument0,argument1,1-power(1-argument2,argument3));
//Where dt (delta_time*0.000001*TargetFramerate) is equal to "1" when fps == steps per second.
Pages: 1