Download

Any ideas about creating an infinite space?

Hi, m8s,

I wonder how the universe games were made for years, how to create an infinite space? Is that possible with the unreal engine?

Thanks.

Hi there,

Generating universes in games is a really vast subject, procedural generation is the way we create content that is too big to be stored so instead of having an entire planet with every one of its bumps and the positions of flowers, trees etc… what we do is we create an object, call it a planet, give it a size, a location in space and most importantly a specific integer.

Now that integer, called a seed is the secret key to the originality of this particular planet, from that number we generate a heightmap of the entire surface of the planet BUT the key thing is that we only want so much of the heightmap, let’s say you only want to generate a 4k resolution heightmap no matter how far or close you are to the surface, then the closer you get to the planet, the less terrain you create, you only want to see what’s close to the camera, that’s what we call LOD.
In the case of a planet, my go-to solution is to create 6 planes procedurally, place them to form a cube and then apply a formula to turn the cube into a sphere by shifting every vertex a little bit more.

Now we have a planet with a texture generated from the heightmap, that heightmap applied to the mesh gives the planet a unique surface terrain.
But to extend that to infinite universes you basically have to take the same idea but from even farther away.
Take a galaxy object and give it a unique integer, another seed, now from that seed you determine how many arms will the galaxy have, how many planets even and where the planets will be the same way you generated heightmap for the planets.

When your player moves around the universe, you call functions that draw the information that is needed the populate the surrounding area with the right planets, moons, stars, asteroids.

Now there are many ways of going into details but, is it possible in UE4 ? Yes. It definitely is, in fact some people on this forum have been working on this very idea in their own projects, but to make a truely realistical universe in UE4 I think that the most important thing is to know how to interpret already existing methods into UE4.

Also, to do this C++ is going to be absolutely necessary, you might get to do some cool things with BP but procedural terrain generation of this scale is very tricky, it’s very easy to make the game unplayable due to a falty LOD system.

I’ll leave some links of usefull information here if you’re interested ;

ioFlows’ procedural galaxy project : The Eden Project - Unreal Engine Forums
Dexyfex’s implementation of his own procedural universe work into UE4 : Real-size procedural universe - Unreal Engine Forums
I’d also look into his work on his website : https://dexyfex.com/
Magnificent implementation of procedural solar system into opengl with source to the application and paper explaining the process in detail in the video description : https://www.youtube.com/watch?v=rL8zDgTlXso

Some technical information ;
Planetary rendering discussion : Procedural Terrain Rendering How-To - Development - I-Novae Studios
QuadTree cLOD : Gamasutra - Continuous LOD Terrain Meshing Using Adaptive Quadtrees

That’s some good basis to start off, I’m working on a procedural galaxy game myself so I will probably post that on the forums soon enough if you’re interested.
Finally, good luck, it’s not an easy thing to do far from it, but it’s extremely interesting.