like on minecraft (no blocks though), I would rather use blueprints than c++ for this, but its ok either way I guess.
AFAIK, minecraft does not generate the world as you explore it. Given a seed value (as well as other properties, such as a biome), the world is procedurally generated before any players are ever placed within it. Given the case where it does this only for a small portion of the world initially, and that it continues to do this as you move around, then it simply uses the same formulas to calculate “what should be next” in the world. Something else minecraft utilizes is a concept known as “Terrain Chunking”, where an X by Y by Z sized grid of tiles are actually indexed and only rendered as the player walks within a certain range of that index.
As far as doing any of this in your own project is concerned, you would want to research procedural generation. It’s a rather vast topic that is not specific to blueprints, c++, or even UE4, however, there are some examples of it’s uses in various UE4 projects & youtube videos.
If you are going for a minecraft visual style, you could research procedural voxel terrain.
Otherwise (and especially for more complex geometry), or for smooth voxel terrain generation, the topic quickly becomes too vast to place in a single answer.
But you might find the ProceduralMeshComponent (which is currently in an experimental phase) to be a nice place to start, if you’re just looking for something more immediate to mess around with in Blueprint.
For procedural content that doesn’t require direct editing of geometry, you could also look into the Instanced Static Mesh Component, which allows for several instances of the same mesh to be rendered in a single draw call, taking on different properties (such as transforms) for each instance. For example, let’s say you have a small set of modular wall pieces - A wall piece, and a corner piece. You could create two instanced static mesh components, one set to use the wall mesh, and another using the corner piece. You could then determine all of the places in your world where you need any of these, and using the appropriate instanced static mesh component, you would then add instances and then change the instances’ transforms to correspond to this data. With two Instanced Static Mesh Components in use, no matter how many instances you have in your world, you will only have 2 draw calls to render all of them.