Algorithm H*lp & Disscussion

Hello,

I come in peace, with a question, and with a useful algorithm. Being a ‘cuber’ I love to use the word algorithm, but anyway I am making a minecraft clone, and need to stop rendering blocks after i amount of blocks (constant used throughout thread).

I already have one to only render blocks i from player:


    // Absolute value, hopefully you can code this!
    if(abs(xp) - abs(xc)) >= i){
        // render.
    }

Now xp = players X position and xc is the chunk (16x16) x-loop counter.

Can someone help me with the one to return false if xp is 3 xc away? I’ve tried, but my brain is broken :o

Thanks!

PS: Feel free to use that alg :slight_smile: