Chunk generation Minecraft like

i’m trying to make a generation of chunks like on minecraft, but i don’t know how to do it, can someone help me please

This question is a bit too broad and unspecific. Do you generate one chunk yet? I assume your question is how to manage the chunks rather than generating (take a look at the minecraft example)

To manage them you can work with a simple raster coordinate system what i guess minecraft does work with too. But it is unclear where you’re stuck at and unclear what you expect for help.

I would like to make a generation of the world like on minecraft with a generation of chunks to optimize performance

Im afraid but that still doesn’t clarify on what you’re stuck at ^^

You might as well create a job offer in the job category in case you expect a full solution. But there also might be open source libs floating around the web as there are plenty MC clones made with js.

I don’t know how to explain it better, I see if there are libraries or guides on how to do what I want, thanks anyway :slight_smile:

Take a look at this guide - may be a good starting point.
As @Fyrestar mentioned, it’d be good if you tried random solutions, made some errors, and came with specific questions - it’s really hard to answer “how to make minecraft” since it’s a complex game (especially with chunk optimizations, which is the last thing you may want to worry about.)

yes I have already seen that guide but the code is too complex for mm, since I am still learning three.js and what I wanted was not this, but a gradual generation of the world through chunks

I don’t want to discourage you, but if this code is too complex you won’t push much further, unless you take some time to learn it first. Minecraft world consists of chunks - chunks consist of voxels. Chunks are basically just … voxels of smaller voxels (also sometimes with additional properties.)

There’s no skipping voxels - pretty much everything from top to bottom in Minecraft, except for the interface, works thanks to voxels and that kind of math like in the guide above.

2 Likes

oh okay i will try to understand it thanks :slight_smile:

the thing that i dont understand is the euclideanmodulo, what is it for?

Well, I had to check it myself - if that’d make you feel a bit better about not knowing instantly what some code / math does :’)

You can find it here.

For what I understand, it determines the chunk (aka. “cell”) in which given voxel is placed - but I can’t promise, I didn’t go through the entire guide.

okay, thank you very much for your patience, I really hope to be able to understand the code, also because I have almost no experience at all

1 Like

No problem. In general, just ignore the math if you can’t understand it right away, read on and maybe it becomes clear later. Reading someone else’s code isn’t easy.

okok thanks again :smiley: