You have lots of easy optimizations. In your shader you use a float3 for position which you can reduce to a uniform variable for the chunk position and then convert vertex positions in the 16x16x16 chunk mesh to a 1d position which would have 17^3=4913 values which would require 2^13 bits. Meaning you can easily fit a vertex position into a single integer and then also use the rest of the bits for a cube face normal and texture id. Then you get the texture from a buffer or sampler2DArray or texture atlas if all textures are the same size or whatever else. This combines nicely with greedy meshing for using less vram. Idk how you store chunks but RLE is an easy optimization for storing voxels in a chunk especially since you can also easily and quickly know if a chunk is made up of a single block or completely empty. Also idk how you map textures to cube faces but in a old project of mine which uses greedy meshing I used this and I remembered it being pain to get to Fragment shader: void main() { vec2 tileUV = vec2(dot(vec3(-normal.x, normal.zy), position.zxx), position.y + normal.y * position.z); vec2 finalTexCoord = fract(tileUV); ... }
Indeed, I spent a lot of time trying to pack that vector3 position in my shader into a single float value, but it took me too long and eventually I decided to give up for the moment and try again later. Thank you for the suggestions
@@vycdevok if you try again here is my own vertex shader from my own old voxel engine if you want to use it. #version 300 es // map index to normal const vec3 NORMALS[6] = vec3[6]( vec3(1.0, 0.0, 0.0), vec3(-1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, -1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, -1.0) ); const float AO_COLOURS[4] = float[4]( 0.2,0.4,0.6,0.8 ); layout (location = 0) in int data; flat out int textureID; out vec3 position; out vec3 normal; out float ao; uniform mat4 cameraMat; uniform ivec3 chunkPos; vec3 convert1DTo3D(int index) { int x = index % 17; int y = (index / 17) % 17; int z = index / (17 * 17); return vec3(float(x), float(y), float(z)); } void main() { normal = NORMALS[data >> 13 & 0x7]; position = convert1DTo3D(data & 0x1FFF); ao = AO_COLOURS[data >> 16 & 0x3]; textureID = data >> 18 & 0x1FFF; gl_Position = cameraMat * mat4( 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, chunkPos.x, chunkPos.y, chunkPos.z, 1.0 ) * vec4(position, 1.0); }
Damn.. I respect you making it in MonoGame! 🙏 Even if it's another Minecraft clone, this is still really impressive! looking at some of your code (as a junior programmer myself), I wish you could teach me to write better and more professional code. At this moment in my journey I would never be able to or even know how to do most of these things (e.g. the generation, mesh building, the whole new rendering engine you made, …)
I consider my code right now to be pretty bad on this project 😅, but I plan on improving it with time. I didn't really know how to do them either at first, I just searched on the internet or asked ChatGPT, because I am a web developer so I don't have much game dev knowledge aside from some concepts.
Unfortunately I don't have that much experience with C++, and the biggest turnoff for me is the build system. I can recommend you to watch Low Level Game Dev as he makes C++ videos, and has a lot of tutorials and even a minecraft clone which is a lot more advanced than mine for sure :D
I already made one for my final project for university. It was pretty cool to make it. You can find it here if you are curious: github.com/vycdev/cequel-interpreter-lib
@ Haven't made a compiled one yet, but for the one that I made, I made a parser generator and wrote the rules for the language that I needed. I read Crafting Interpreters to figure how to do that because it was pretty hard, but I learned a lot.
Implement a better way to use the texture atlas please, the BlockRendering.Vertices method is horrendous. For eg. Have a id for a block like in the old days of minecraft, that stone had an ID of 1 and with that ID you can index in a blockAtlas array[num_blocks, 6] (beutiful syntax of C#) and the array would hold indexes of texture in texture atlas. Also, you should handle the size of the texture altas, if it's invalid, then set a default texture for a particular texture, like minecraft does, so you could have texture pack for only couple of blocks
Hey sorry for asking you but I am very passionate and interested in making a Game in C++ but I have only knowledge of basic C++ and because this is my first computer language I am lacking the very foundation area of game development. Can you give me advice on how I should learn the C++ with a more advanced system and game development. And thank you
I learned it because I needed it at my job, but I already knew other languages so it was easy to transfer my knowledge. As for how hard it is to learn, I wouldn't say it's that hard, but you might find it a bit difficult to learn the oop concepts at first, but you don't need to know them very well to use the language. Still a lot easier than lower level languages like C++, C, Rust, etc, but not as easy as JavaScript or Python. (Definitely better than Java though)
Most original TH-cam content ever. Also, the more you beg people to subscribe, the cheaper your content looks. There's a reason why people (should) leave that at the end of the video.
Thanks for the feedback! I know it's not original, but I'm having fun at least :) Also, I wouldn't say I totally agree with you on the second part, but I can see how it can be annoying to some people or make the content seem lower quality. I'll keep it in mind
Can't you write some original criticism? Firstly it's hard to make original game dev content. And as he said multiple times in the video it was a lot of fun. If he would have come up with a completely original idea it maybe wouldn't be as fun and therefore not worth his time. And secondly, people ask for people to subscribers because it works. It probably won't make people suddenly start liking his content if they didn't before, but for the people who did like it's a reminder. "Right! I actually liked his content and I want to watch more of it." Otherwise they might have forgotten and just moved on.
Thanks, and even if it's unnecessary criticism, they took their time to write a comment about something they didn't like about the video, so I appreciate that.
@Cnastret my comment was criticism. I told him what I didn't like(the sub beg) and how to fix it(leave it at the end of the video). If you find that "unnecessary criticism", then it just shows that you can't handle criticism. Besides, you shouldn't be talking for him like a child. He can speak for himself(and has). But also just because it works, doesn't mean people gotta be annoying about it.
It was for a few years, but they received a huge donation last year from Re-Logic (the guys who made Terraria), they made an organization, and now they are offering bounties for certain issues, so the project is picking up again, there's also a lot of support from the community, and they finally released a new version a few months ago, with more to follow.
I wanna make a clone as well but my laptop isi soo bad it cont run unity propally. btw i couldn't join your discord server. I'm a youtber as well i just sadly dont have the time for it, and i only can upload a video in every 4 months. It is not good.
Fortunately you can make cool things even without a game engine, I used MonoGame, but if you want you could go even lower level and try c++ or c for extra performance, although it would be a lot harder.
Let's gooo, another Minecraft clone I love it 💪💪
Omg, no way, I'm your biggest fan!! 💪💪
@vycdev Nah bro I am😎
I also might make Minecraft in C with my Vulkan app I might make into an engine
😊
@5DPixelhold my beer
good job bro
Im so excited for CE part 2 to release
Hyper cube brain makes me pay attention (0:19)
You should continue this series about mc clone and you should definitely make your own texture designs, I support you with all my feelings bro
"i mean is it even from scratch if you are not writing it in pure x86 assembly without any libraries"
I should build my own computer on a breadboard and programm it to run minecraft xd
@@vycdev gonna need alot of sand for that
@@vycdev u should make the breadboard first
good job brother keep going
Nice project! 🟩
YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES, FINALLY MINECRAFT WITH CSHARP!
Yea what's the point...
That's a really good question!
You have lots of easy optimizations.
In your shader you use a float3 for position which you can reduce to a uniform variable for the chunk position and then convert vertex positions in the 16x16x16 chunk mesh to a 1d position which would have 17^3=4913 values which would require 2^13 bits. Meaning you can easily fit a vertex position into a single integer and then also use the rest of the bits for a cube face normal and texture id. Then you get the texture from a buffer or sampler2DArray or texture atlas if all textures are the same size or whatever else. This combines nicely with greedy meshing for using less vram.
Idk how you store chunks but RLE is an easy optimization for storing voxels in a chunk especially since you can also easily and quickly know if a chunk is made up of a single block or completely empty.
Also idk how you map textures to cube faces but in a old project of mine which uses greedy meshing I used this and I remembered it being pain to get to
Fragment shader:
void main() {
vec2 tileUV = vec2(dot(vec3(-normal.x, normal.zy), position.zxx), position.y + normal.y * position.z);
vec2 finalTexCoord = fract(tileUV);
...
}
Indeed, I spent a lot of time trying to pack that vector3 position in my shader into a single float value, but it took me too long and eventually I decided to give up for the moment and try again later. Thank you for the suggestions
@@vycdevok if you try again here is my own vertex shader from my own old voxel engine if you want to use it.
#version 300 es
// map index to normal
const vec3 NORMALS[6] = vec3[6](
vec3(1.0, 0.0, 0.0),
vec3(-1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, -1.0, 0.0),
vec3(0.0, 0.0, 1.0),
vec3(0.0, 0.0, -1.0)
);
const float AO_COLOURS[4] = float[4](
0.2,0.4,0.6,0.8
);
layout (location = 0) in int data;
flat out int textureID;
out vec3 position;
out vec3 normal;
out float ao;
uniform mat4 cameraMat;
uniform ivec3 chunkPos;
vec3 convert1DTo3D(int index) {
int x = index % 17;
int y = (index / 17) % 17;
int z = index / (17 * 17);
return vec3(float(x), float(y), float(z));
}
void main() {
normal = NORMALS[data >> 13 & 0x7];
position = convert1DTo3D(data & 0x1FFF);
ao = AO_COLOURS[data >> 16 & 0x3];
textureID = data >> 18 & 0x1FFF;
gl_Position =
cameraMat *
mat4(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
chunkPos.x, chunkPos.y, chunkPos.z, 1.0
) *
vec4(position, 1.0);
}
Damn.. I respect you making it in MonoGame! 🙏
Even if it's another Minecraft clone, this is still really impressive!
looking at some of your code (as a junior programmer myself), I wish you could teach me to write better and more professional code. At this moment in my journey I would never be able to or even know how to do most of these things (e.g. the generation, mesh building, the whole new rendering engine you made, …)
I consider my code right now to be pretty bad on this project 😅, but I plan on improving it with time.
I didn't really know how to do them either at first, I just searched on the internet or asked ChatGPT, because I am a web developer so I don't have much game dev knowledge aside from some concepts.
Nice Video Keep it up :D
3:12 debug virtual meme has 2 tb lol
Lets go wow very good
Nice work ! 🟩
Another minecraft clone and im here for it, can you share with us resources
I have left the link to the source code in the description. (I also have some links in the README.md to articles or videos that helped me)
subscribed :)
Nice! 🟩
Woah can you please make a c++ im trying to get familiar with it :D
Unfortunately I don't have that much experience with C++, and the biggest turnoff for me is the build system. I can recommend you to watch Low Level Game Dev as he makes C++ videos, and has a lot of tutorials and even a minecraft clone which is a lot more advanced than mine for sure :D
@@vycdev thank you, Ill definetly make sure to check him
imma make a minecraft clone,, and then drop it
Now make a programing language in C# (I did 2 by my self)
I already made one for my final project for university. It was pretty cool to make it. You can find it here if you are curious: github.com/vycdev/cequel-interpreter-lib
@vycdev thanks, I made an interpreted and compiled one, for the compiled one I recommend ILAsm
@ Haven't made a compiled one yet, but for the one that I made, I made a parser generator and wrote the rules for the language that I needed. I read Crafting Interpreters to figure how to do that because it was pretty hard, but I learned a lot.
Implement a better way to use the texture atlas please, the BlockRendering.Vertices method is horrendous. For eg. Have a id for a block like in the old days of minecraft, that stone had an ID of 1 and with that ID you can index in a blockAtlas array[num_blocks, 6] (beutiful syntax of C#) and the array would hold indexes of texture in texture atlas. Also, you should handle the size of the texture altas, if it's invalid, then set a default texture for a particular texture, like minecraft does, so you could have texture pack for only couple of blocks
Hey sorry for asking you but I am very passionate and interested in making a Game in C++ but I have only knowledge of basic C++ and because this is my first computer language I am lacking the very foundation area of game development.
Can you give me advice on how I should learn the C++ with a more advanced system and game development. And thank you
RIP Bitrate
ggs
Omg you made it Open-Source???
@@OpenSourceGuyYT yep
Now do it with vulkan and c++ (cool project btw)
Thanks, I will now proceed to spend the next 2 months writing the code to open a game window
It’s took 3tb????
Nice 🟩🟩
Bro how did u learn c#? ANd is it an easy language to learn?
I learned it because I needed it at my job, but I already knew other languages so it was easy to transfer my knowledge. As for how hard it is to learn, I wouldn't say it's that hard, but you might find it a bit difficult to learn the oop concepts at first, but you don't need to know them very well to use the language. Still a lot easier than lower level languages like C++, C, Rust, etc, but not as easy as JavaScript or Python. (Definitely better than Java though)
I would be careful saying you copied "Minecraft". Microsoft is very litigious.
dam
Most original TH-cam content ever. Also, the more you beg people to subscribe, the cheaper your content looks. There's a reason why people (should) leave that at the end of the video.
Thanks for the feedback! I know it's not original, but I'm having fun at least :)
Also, I wouldn't say I totally agree with you on the second part, but I can see how it can be annoying to some people or make the content seem lower quality. I'll keep it in mind
Can't you write some original criticism?
Firstly it's hard to make original game dev content. And as he said multiple times in the video it was a lot of fun. If he would have come up with a completely original idea it maybe wouldn't be as fun and therefore not worth his time.
And secondly, people ask for people to subscribers because it works. It probably won't make people suddenly start liking his content if they didn't before, but for the people who did like it's a reminder. "Right! I actually liked his content and I want to watch more of it." Otherwise they might have forgotten and just moved on.
@@vycdev I think that this isn't even feedback. It's just bad and unnecessary criticism. Your content is awesome! Keep it up!
Thanks, and even if it's unnecessary criticism, they took their time to write a comment about something they didn't like about the video, so I appreciate that.
@Cnastret my comment was criticism. I told him what I didn't like(the sub beg) and how to fix it(leave it at the end of the video). If you find that "unnecessary criticism", then it just shows that you can't handle criticism. Besides, you shouldn't be talking for him like a child. He can speak for himself(and has). But also just because it works, doesn't mean people gotta be annoying about it.
Isn't MonoGame dead by the way?
It was for a few years, but they received a huge donation last year from Re-Logic (the guys who made Terraria), they made an organization, and now they are offering bounties for certain issues, so the project is picking up again, there's also a lot of support from the community, and they finally released a new version a few months ago, with more to follow.
@vycdev that's funny, I know only one commercially successful game built on it, and that's Terraria.
@hardwares There's also Celeste, Fez, and Stardew Valley
Oh shit…
No you didn’t. You copied something.
I can copy Harry Potter in a week. Doesn’t mean I ‘made Harry Potter in a week’.
I wanna make a clone as well but my laptop isi soo bad it cont run unity propally. btw i couldn't join your discord server. I'm a youtber as well i just sadly dont have the time for it, and i only can upload a video in every 4 months. It is not good.
Fortunately you can make cool things even without a game engine, I used MonoGame, but if you want you could go even lower level and try c++ or c for extra performance, although it would be a lot harder.
I AM 1000TH SUBSCRIBE YES
🟩
E
first
🟩🟩🟩🟩
🟩
🟩
🟩👍
🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩