Minecraft like project

About Monkey 2 Forums Monkey 2 Projects Minecraft like project

This topic contains 7 replies, has 2 voices, and was last updated by  DruggedBunny 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #14113



    After watching a create Minecraft in a week video’s and following a Udemy course on how to create a Minecraft like game I started on creating something like this in Monkey2.

    Currently: I was able to figure out how to create cubes from meshes. Then chunks from the cubes by combining these into models. Then a crude world made from the chunks.

    I have various stages(example code) of the project in the above linked github folder.


    Learn/figure out mouse controls, Removing/Adding blocks, Texturing blocks inside the model chunks. Better (realtime/infinite?) generating. Collisions. And more.


    World made of chunks.



    Just compiled it for browser :


    I only needed to add a little bit of memory in the env.txt.






    I noticed a new chunks method being mentioned in the udemy course and had spend some time thinking about how to implement it. I was able to create this(I think I did) It basically now creates a chunk at once instead of cube by cube. The cube by cube method used the addmesh command. Mark mentioned this would cause a lot of copying.  The new FastChunk method uses a couple of lists where the vertices etc are put in and these are then used to create one complete chunk mesh.

    I had not seen a huge speed increase on the main laptop, but I am still testing(rebuilding on the low end lappy now)

    I also was able to implement a texture atlas. Here on the forum I learned that you can texture the cubes with that. They are different textures on one image. I made a couple of mistakes so spend a long time figuring out what went wrong, but I managed to get it working.

    There is now a new file in the github folder mining called worldtest fastchunk.

    I am planning on creating more textures and some work on the generator for placements of the textured cubes.



    I spend a whole bunch of hours working on the project. I got the chunk building updating so that it does not really cause screen freezes anymore. It seems to work pretty well even in debug mode on the lower end amd a8 laptop.  I also got the memory useage down. I added a check so it does not create unused data in the chunk generator. The memory useage went down from 600 mb to 300 mb.

    I also spend time adding block manipulation. I created a block model that I place on the block underneath the cursor. It is a blinking block. While doing this I also needed to create code to handle chunks next to each other. (faces) The v key is used to remove blocks.

    The last file I made is called : worldtest_blockmanip.monkey2 (no external files needed)

    I need to see what I feel like adding next.

    edit: i created a short video.



    It has been a while since I did anything with the project but I spend a night and morning trying to make it better.

    I added trees which are placed based on a seed(grow) array. This is a array where I place numbers on. I enter a loop and pick a random x and y and see if a number is present there and if so place that same number besides it. This way you end up with zones or islands if you will. This I use to see if a tree can be placed there. This makes it look like there are area’s on the map where there are no trees and area’s where there are trees.

    I also added a dungeon algorithm that I did. I simply copied into the project and added a ceiling and a floor. I still want to add different heights for the rooms and a stair to the surface. The dungeons are randomly placed on the map and should be mostly underground. Usualy they are unreachable unless the tunnelling algorithm broke through the walls.

    I also was working a bit on the texture atlas. There is still something not right on the edges. I still want to make it so that each side of a cube can have a different texture.

    Another thing I was planning is ambient lighting. I think(?) this is done with having a larger texture atlas where every image has a version with shadows on the edges. These textures then get placed in corners making it look like it has been lighted. Since I am using small textures I think I can make this work. This would be useful since the regular lighting on lower end machines seem not to give a good framerate and need to be disabled there.

    The code is still on github in my account (pakz001) in the public monkey2 3d rep in the mining folder. There are a number of examples and experiment files there that should mosly compile with a later version of monkey2.



    I do not think I added this link to this thread. This was the last version I uploaded to the internet(Added with trees and underground dungeons) I had just googled for “emscripten minecraft” and this thread showed up in the first few results.

    Last version (trees and dungeons)
    (This version does not work on mobile devices since I stil need to give the texture atlas a power of 2 dimension.)

    At the moment I am not really working on this voxel project. But I do spend time trying to figure out this whole infinite generation which can include generated things like dungeons and other structures. I was also able to test this last emscripten version on a older i3 laptop and it seems to be fast enough. But compared to the real minecraft it is superslow.

    I am thinking that when I get a new laptop this year with a new i7 processor(9th gen) and new nvidia card I wil start to add features(more power!!) Also maybe then mojo3d wil be more feature rich so I can add things like water(transparent blocks) Also I am not sure on the memory requirements. Browser(emscripten) games have a 2gb limit afaik and saving to the disk is something I have no knowledge on yet.



    Just had a quick go, works really well… nice work!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.