Mathematical functions to load world around player?

So I slightly modified it myself and its ok for now