How To Make Minecraft Terrain in Godot 3 in 45 Minutes (Tutorial)

  Рет қаралды 45,927

xen-42

xen-42

Күн бұрын

Пікірлер: 216
@tumbleweb
@tumbleweb Жыл бұрын
Doing this in Godot 4.0: Class renames include StaticBody -> StaticBody3D, MeshInstance -> MeshInstance3D, SpatialMaterial -> StandardMaterial3D Annotations including '@tool' instead of 'tool' At 3:40, change 'Mesh.new()' -> 'ArrayMesh.new()' to avoid a !static_body error. At 11:00, texture filtering is not set per-import anymore; in the material, go to 'Sampling' and change Filter to Nearest. At 11:50, setting texture filter via code might not be necessary.. Not entirely sure, couldn't complete this part (see below), but in any event, materials do not have flags to set anymore, now replacing them with different variable groups in the inspector. First snag I couldn't catch was 16:00. The mesh would render fine but without the material. Godot spits out no errors at this point so its a bit difficult to tell what's going wrong. I'll check back another day.. >_> PS. 39:20 Raycasts are enabled by default now :D
@xen-42
@xen-42 Жыл бұрын
So glad they finally made them on by default lol!
@yarop1794
@yarop1794 Жыл бұрын
For anyone who has weird lighting on the edges of the mesh in Godot 4, try adding st.set_smooth_group(-1) just after st.begin(Mesh.PRIMITIVE_TRIANGLES). Otherwise the mesh is automatically smoothed.
@galwayiilt
@galwayiilt Жыл бұрын
Thank you for the clear, consice tutorial. At timestamp 4:27, 'mesh = st.commit()' works for me in Godot 4 stable.
@NexGenration99
@NexGenration99 11 ай бұрын
im not understanding the part at 11:00. im not seeing sampling. and what are referring to when you say "the material"?
@kylemorris5338
@kylemorris5338 10 ай бұрын
@@NexGenration99 If you double-click on the 3d material (the one that looks like an orb in the inspector), a few categories below the category for 'Albedo' where you set the texture is one for 'Sampling'. So instead of setting the texture's import settings, you set it on the settings for the StandardMaterial3D.
@nathanaelpage
@nathanaelpage 3 жыл бұрын
Was confused by the comment count until I saw the sub count... expected 10k. You're going places, dude. Great tutorial.
@xen-42
@xen-42 3 жыл бұрын
Thank you very much!
@gamerz000.
@gamerz000. 6 ай бұрын
​@@xen-42why are you still unpopular? Are there not many Godot game developers?
@xen-42
@xen-42 3 жыл бұрын
This is my first time writing a tutorial so let me know what you think!
@minutesock9649
@minutesock9649 3 жыл бұрын
You nailed it.
@decemberfrostpaindine7987
@decemberfrostpaindine7987 3 жыл бұрын
I love you
@rock9203
@rock9203 3 жыл бұрын
I personally feel like you should write the code each time instead of copying and pasting (in most cases, the vertices array made sense) but other than that it was fantastic. You did a great job explaining what each line of code did.
@Jesuisunknown
@Jesuisunknown 3 жыл бұрын
Its was so great ur the best
@MyTheQwerty
@MyTheQwerty Жыл бұрын
This is great! There are a lot of new concepts here for me, and I think I understand them. The only thing I feel is lacking is the explanations of the code. It feels a little short. But to fit all of this into 45 minutes is truly remarkable, I wouldn't mind a longer version with more detailed explanation of the purposes of each line
@thederpykrafter
@thederpykrafter 8 ай бұрын
Still the most informative video I've found on voxels in godot 2 years later
@xen-42
@xen-42 8 ай бұрын
Glad to know it's standing the test of time
@dreamhollow
@dreamhollow 2 жыл бұрын
This is a much better and more thorough tutorial than some ones I found in the past. Thanks so much for this, man.
@xen-42
@xen-42 2 жыл бұрын
Glad to hear it!
@VexGone
@VexGone 3 жыл бұрын
Wow this dude deserved a medal ! Great Tutorial
@xen-42
@xen-42 3 жыл бұрын
Thank you!
@Jesuisunknown
@Jesuisunknown 2 жыл бұрын
Thanks for the tutorial. I am new to making games and this is the first 3D game I made. I wish you would make more Minecraft tutorials in the future.
@xen-42
@xen-42 2 жыл бұрын
Thanks for the nice comment, I want to make more eventually!
@righttobeararms5585
@righttobeararms5585 2 жыл бұрын
Can we please have this as a series? I loved the pace of this video and would like to learn to make inventory, save system, and other aspects of the game from you as well
@xen-42
@xen-42 2 жыл бұрын
Thank you! Yes it's something I'm planning on making on in the future, I just started working on it again and as I figure stuff out I'll be sure to make new tutorials
@n00bscape43
@n00bscape43 2 жыл бұрын
@@xen-42 woo cant wait!
@n00bscape43
@n00bscape43 2 жыл бұрын
id like to add to that request if possible, learning to make different biomes and randomizing block types below the dirt or grass layers would be awesome, but definitely the abaility to save generated worlds and built structures would be nice!
@icyz1ne456
@icyz1ne456 3 жыл бұрын
Amazing tutorial! youve totally blown this one out of the park!
@xen-42
@xen-42 3 жыл бұрын
Thank you!
@Mistereee
@Mistereee 2 жыл бұрын
i will definitely be trying out this tutorial!
@possiblyzslot838
@possiblyzslot838 9 ай бұрын
I was really interested in creating voxel terrain, I don't know how I haven't found this vide sooner!
@beytullahberk3632
@beytullahberk3632 8 ай бұрын
If the top face of your chunk isn't rendering, problem might be that it's detecting air as a non-transparent block. I fixed it by adding "or blocks[x][y+1][z] == Global.AIR" to every if statement inside the create_block function. note that you should change x y z values depending on the face, y+1 for top, y-1 for bottom, x+1 for right and so on
@Darkknight-yw3hf
@Darkknight-yw3hf Жыл бұрын
You can fix all the errors it spits out when updating chunks by going to Project Settings > Rendering > Threads > Thread Model and setting it to Multi-Threaded.
@alisapersonnal
@alisapersonnal 10 ай бұрын
in godot 4 , from what i found , the setting changed to Project Settings > Rendering > Driver (but i might be wrong)
@paul_musique
@paul_musique 6 ай бұрын
You are right but Multi Thread IS experimental and it's still not working for me, I might have misses something but it removes all the erros​ when I don't use the thread@@alisapersonnal
@FemtoTheGodHand
@FemtoTheGodHand Жыл бұрын
Thank you very much for this helpful tutorial. 👍
@EricDaily
@EricDaily 3 жыл бұрын
Dude, this tutorial is gold.
@xen-42
@xen-42 3 жыл бұрын
Glad you think so! Thanks
@SlimClic
@SlimClic 3 ай бұрын
Any alternatives to make "load_thread.start(Callable(self, "_thread_process").bind(null))" work on Godot4?
@CasualRandom50
@CasualRandom50 2 ай бұрын
looking for the same thing im on 4.2 and i have no idea so i cant go past this part of the tutorial
@niqq_art
@niqq_art Жыл бұрын
How to type the indices "i" !? And can you make this video for godot 4 cuz many things have changed
@synapse5791
@synapse5791 2 жыл бұрын
Looks good so far. Im gonna save it and look at it later :)
@xen-42
@xen-42 2 жыл бұрын
Happy to hear it!
@synapse5791
@synapse5791 2 жыл бұрын
@@xen-42 ill keep you updated when im attempting it lol i really hope i can learn godot i used to use clickteam fusion but it was really limited. Also a quick question can you attempt this with 2d top down games also? thatd be great
@grootxlive542
@grootxlive542 Жыл бұрын
Hi, the tutorial helped me, but I have a question. I would like to make chunks cubic so that they stand on top of each other, could you explain what I need to change, please
@makumanga9434
@makumanga9434 Жыл бұрын
I like the tutorial a lot, but I have a question. Is it possible to handplace the "chunks" in-editor instead of having them be generated? I want to use voxel-based terrain destructibility in a game I'm making where I'll be creating levels as opposed to an open world.
@xen-42
@xen-42 Жыл бұрын
Yes you can definitely do it, you can just make a single chunk manually and give it a specific 3d array of block types. Might need some more code changes beyond that.
@2rr0s
@2rr0s Жыл бұрын
Thank you for this, but following the same instructions I got issues with the uvs in Godot 4. For some reason the entire chunk has the same color even with block types.
@laky2k866
@laky2k866 3 жыл бұрын
I just started this and it is really great! Thanks :D
@xen-42
@xen-42 3 жыл бұрын
Glad to hear it!
@cydonix
@cydonix Жыл бұрын
I have small gaps between the mesh textures, any idea what might cause this? (Using godot 4)
@nmigz
@nmigz 10 ай бұрын
I was able to resolve these visible seams between faces in Godot 4 by going to the Sampling settings of the Material3D resource and changing the value of Filter from "Linear Mipmap" to "Nearest Mipmap".
@binarycode_
@binarycode_ Жыл бұрын
I tried using this in godot 4 and it seems to lag a lot on startup and idk why if its the for loop it might work better to use some form of area3d detection with the player node
@djalexander968
@djalexander968 6 ай бұрын
What about water?? Like a big thing would be a non-solid block that you still have textures/collision for, say someone makes a factory game, they are going to make a solid block, but maybe different collision or a liquid where it's textured and non colliding. I'd love to see that tutorial, especially for geometric generation like this
@xen-42
@xen-42 6 ай бұрын
That was actually the last thing I was working on in the minecraft clone, just haven't touched the project in a while. Once I get back to it and figure out how I'm going to do water I'll definitely do a tutorial!
@djalexander968
@djalexander968 6 ай бұрын
@xen-42 thanks man. I was fiddling with the gdscript 4.0 version of this and it actually turned out to be tons of fun learning proc gen, and rulesetting for it, then I go "BuT wHaT aBoUt PhYsIcS" and the my whole understanding of the script caved in XD
@ghowstcrafter9201
@ghowstcrafter9201 3 жыл бұрын
im trying to make the same thing but using rust and *this video helped me a lot* because idk before the logic of the voxels, *ty* . Also, how does the check_transparent gets the right value on the array? Im confused
@xen-42
@xen-42 3 жыл бұрын
Well the check_transparent method checks at a given x,y,z coordinate of a block, and then I have the backing "blocks" array that has the info for all the blocks which is a 3D array so that the entry at blocks[x][y][z] is the data for the block at the x,y,z coordinate
@mamilicouz
@mamilicouz Жыл бұрын
i am getting an error in the "check_transparent" function. It says: "Invalid get index '6' (on base: 'Dictionary') . pls help thanks
@lennartbreede
@lennartbreede Жыл бұрын
me too, currently looking into it. Have you figured it out?
@lennartbreede
@lennartbreede Жыл бұрын
Found it, one of my dictionaries in types was missing the SOLID: true k-v pair
@Nauti_Games
@Nauti_Games 7 ай бұрын
Great tutorial. Curious how you handle placed blocks being saved into a chunk, since the blocks are reset every time the chunk reloads. I haven't quite figured it out yet, but I'm assuming the placed blocks need to be in a separate array that then gets appended to the blocks array in the update function?
@xen-42
@xen-42 7 ай бұрын
I've never actually implemented block saving/loading yet despite how many times I've worked on voxel projects like this. I would just save an ID number for each block in the chunk to a text file, doing that whenever a chunk gets unloaded. Then when a new chunk is loaded check if it's been loaded previously (meaning a text file would exist) and then just load the 3d blocks array from the file instead of re-generating it. Would definitely need some optimizations, I could imagine keeping the block data saved for a bit after a chunk unloads in case the player is walking away for a moment and is coming back. I should really prioritize working on saving soon since it's a pretty obvious next step!
@Nauti_Games
@Nauti_Games 7 ай бұрын
@@xen-42 I might have to work on this some more and give that a shot. I changed the code a little bit so the chunks loaded are saved into a dictionary, and instead of moving the chunks the game just loads in new chunks that haven't been previously loaded. To handle chunk unloading, I gave each mesh a visibility range so it culls when the player moves out of range. I don't notice too much of an impact on performance except when chunks are loading in, then there is some lag. Otherwise, if I'm running around an area that has already been loaded I still get 140 FPS like before.
@joellima8477
@joellima8477 2 жыл бұрын
47:13 Xen dimension from Half Life 1? it's looking great
@xen-42
@xen-42 2 жыл бұрын
Yeah I was definitely inspired by that. Thanks!
@TheLostPython
@TheLostPython Жыл бұрын
Hi! Loved your video tutorial and I successfully followed along, despite the version differences between 3 and 4. However, despite copying your code, my game didn't generate a world infinitely. Just a 5x5 chunk of chunks. I'm not sure why it isn't generating as the player moves as shown in your code. If you see this comment, mind dropping a tip? I'd greatly appreciate it!
@xen-42
@xen-42 Жыл бұрын
strange, must be something wrong in the World.gd _thread_process method. Maybe the thread isnt even running? Could check if load_thread.start is being called in _ready. Else I don't really have any idea.
@TheLostPython
@TheLostPython Жыл бұрын
@@xen-42 I did go through and realize that there is something wrong with the threading. Before the thread process is started, chunks has 25 children, but inside the thread it has no children and the array is completely empty. I haven't been able to figure out how to fix it, since passing in chunks directly to the method seemed to crash the program at start up. The thread is being called and run, so I think it has something to do with not passing in chunks properly?
@TheLostPython
@TheLostPython Жыл бұрын
@@xen-42 Okay, so I got it down to load_thread.start(_thread_process.bind(chunks)) not binding the chunks variable for some reason. It can do strings just fine, but when i try to pass in an object it just returns empty and I'm not sure why.
@xen-42
@xen-42 Жыл бұрын
@@TheLostPython very strange, I wonder if they changed something about threads in godot 4?
@jrguy
@jrguy Жыл бұрын
@@xen-42 I'm pretty new to godot so I'm assuming this is new to 4.0, but I asked around and it seems only the main thread can access the resource tree. You would have to use thread synchronization to transfer the data over from the main thread.
@BruceMorrison2
@BruceMorrison2 2 жыл бұрын
this helps a-lot with stuff for a Minecraft clone im making but i have question's maybe you can make a video about like 1. how do you make mobs/npc 2. how can you make a break time for blocks 3. how can you make trees/naturally generating structures and such 4. how can you make naturally generating caves 5. different biomes 6. ores 7. lake and rivers 8. useable items 9. health and hunger bar and other ui 10. also i need help with adding more blocks basically just making it a-lot like Minecraft plz if you make a video on these it would help a-lot plz and thank you
@xen-42
@xen-42 2 жыл бұрын
I'd love to do that, might take some time because I have to learn how to do the stuff first which takes a lot of time. Right now I'd know how to do 3, 4 and 5, so I could try that soon. In a month. Or a year. Or 10 years. Idk
@BruceMorrison2
@BruceMorrison2 2 жыл бұрын
@@xen-42 thanks
@ShiroCh_ID
@ShiroCh_ID 3 жыл бұрын
ooh nice but the problem is i want it to be not blocky and slightly smooth like No blocks mod in Minecraft
@xen-42
@xen-42 3 жыл бұрын
Im looking into how to do that with marching cubes and will put out a video on it in the future! Although I don't know how good the performance will be if it's in Godot script, might be very slow if it isn't C#. You can definitely find some good marching cubes tutorials out there but it's mostly going to be for Unity
@oglothenerd
@oglothenerd Жыл бұрын
@xen-42 How can I use a texture array instead of an atlas?
@SushiMCPE
@SushiMCPE 3 жыл бұрын
thank you so much man you made my day so much better! also I don't know how do I add trees to this clone can anyone help? i'd appreciate it! also when i build something and get away from it at the point when the chunk unloads,and then come back, the building disappears, how do i fix this? please help I would appreciate!
@xen-42
@xen-42 3 жыл бұрын
If you check the second repo in the description you can see how I made trees in a different version. To make the buildings stay around you have to save changes to chunks. I'm not sure what the best way to do this would be. Maybe in the methods "_on_Player_place_block" and "_on_Player_break_block" in World.gd you can track which blocks get modified and then save that when the relevant chunk gets unloaded. Then when its loaded back in you can read what changes were made to that chunk previously and make sure they are taken into account when it loads, after generating its terrain. Alternatively you can save the entire "blocks" array from the chunk when its unloaded. Then in the "generate" function in Chunks.gd you can check your list of previously loaded chunk and if its in there you just load it into "blocks" instead of regenerating that chunk. This would take up more space (you'd be saving every single block ever) but you wouldn't have to generate the terrain again. I think this is how Minecraft does it. There's a bunch of ways you'd want to optimize doing this tho. I haven't tried it yet so these are just some of my thoughts on how to do it.
@djalexander968
@djalexander968 6 ай бұрын
I get mesh tearing in 3.5 unless i do the triangle fans for all three of a, b, c a, b, d b, c, d The code seems right but when i load the chunk it tears? Ima run with this temp solution incase its just mathing wrong somehow, but im pretty sure i copied it exactly Edit literally 5 seconds after posting: yeah if you have this problem is just mathing wrong ig and go with b,c,d and a,b,d instead
@lukeaaron6946
@lukeaaron6946 3 жыл бұрын
Great video! Would you consider doing a second one where you implement marching cubes or similar on top of this?
@xen-42
@xen-42 3 жыл бұрын
That's a really good idea, I'll definitely consider it!
@lukeaaron6946
@lukeaaron6946 3 жыл бұрын
@@xen-42 that would awesome! There are few videos on implementing that, let alone in Godot. I'd definitely use it in my project too.
@TheRemaindersYT
@TheRemaindersYT Жыл бұрын
AMAZING TUTORIAL MAN!!!!!! THANK YOU!!!!!!
@piwwol1405
@piwwol1405 2 жыл бұрын
Help it show The identifier "Global" isn't declared in the current scope
@xen-42
@xen-42 2 жыл бұрын
Sounds like the Global script isn't autoloading correctly
@nurwaneduardo7831
@nurwaneduardo7831 3 жыл бұрын
What your godot version for make this toturial? Please tell me
@xen-42
@xen-42 3 жыл бұрын
3.3.2 I believe, I'll add it to the description!
@SuperNerdyBros01
@SuperNerdyBros01 Жыл бұрын
Hi there, I know your probably not gonna read this but could you tell me how to set a custom size for a block. Thanks!
@alisapersonnal
@alisapersonnal 10 ай бұрын
i'm having a huge issue in godot 4 at 34:12 the setter function "setget" just refuses to work and i , as of right now have no clue as to how to phrase it with godot 4's script it was my first actual roadblock since the start as i could figure out solution to all other issues
@nicholassinks9010
@nicholassinks9010 8 ай бұрын
instead of using setget in godot for you do : set = so it would be chunk_position = Vector2() : set = set_chunk_position
@incidist493
@incidist493 3 жыл бұрын
35:55 It dosen't work for me for no apparent reason. I've went to the source code, compared what I wrote to what you wrote and found no mistakes. I don't know what it could be.
@xen-42
@xen-42 3 жыл бұрын
Really? Thats strange. So when you walk forward does the terrain not load in and you walk off the edge?
@PG96
@PG96 Жыл бұрын
Hi, I need some help i don't know how to add a new cube, a cube which is in format .tscn?
@beytullahberk3632
@beytullahberk3632 8 ай бұрын
Do you have any more tips for the get_chunk function? the performance is terrible with it
@xen-42
@xen-42 8 ай бұрын
oh yeah, looking back on that method it can definitely be improved and is one of the things I changed in the Godot 4 C# version of the tutorial. My suggestion would be to create a dictionary in the World node that maps vector2 chunk positions to chunks. Whenever "chunk.set_chunk_position" gets called you would update its position in that dictionary. Then in "get_chunk" it can just look up that position in the dictionary to find the chunk.
@beytullahberk3632
@beytullahberk3632 8 ай бұрын
@@xen-42 thanks man! i'll check out your c# turorial as well, you're a great teacher
@rednibcoding3412
@rednibcoding3412 2 жыл бұрын
Thanks for this awesome tutorial! Could you continue this and add vegetation and cave generation. Also how to save and load a genarated world?
@xen-42
@xen-42 2 жыл бұрын
I would like to do that some day when I have the time!
@Xela42
@Xela42 Жыл бұрын
Cant seem to get my texture atlas to work, its a .png but im still new to godot4 and i cant seem to find those extra settings that your image has, mine just remains as "read only" and that it cant be modified unless I change some settings in the Import tab.
@kaosan1757
@kaosan1757 3 жыл бұрын
Bro I can't get the chunks to load and clear How i can solve it?
@xen-42
@xen-42 3 жыл бұрын
Would be really hard for me to tell without seeing the code. Do any chunks load in at all? Or is it that when the player character moves the new ones don't load in and clear the old ones?
@kaosan1757
@kaosan1757 3 жыл бұрын
@@xen-42 Only 5 chunks are loaded, and no more are generated when the player moves or the camera looks at them
@vexmane
@vexmane Жыл бұрын
You probably either fixed the issue or long ago abandoned it but I found the issue boils down to the while true loop not working and when you start the thread it only executes once. I've been looking for a solution to the problem but I couldn't find any
@seraph8293
@seraph8293 Жыл бұрын
How do you save the chunks instead of just deleting them
@xen-42
@xen-42 Жыл бұрын
Would have to save the blocks in a chunk in the chunk unload method, and then when running the chunk loading method check if that chunk exists in memory and then load the 3d block array from that data instead of generating a new chunk. I haven't tried implementing that yet though.
@Bluelight82
@Bluelight82 2 жыл бұрын
Great video! How do you learn this stuff? Only thing I can do is watch other people make games instead of making my own. lol
@xen-42
@xen-42 2 жыл бұрын
Lot of watching other peoples stuff, and googling, and trying out different stuff on my own. I know the feeling tho! Takes so much work to make a game, so much easier to just watch devlogs lol
@abyssalvoidyt
@abyssalvoidyt 4 ай бұрын
Anyone have any idea on how to get the chunk to use different materials for blocks instead of using one material?
@Ja3Starr
@Ja3Starr 2 жыл бұрын
why is spatialmaterial not a thing anymore? what can i use instead?
@xen-42
@xen-42 2 жыл бұрын
Oh what really? I'm away from my computer for a few weeks but when I'm back I'll have to look into it, if that's made the guide outdated.
@Ja3Starr
@Ja3Starr 2 жыл бұрын
@@xen-42 sounds good dude. in the meantime I'll try to find a fix for it. unfortunately using any native features of godot is not what i'm experienced with. =/
@Ja3Starr
@Ja3Starr 2 жыл бұрын
@@xen-42 realized last night i was using an old version of godot - 2.1.6 =(
@talkingwall473
@talkingwall473 11 ай бұрын
line 85 this error cannot get null on base dictonary im using godot 4 PLZ help my brain is not working
@NexGenration99
@NexGenration99 11 ай бұрын
at 7:00, what are you doing? your mouse didnt get recorded so i have no idea what you clicked on to get the 3d view to show the chunk that was just coded. ive tried poking around to see if i could figure it out but all i see is an empty void
@paul_musique
@paul_musique 6 ай бұрын
He didn't clic, it's the @tool line that allows this
@paul_musique
@paul_musique 6 ай бұрын
Make sure to save the scene, close it in the editor and open it again. Otherwise it won't work
@superdutchskills492
@superdutchskills492 8 ай бұрын
so i was wondering i was making my own clone but ran into one issue and that issue is that i want face culling outside the chunk but i dont know how does anyone have a clue on how i might be able to do this i can remove all the faces outside the chunk yet when i load another those same faces dont update and i dont know how to do that.
@xen-42
@xen-42 8 ай бұрын
I've ran into the same issue, what I ended up doing is when loading chunks around the player I only load the block data and don't actually make the mesh. I only make the mesh for a chunk when all surrounding chunks have been loaded. This way it can look into the neighboring chunk to see what block is beside it and determine if it needs to make that face or not.
@Jesuisunknown
@Jesuisunknown 2 жыл бұрын
In 7:07 it still look like a square can someone help me plz Edit: I recheck and correct all my mistakes in the script now there is that light blue rectangle now
@xen-42
@xen-42 2 жыл бұрын
So did it work in the end?
@Jesuisunknown
@Jesuisunknown 2 жыл бұрын
Im not done yet cuz i am strugeling in 19:35 cuz no grass block appearing on my screen just like what happened in 7:07 i'll gonna edit when im done with it
@anicepineapple9067
@anicepineapple9067 3 жыл бұрын
Idk if I'm the only one but the whole thing freezes for a sec every time I break a block. Does anyone know why this might be happening?
@xen-42
@xen-42 3 жыл бұрын
When you break a block it has to reload the mesh for the chunk, so on lower-end PCs you're getting some lag. For the sake of keeping the video "short" I didn't do many optimizations. If you check the second github repo I put in the description you can see the optimizations I made in another version of this I've made. Just some multithreading stuff really. And then if that's not enough for the lag you'd have to try rewriting the code in C# instead of GDscript. Personally I've been waiting for Godot version 4 to do that. And then if you don't want to do that, this project by Zylann does voxels in C++ so it's like 60x faster than the GDscript I show in the video: github.com/Zylann/godot_voxel
@anicepineapple9067
@anicepineapple9067 3 жыл бұрын
@@xen-42 It could be the performance of my PC, though I feel like it's beefy enough to handle this particular task, however it is happening on both versions of the project. I started looking for the cause and found for some reason physics process seems to be taking a long time every time I break a block? If it is multi-threaded chunk loading wouldn't it just take a second to update, and not freeze the whole game? (By the way it is a great tutorial, I'm going to follow along again and find out exactly when the issue crops up, thank you for the help.)
@anicepineapple9067
@anicepineapple9067 3 жыл бұрын
PS. loading and unloading chunks works fine and doesn't freeze anything, just re-loading after a block is broken.
@xen-42
@xen-42 3 жыл бұрын
Maybe if we loaded in a "new" chunk in the same position as the old one just with the block removed, then unloaded the old chunk when that's done it wouldn't freeze. There would probably be a delay before the block actually disappears but at least it wouldn't freeze.
@fiftybytes
@fiftybytes 6 ай бұрын
really wish i could get the threads part working in godot 4
@paul_musique
@paul_musique 6 ай бұрын
Same, tell me if you got it to work. I'll tell you if I got it to work
@fiftybytes
@fiftybytes 6 ай бұрын
@@paul_musiquei started following the other tutorial that uses C#, once you get used to how C# is written it isn't too hard to translate it from gdscript so i'd highly recommend it. plus, it's more performant
@paul_musique
@paul_musique 6 ай бұрын
but the thread still don't work in C#?@@fiftybytes
@tsk5328
@tsk5328 3 жыл бұрын
hi, total noob here, I was just wondering, could one use the default cube with collision to generate the blocks, and if so, would this be more or less efficient?
@xen-42
@xen-42 3 жыл бұрын
Hey, it would be much less efficient unfortunately. One chunk is made of 16x16x64 blocks. So that would be 16x16x64=16384 total cubes. So whenever a chunk is loaded it would have to load 16384 meshes and collisions if we were using default cubes. Manually generating the cube faces for each block in an entire chunk and keeping them all as one single mesh with one collision mesh means we only have to load in a single object. Plus, if we are doing individual cubes, think of how many cubes are hidden underground where you cannot see them. By making a single chunk and creating all the cube faces on it we can just ignore these hidden blocks.
@tsk5328
@tsk5328 3 жыл бұрын
@@xen-42 thank you for your in-depth awnser! Ok i know this is not twenty questions but if you have a bit of spare time one more question: with the chunk generation, would there be a way to only save the top block (the viable ground) and the noise map that the rest of the blocks follow during generation, then to use the time it takes a player to brake the first visible block to dynamicly generate the ones underneath, but only the ones that will become visible once the block brakes. So instead of pre generating and preloading a chunk that is a cube of blocks one only needs to save a thin plane of visible blocks as chunks with only the noise map underneath? I'm looking for a way to generate vast landscape's that can still run well even on a potato. Hence trying to find a way to save as little data as possible and not use to much ram. Im a bit optimistic maybe, but I also think that a tutorial video on this would also score a lot of hits. As i have not found anything like this online and i think many people have dreamed of vast worlds, maybe even worlds on a 1 to 1 scale with earth. It would be awesome to see what games people could make with such an optimised world generation method, if it is possible and more efficient. Sorry for my spelling and rambling, i have not slept much over the last week.
@bigbodge
@bigbodge 3 жыл бұрын
@@tsk5328 Massive, fully destructible worlds are certainly possible (to my knowledge, minecraft worlds are, and in terms of finite worlds, I believe no mans sky worlds are earth sized), however the difficulty ramps up exponentially and theres no easy way to do this. Xen's tutorial here is absolutely fantastic, and Im amazed he managed to fit it all in in under an hour, but Im afraid what your asking for goes far beyond the scope of a youtube tutorial. Often its the culmination of someones whole career (or several peoples, even). Getting that to run on basic hardware makes things a lot more difficult. Then of course you want to fill that world with stuff (e.g. trees, grass, maybe structures, ect...), and save the changes made to the world, and things become very difficult very quickly. Long story short, you really have 3 options: 1. Get creative and make cutbacks. Can you do it with loading screens? Does it need to be 3D? Basically, you'll need to make some compromises in your design, potentially very big ones 2. Scale down your vision. This is generally good game dev advise, its quite similar to the above, but rather that making compromises, you start from scratch with a simpler idea. 3. Strap in, get reading, and prepare to dedicate a good few years to this. As I said, your highly unlikely to find a tutorial telling you how to do this, so if you don't want to compromise or change your vision, you have to teach yourself from scratch. Others have done it so its possible, but it takes a long, long time. Also, what might be interesting, is that in my experience, large, finite worlds are significantly harder to do than infinite worlds. So take that into account as well. Best of luck with whatever you do :)
@xen-42
@xen-42 3 жыл бұрын
Thanks for that reply BigBodge, really covers it! :)
@tsk5328
@tsk5328 3 жыл бұрын
@@xen-42 it really did
@cyberchad
@cyberchad 3 жыл бұрын
How's the performance on this? Can it run on low end pc?
@xen-42
@xen-42 3 жыл бұрын
Maybe, but I'm not sure. There are definitely ways to optimize the algorithms used and if you wrote it in C# or GDnative instead of GDscript then I'm sure it would run better.
@cyberchad
@cyberchad 3 жыл бұрын
@@xen-42 I just tried it. It runs super smooth on my crappy old laptop!!!
@cyberchad
@cyberchad 3 жыл бұрын
Except when placing and breaking blocks. Does the chunk happens at different thread or on same? I haven't watched the video yet
@Efcetro.
@Efcetro. 11 ай бұрын
will it work if i try make now? i mean this vid is 2 years ago and we're in 2023
@xen-42
@xen-42 11 ай бұрын
Not in Godot 4 no, there are some issues with it
@nicholassinks9010
@nicholassinks9010 8 ай бұрын
The issue in Godot 4 that I ran into is with the threading, for some reason most variables can't be accessed in threads anymore you can't even pass an array into the thread function or the array will become a bunch of null elements and references become null as well. you can still make it in godot 3 though you don't need to use godot 4
@JackiTr21
@JackiTr21 2 ай бұрын
can u make cave generator?
@bonemoney4845
@bonemoney4845 2 жыл бұрын
so at 2:46 you made a tscn and i don't know how that happened pls help
@xen-42
@xen-42 2 жыл бұрын
oh yeah, I think when I saved my script (just hit ctrl-s) it also saved the scene I was on, since I hadn't saved it yet, so that made the .tscn
@bonemoney4845
@bonemoney4845 2 жыл бұрын
@@xen-42 and then later did you delete the chunk static body and reloaded it by hitting the tscn?
@bonemoney4845
@bonemoney4845 2 жыл бұрын
@@xen-42 got my chunk, thanks man
@veryannoyingdude8697
@veryannoyingdude8697 2 жыл бұрын
Nice
@Jesuisunknown
@Jesuisunknown 2 жыл бұрын
I am almost done with this project. I only have a few problems. Firstly, the tiny mountains have triangle holes appearing. Maybe it is because my device is quite old and slow to process. Second, in the player script, it said that there was an error in (83,1) The identity "pos" isn't declared in the current scope. Edit: It is done now i already fixed it but when i run it it said (Not Responding) Edit 2: There is just wrong number on its shape code i guess now its done
@ActuallyKun
@ActuallyKun 10 ай бұрын
Did you ever figure out why the holes were appearing? I'm getting it too
@Jesuisunknown
@Jesuisunknown 10 ай бұрын
@@ActuallyKun There's something wrong with the vertices
@signoredelladistruzionegdnp
@signoredelladistruzionegdnp Жыл бұрын
this is extremely useful,However For Some Unknown Reason Godot First Of All Completely Eradicated The Shape I Made By following The Tutorial And Then Its Giving Me An Error,Something Along The Lines Of "Couldnt Fully Load The Singleton Script Global(Possible Cyclic Reference Or Parse Error)" I Litteraly Di Everything That The Vid Told Me To Do,Im A Newbie And I Need Help!
@signoredelladistruzionegdnp
@signoredelladistruzionegdnp Жыл бұрын
btw te shape became invisible After I Saved The Project For The Night And Then When I Came Back It Was 100% Invisible,Really Odd. Im On Godot 3.5.1 Btw
@alomac8976
@alomac8976 2 жыл бұрын
I got stuck at 19:35. When I reload Chunk: Only the side of the grass texture renders. Stone, dirt, and the top of the grass don't show for some reason.
@xen-42
@xen-42 2 жыл бұрын
thats strange, could be with how the textures are being mapped, did you find a solution to it?
@beytullahberk3632
@beytullahberk3632 8 ай бұрын
i'm having the same problem. did you find a solution or give up??
@alomac8976
@alomac8976 8 ай бұрын
Yeah, I gave up... I'm doing C++ now lol @@beytullahberk3632
@СпящийВизитёр
@СпящийВизитёр Жыл бұрын
why are all my textures black? o_O downloaded your project - the textures are not displayed. did it myself - the textures are incorrectly superimposed on the "ball". what could be the problem? T_T
@xen-42
@xen-42 Жыл бұрын
Thats weird if you just downloaded it and it doesnt work. What version of Godot are you using? Maybe its that idk
@СпящийВизитёр
@СпящийВизитёр Жыл бұрын
@@xen-42 steam
@Reslan112
@Reslan112 2 жыл бұрын
Hey can you help me. My boxoutline is rotating with my player
@xen-42
@xen-42 2 жыл бұрын
Maybe you're rotating the entire player body and not just their Head when the mouse moves? That would rotate the box outline as well
@truenincillo805
@truenincillo805 Ай бұрын
Please tutorial new in 4.3 🙏🙏🙏
@arkumar842
@arkumar842 3 жыл бұрын
thanks :)
@xen-42
@xen-42 3 жыл бұрын
no problem!
@asbestositgets1104
@asbestositgets1104 9 ай бұрын
Does anyone know a way to offset the chunk so that I could make the center of the chunk the origin?
@djalexander968
@djalexander968 6 ай бұрын
Yeah... every vector3 that was a 1,0 combo? You go by -.5 and .5 now, Goodluck 😂😂, that's the easy way just to be clear
@juliettegeo5002
@juliettegeo5002 3 жыл бұрын
Do you think that I too could make Minecraft-style voxel terrain in Godot in 45 minutes?
@xen-42
@xen-42 3 жыл бұрын
no
@xen-42
@xen-42 3 жыл бұрын
haha jk... ya
@juliettegeo5002
@juliettegeo5002 3 жыл бұрын
@@xen-42 ok thanks i just might
@gabagoo_grimbo
@gabagoo_grimbo 8 ай бұрын
whats the license on this code?
@xen-42
@xen-42 8 ай бұрын
Good question, didn't have one on it so I just made it MIT so feel free to do whatever you want with the code but credit is always appreciated!
@gabagoo_grimbo
@gabagoo_grimbo 8 ай бұрын
@@xen-42 ty mr 42
@MINTGREENYT369
@MINTGREENYT369 6 ай бұрын
godot says create_face() not found in base self, what do i do??? edit: nevermind lol, i feel stupid, i watched the video a little further and realization hit me XD
@Madyisanerd
@Madyisanerd 7 ай бұрын
7:12 the cube wont appear
@nullfreq_
@nullfreq_ 2 ай бұрын
I seem to also have this issue
@ItzHazmat
@ItzHazmat 3 жыл бұрын
why you don't link commands ???
@xen-42
@xen-42 3 жыл бұрын
What do you mean
@kazdmov
@kazdmov 9 ай бұрын
How to do threading in Godot 4?
@xen-42
@xen-42 9 ай бұрын
I have no idea, I switched to C# instead and used its threading
@kazdmov
@kazdmov 9 ай бұрын
@@xen-42 ok thanks
@freevbucks8019
@freevbucks8019 Жыл бұрын
I'm hitting a mesh ceiling
@jagkiratsinghsaluja3379
@jagkiratsinghsaluja3379 3 жыл бұрын
:)
@xen-42
@xen-42 3 жыл бұрын
:)
@shadey2830
@shadey2830 3 жыл бұрын
SCAM, it says that it takes 45 minutes, IT'S 47
@xen-42
@xen-42 3 жыл бұрын
please... i beg of you... dont out me like this... nobody has to know...
@zetjet9901
@zetjet9901 2 жыл бұрын
7:00
@xen-42
@xen-42 2 жыл бұрын
real?
@zetjet9901
@zetjet9901 2 жыл бұрын
Oops forgot to finish the comment. You said “if we close our chunk and reload it we now see a plain chunk here”. How do you close and reload chunk?
@xen-42
@xen-42 2 жыл бұрын
@@zetjet9901 oh yeah, just at the top right under "Help" I X out of the Chunk scene and then I reopen Chunk.tscn in the bottom left, since the script is marked as "tool" reopening it has it actually run the "ready" method so it actually loads by closing and reopening. Can't believe I forgot to have it record my mouse cursor for this, I'll have to remember to not make that same mistake in any future tutorials.
@hunterlepage
@hunterlepage 3 жыл бұрын
Do you know what could be causing this error? prnt.sc/1cy0k3n
@xen-42
@xen-42 3 жыл бұрын
Sorry that I didn't see your comment until now, I had some problems with bots posting spam links before so all comments with links in them were being blocked. Were you able to solve the problem? Seems the blocks array isn't being initialized before the create_block function is called.
@prosti4ok
@prosti4ok 2 жыл бұрын
2 57
@xen-42
@xen-42 2 жыл бұрын
yes
@seangle5390
@seangle5390 Жыл бұрын
The tutorial is just reading out loud the code that you're copy pasting line by line from the repo that you've made beforehand? It's great for people who have tons of experience in Godot's 3D game making, but not for everybody else (they'll just copy the code without knowing whats and whys) I hope a more thorough commentary comes out where the developer actually makes the game from zero, vocalizing all the problems and solutions he encounters. Yes it'll be long, but it can be a series. And edit the videos please, there's free Davinci Resolve 😅 You have a great opportunity to redo the tutorial as a series with greater academic skills after Godot 4 has finally been released. I expect the series will have lots of views, because people love series instead of long-ahh videos
@xen-42
@xen-42 Жыл бұрын
I'll keep that in mind
@33phuchuynh36
@33phuchuynh36 2 жыл бұрын
this video really so FAST!, i can't understand anything, i think you should slow and talk detail about the new func and somethinng
@xen-42
@xen-42 2 жыл бұрын
I'm sorry to hear that
@mikelmonleon4932
@mikelmonleon4932 9 ай бұрын
load_thread.start(self, "_thread_process") doesn't seem to work anymore in godot 4
@nicholassinks9010
@nicholassinks9010 8 ай бұрын
you need to get rid of "self" and remove the variable in the thread process function. press F1 in the editor and search the class name to see the new syntax for classes like the Thread class because a lot has changed in godot 4
@MikelMonleon
@MikelMonleon 8 ай бұрын
@@nicholassinks9010 if only it were that simple. I figured out the syntax pretty quickly, but you can't access children or set the node positions on the seperate thread.
@CirculensProductions
@CirculensProductions 8 ай бұрын
@@MikelMonleon Did you manage to fix it? I am stuck here lol
@valgrann
@valgrann 8 ай бұрын
@@MikelMonleon Godot 4 no longer supports reading/writing nodes that belong to the scene tree from a sub-thread (this is unsafe and the reason why it was possible in Godot 3 was actually a vulnerability rather than a feature as far as I know). A solution could be executing everything in the main thread. With gdscript this is really slow and hangs the execution whenever the chunks are loaded/unloaded. C# might be faster for this but I haven't tried it yet. Since manipulating nodes that are outside the tree directly is perfectly fine according to the docs, I believe that another solution could be removing the chunk nodes from the scene tree, apply them the calculations needed from the sub-thread and reinserting them into the scene tree from the main thread.
@harrison6082
@harrison6082 Жыл бұрын
In the scene "Chunk" the 3d view shows the voxels normally. But in the Scene "World", whenever I scroll in the 3d view, the textures switch from the normal ones to being all black, and back to normal again. (Note: This texture switch happens both when the view is close and far away from the chunk) The textures don't switch like this in the Scene "Chunk" when I scroll. Also, when I run the scene "World", all my voxels are are black. But when I look at the scene "World" through the 3d view, it shows the correct textures (unless I scrolled in the viewer in a position it didn't like). Anyone have any good ideas? I'm paused here in the tutorial 29:03 I think my problem has something to do with Viewports, and/or the black texture is from new_spatialmaterial.tres. But i'm not sure Edit: I finished the tutorial, I didn't fix those above problems, but everything else works fine. Thanks for making he video it helped me a lot. I will definitely be using what I learned in the future! :)
@СпящийВизитёр
@СпящийВизитёр Жыл бұрын
i also faced the problem of "black" textures... T_T
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
I Made Minecraft in Godot
28:36
RachelfTech
Рет қаралды 63 М.
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
小丑家的感情危机!#小丑#天使#家庭
00:15
家庭搞笑日记
Рет қаралды 29 МЛН
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 97 МЛН
I Made a Minecraft Clone in C++
10:15
WSAL Evan
Рет қаралды 70 М.
I Made a Voxel Engine
10:33
Zyger
Рет қаралды 53 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 620 М.
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 235 М.
Voxel Game Mesh Optimizations
7:30
Hopson
Рет қаралды 177 М.
Making a Voxel Engine from SCRATCH (w/ Destruction)
14:31
MaxMakesGames
Рет қаралды 36 М.
How To PLAN your Game as a Solo Developer
16:26
Heartbeast
Рет қаралды 506 М.
Optimizing My Minecraft Clone With GREEDY MESHING
6:27
FinalForEach
Рет қаралды 122 М.
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН