# Working MC style chunk based terrain generation

**URL:** <https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537>\
**Category:** Showcase\
**Created:** [December 14, 2024, 9:47pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537 "2024-12-14T21:47:32Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 14, 2024, 9:47pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/1 "2024-12-14T21:47:32Z")

</div>

Hello! I am working on making a Minecraft clone using this game engine. This is an example of the world terrain. There is a memory bug I can fix, but it is working as of right now. Feel free to use this for your projects if you would like. It is easy to use and pretty easy to understand the code. The next step in the project is to add some optimizations. One of which is kinda hard to do. I want a greedy meshing system based on the Y level, not the texture. I also want to disable/ eliminate as much unused data as possible while being CPU-based. If you added anything to it let me know! I would love to see what you are using this script for!

[https://playcanvas.com/project/1285204/overview/t26](https://playcanvas.com/project/1285204/overview/t26)

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 3:30pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/2 "2024-12-15T15:30:38Z")

</div>

Here is a pitcher of a fun failed attempt! 🤣

 ![Screenshot 2024-12-15 9.28.15 AM](https://forum-files-playcanvas-com.s3.dualstack.eu-west-1.amazonaws.com/original/3X/0/6/06e71c7ed40e5c5d6e4edb6d237731d6324d5395.jpeg)

---

<div class="post-metadata">

**Author:** ![Codeknight999](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/codeknight999/32/36586_2.png) [@Codeknight999](https://forum.playcanvas.com/u/Codeknight999)\
**Post date:** [December 15, 2024, 3:33pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/3 "2024-12-15T15:33:42Z")

</div>

Farlands ahh

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 3:37pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/4 "2024-12-15T15:37:53Z")

</div>

LOL, right?! It is a simple fix. I am testing how far it will render. So far, it is 40.

---

<div class="post-metadata">

**Author:** ![Codeknight999](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/codeknight999/32/36586_2.png) [@Codeknight999](https://forum.playcanvas.com/u/Codeknight999)\
**Post date:** [December 15, 2024, 4:36pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/5 "2024-12-15T16:36:16Z")

</div>

Have you tried to see what would happen if you used like 40.5?

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 6:03pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/6 "2024-12-15T18:03:15Z")

</div>

No, I have not! I will try though!

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 6:06pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/7 "2024-12-15T18:06:39Z")

</div>

Interesting! The chunk layout is more rounded. It generates in a circle instead of a bunch of squares.

---

<div class="post-metadata">

**Author:** ![Codeknight999](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/codeknight999/32/36586_2.png) [@Codeknight999](https://forum.playcanvas.com/u/Codeknight999)\
**Post date:** [December 15, 2024, 7:16pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/8 "2024-12-15T19:16:47Z")

</div>

Interesting. I was just wondering because if one was a whole block, what would it do with half.

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 7:43pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/9 "2024-12-15T19:43:19Z")

</div>

Yah that is what I thought, many if I did 0.5 instead.

---

<div class="post-metadata">

**Author:** ![Codeknight999](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/codeknight999/32/36586_2.png) [@Codeknight999](https://forum.playcanvas.com/u/Codeknight999)\
**Post date:** [December 15, 2024, 8:22pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/10 "2024-12-15T20:22:05Z")

</div>

Is there any possibility of adding mobs, health, hunger, biomes, Minecraft stuff etc?

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [December 15, 2024, 10:24pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/11 "2024-12-15T22:24:52Z")

</div>

Yep! I need to finish the terrane gen first and slowly I will do that too.

---

<div class="post-metadata">

**Author:** ![Alexander1](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/a/34f0e0/32.png) [@Alexander1](https://forum.playcanvas.com/u/Alexander1)\
**Post date:** [February 1, 2025, 1:55am UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/12 "2025-02-01T01:55:09Z")

</div>

I think it needs a greedy meshing system or chunk system I say the chunks work well being 16x16 and if you need help ask me.

---

<div class="post-metadata">

**Author:** ![Alexander1](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/a/34f0e0/32.png) [@Alexander1](https://forum.playcanvas.com/u/Alexander1)\
**Post date:** [February 1, 2025, 2:03am UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/13 "2025-02-01T02:03:05Z")

</div>

I will help you with the vertices and block faces

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [February 1, 2025, 2:51pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/14 "2025-02-01T14:51:01Z")

</div>

Lol, this is one of my older tests, here is an updated one.  
[https://playcanvas.com/editor/scene/2139514](https://playcanvas.com/editor/scene/2139514)

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [February 1, 2025, 2:59pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/15 "2025-02-01T14:59:40Z")

</div>

This has a texture system and better terrain. I would like it if you take a look at what I got! The problem is not being able to add new textures and block variants. One of my goals is to add more Perlin noise factors for things like temp(for biome blending, block rarities, etc) and one for caves and mountains to give off the Minecraft effect. Before we do any of that I want to be able to render more chunks and be able to render trees.

---

<div class="post-metadata">

**Author:** ![Alexander1](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/a/34f0e0/32.png) [@Alexander1](https://forum.playcanvas.com/u/Alexander1)\
**Post date:** [February 1, 2025, 11:28pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/16 "2025-02-01T23:28:34Z")

</div>

I can help you with the perlin noise function I can take the function out of my game and give you the perlin noise code

---

<div class="post-metadata">

**Author:** ![Alexander1](https://forum.playcanvas.com/letter_avatar_proxy/v4/letter/a/34f0e0/32.png) [@Alexander1](https://forum.playcanvas.com/u/Alexander1)\
**Post date:** [February 1, 2025, 11:30pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/17 "2025-02-01T23:30:12Z")

</div>

And also I got a greedy meshed blocky terrain generation that is not laggy and far rendered

---

<div class="post-metadata">

**Author:** ![Nathaniel\_Garland](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/nathaniel_garland/32/34780_2.png) [@Nathaniel\_Garland](https://forum.playcanvas.com/u/Nathaniel_Garland)\
**Post date:** [February 2, 2025, 2:19pm UTC](https://forum.playcanvas.com/t/working-mc-style-chunk-based-terrain-generation/38537/18 "2025-02-02T14:19:59Z")

</div>

sweet! and how did you do your textures?
