Infinite Terrain, noise, spatial jitter, etc

I came across a pretty cool voxel project from alexstv. My first thought was how he handled spatial jitter, so I moved my character out to 100,000 units and… physics died. Twas not handled at all D: I know I can recenter everything around the world origin, but won’t that mess up new chunks that are based on Noise?

How does one generate an infinite world with noise? Minecraft does it, but that is itself a voxel engine so however they handle it may not apply. Can you offset noise so that it continues where you left off after you move back to the world origin? Will that offset , likely an int, eventually overflow?

I see “infinite” being mentioned a lot but there are still either overflow concerns or spatial jitters. How does one use noise rebasing it an infinite number of times? I really want to understand voxels but I’m running into problems with infinity :stuck_out_tongue:

The infinity issue isn’t related to voxels. It’s just Minecraft’s popularity that’s resulted in people commonly wanting to do both together.

This thread (which you’re familiar with already ;)) discusses a number of ways to deal with exceptionally large numbers. Your noise algorithm would of course have to be implemented in such a way that it could correctly work with custom data types and/or with offsets.

A question, though: does your infinite world have to be truly infinite? Existing data types should be able to handle, say, planet sized chunks of data. And if you make it wrap wouldn’t that be close enough to actually being infinite? If not, would adding more “planets” do the trick?

Or, if the definable world size is larger than someone could possibly travel that’s also effectively infinite. So you could solve the issue by restricting movement speed or something like that.

Physics/jitter I’d probably handle with re-centering or a derived solution.

1 Like

Ah, I feared as much. I do appreciate the input, I have a feeling that having chunks wrap around would be the most interesting way to handle it. And then traveling to other planets with different noise seeds would be the StarBound way to handle “infinite”. I’ll probably go along with that approach, but I am saddened haha.

By any chance, do you know if there’s a way to calculate the ‘next value’ of a noise function without giving it any kind of seed? Say I reorigin on the edge of a chunk… could the next chunk’s result be based on the previous run of the simplex noise without actually giving it some kind of datatype that could overflow?

My other alternative might be to have chunks that have some kind of formula that takes the result of the previous chunk to continue some pattern for terrain generation. Noise makes it convenient, but is limited. Chunks that make chunks. Like that movie where that kid throws up and then everyone who sees him throws up.

Since you mentioned that thread, @angrypenguin , I think it would be fitting for my solution to be to force a fake overflow. When the user exceeds some given maximum (several thousand units out, whatever), their next position will be the opposite of that. And now I just realized that the terrain probably will not connect, darn. Well it’s something. Maybe the edges of every planet will just mysteriously be flat :stuck_out_tongue:

“Planets” don’t have to look like actual planets. That’s a presentation issue, which you could handle separately.

I’m considering abandoning noise altogether and going with a more chaotic “chunks generate the next chunk randomly” sort of thing. I don’t care about users being able to share worlds, I just want infinite world gen :smile:

You could always do both. You could generate a chunk where both a previous chunk and a noise or seed are used as input. I’m not mathy enough to know how to do that and not have any repeating or patterns, though.

Not really. You would generate your voxels by calling a noise function where you pass in the int coordinates of what chunk you’re in within an enormous int grid. But then when you get the voxels, you place them at (0,0,0) in Unity, and keep re-centering as the player moves into different chunks. So the player and all your actual objects are always in a small area around 0,0,0 but you’re generating voxels as if they are actually at some arbitrary large value. This way the only thing that needs to do any large number calculations is the voxel generator, which, if you’re smart, is using some kind of Perlin library like libnoise that is designed to handle large numbers well.

Minecraft basically does what I said; chunks based on huge ints but recentering the player as he moves. Yes, the int will eventually overflow, but if you start at chunk zero, you’d overflow only when you walk out 2^31 chunks, and each chunk will probably contain 16 cubes, so you’d need to walk 2^34 (about 30 billion) voxels in one direction, which would take quite a long time. If you were running along at a fast pace of 10 blocks per second, it would take you 95 years.

I don’t think there is a way to literally do infinity, since you wouldn’t be able to ever actually store that much without an infinite hard drive.

Edited: Though if we’re getting really theoretical, you could rig your perlin noise to handle numbers bigger than ints, like 64-bit, or 128-bit, or eventually infinite-bit… as you increase the size of the numbers used for the octaves, you increase the amount of unique noise it can generate.

1 Like

I have a feeling that every input that involves using previous generation or making an offset would still be an int or float, thus the problem is not solved lol

@makeshiftwings thanks, I think I remember reading that now. It’s not that miencraft is actually infinite, it’s that the time it would take to traverse the terrain to find a limit would be a lot longer than we have to live, haha.

I think I’ll try to come up with a solution that involves planets with edges that you can reach in a reasonable amount of time before they wrap around. And then for certain resource gathering ventures, I’ll have special planets that are chaotically generated that save no chunk data :smile:

And then I can use noise for the finite worlds and some absurd chunk-edge-makes-next-chunk system for the infinite world.

Yay I’m not sad now!

Wait, what? I had always thought minecraft had limited sized worlds? I been mostly playing the ps3 version lately, which is gimped a bit, but isn’t pc as well limited to like, “super large” worlds that only go so far?

Well even if you make each chunk based on a random number like an int, you’d get repeated chunks because there are only 2^32 possible chunks to generate with a random int seed. So even random numbers can’t truly be unique and infinite.

1 Like

Only gimped a bit? The PS3 and XBox 360 are limited to 862 blocks in each direction. By comparison the PC edition is limited to 30,000,000 blocks in each direction. Note that this is an artificial cut-off and technically it is bigger.

http://minecraft.gamepedia.com/The_Overworld

I think they limit the console versions because they want to ensure you can’t fill the entire hard drive with world data and then crash. The PC version does let you fill the entire hard drive with world data and then crash, unless you have more than 400 petabytes of hard drive space, which I’m guessing most of us don’t. :frowning:

Ohhh okay, news to me! I didn’t realize the huge difference between the last gen consoles and pc! That’s interesting stuff.

So basically minecraft could be infinite, if there was no saving and loading the world’s, and distant chunks were just forgotten?

That would make an awesome adventure game, but maybe wouldn’t be so great for minecraft (and the army of clones) since your buildings would eventually be lost… hmmm

Technically yes but you’d never reach the end before the end of your natural life :smile:

I’m going with something else for the ‘infinite dimension’. I’m going to see if I can create a noise-like pattern but it’ll be generated by randomly raising and lowering blocks in the next chunk based on the position of the previous blocks. I’ll find a way to have it not be too choppy.

It’d be cool if in the future of cloud computing and super / quantum computers the entirety of a minecraft seed was held on a computer where 400 petabytes was no problem and the edges were extended by other seeds and players logged in and retrieved little slivers of the planet from that server.

Yes :slight_smile:

CTM (complete the monument) maps exist because some people prefer to explore instead of build. I’m sure there’s a target market of people who enjoy being immersed in a world that had literally infinite exploration.

I’ve had variants of this idea in which you generate chunks and then surround them in a big dome, like a series of connected biospheres / quarantines.

Well, if you don’t mind things repeating, then infinity is easy… just make your world loop forever. If you want something to be infinite and always unique, then there are limits not only with computers but due to the nature of information and reality itself. For example, your monitor has a finite amount of pixels, and they can each only display a finite number of colors, so there is a finite amount of things your monitor can display. Imagine every possible HD photo of everything in the universe and every possible image and painting that anyone can possibly imagine… all of that is not an infinite amount of stuff. It’s still limited by the amount of combinations you can get from pixels on an HD screen. Similarly, if you’re trying to generate an infinite looking world, there’s still only a finite amount of combinations of dirt/water/grass that you can make without having to repeat them. Even if you were using actual physical atoms and molecules, there are a finite number of configurations that will fit in a particular space. Things are getting philosophical up in here! :wink:

3 Likes

@makeshiftwings while what you say is true regarding arrangements, you can produce an infinite number of patterns, even if you only use 2 combinations :wink:

Pattern1, then pattern2, then 2 chunks of pattern 1, then 1 more chunk of pattern 2, then 3 more of pattern 1… and so on. Infinitely unique series :slight_smile: Although once the int keeping track of that overflowed you’d have to base it on something else. So I guess that’s still a hardware limitation.

Yes, though in that case, if you’re settling for chunks of terrain that will repeat but in different patterns until you hit an int limit and have to stop, it’s not really that different from using Perlin noise to generate terrain until you hit an int limit and have to stop.

1 Like

Yep, even if that limit is possible display combinations or atoms in the universe.

I think a more realistic limit, though, is how long your users are going to spend looking for things. The real world’s size is only a tiny fraction of what we can easily represent using known algorithms or systems, and even actual explorers spend their whole life only covering a small fraction of it.

I personally don’t think that “bigger worlds” is an attractive problem to solve, mostly because with current limits I don’t really see it as a problem at all. I’d much rather work on “more interesting worlds”.

1 Like

Yeah that’s what I was sort of getting at. Even if something is theoretically infinite, it’s still bounded by finite factors in real life, like how long we’re actually alive, or how much data you can store without needing a hard drive the size of the sun, or how many different images our eyes can differentiate. The digits of pi are infinite, but the digits of pi you could actually read before you die is finite. Infinity is overrated. :wink:

2 Likes

And yet there are proofs that certain mathematical constructs never repeat. Google transcendental number. Pi and e come to mind.

As a solution to a truly infinite world, one probably has to approach the problem in terms of (n+1) = f(n). Traditional solutions like perlin and simplex generate noise as n = f(x). This approach is limited by the index. Eventually you are going to overflow on x.

Using an (n+1) = f(n) approach will ensure that you never need to overflow your index. You would need a function that is coherent, random, and stable under all conditions. Its been a while since I’ve done hard core mathematics, but I’m sure such a function exists.

So basically what @Tomnnn said about each chunk generating the next one.

1 Like