I once heard a programmer on discord say: "Its better to dig around coal until you find a diamond, than spending years trying to turn coal into diamond", and i think its pretty fitting.
its better to go to a known diamond mine that isnt fully mined out similarly its better to see if someone has solved a problem or a similar one much more efficiently
Yeah, I think that code performance, and good architecture is important, but I learned at some point that especially when you trying to solve a complex problem, especially when you haven't solved similar problems, you can't make it good immediately. And this is what slowed me down. And even sometimes I just gave up because I was trying to make something impossible for the first try. When you at least have an already working implementation, you can see more clearly how you can improve it. Sometimes you anyway can't know how to do this, but you just need some time. Better continue working on other parts of your project, and, what's happened to me a lot of times, one day you understand how to make it really better.
The raycast example reminds of me a block game I was working on. I knew I could transform points from world space to camera space, do a triangle point intersection, and sort intersections from closest to furthest. What I created was a horrific algorithm that took every block in a certain radius of the player, got the mesh data of that block (it was already available for the chunk meshing algorithm), transformed it to screen space as if it was going to be drawn, tested each triangle if it's inside the block, and added the intersections into a list be sorted and the closest one chosen. I was actually pretty proud of it at the time. That entire codebase was full of nonsense algorithms like that, but in my defense it was my first ever substantial coding project.
yeah the algorithm sounds horrible indeed 😂, btw you can implement mouse picking more easily by rendering into an offscreen buffer. It is cool that you managed to make it tho
Brute force is the method I use when I can't stop overthinking things. If I turn my brain off and just have something tangible it makes a world of difference
I was working on my own Minecraft clone recently for fun, and ran out of steam when I started working on the raycasting. There were a lot of possible optimizations and other considerations to make, which just made my head spin. I did implement a simpler 2D raycasting algorithm that worked, but extending it to 3D was tedious and complex. I might use this brute-force approach though in my own code, if I ever get back to it.
@@friedrichmyers Yes, I was thinking of implementing the Bresenham line algorithm. This would work fine for simple block placement and removal, but what about intersecting slabs, fences, and other special block shapes? What about intersecting entities? How should I handle chunk borders? I should've just settled for something simple, but overthinking is my worst habit. I was making considerations like this for the entire codebase, so I burned out.
in your clone make optimizations so that blocks visible further away that have a light level of 0 are not rendered. Or display these blocks as a black box with no texture.
yoo, I read your comment, unfortunatelly it's not that easy. First of all there is always ambient light so those blocks aren't completely black, also you would introduce an if in the shader thar can be an optimization or do harm depending on some things. Also there wouldn't be that many pixels on the screen to save on
yo I started with cpp, others start with python, honestly I think c is a great option, just go for it don't overthink what tutorial to choose, just start learning and making projects 💪
I would event extend to say that optimization is least imporant of important things. Even with live products you optimize when somebody complains and you might lose money/reputation, not just for the sake of it. Ofc sometimes you need to optimize at the point in your code beyond which it would be a bigger hassle later on.
I once heard a programmer on discord say: "Its better to dig around coal until you find a diamond, than spending years trying to turn coal into diamond", and i think its pretty fitting.
that's a very inreresting quote, I like it 💪
Ain't gonna lie, it sounds kinda stupid to me
doesn’t make any sense
its better to go to a known diamond mine that isnt fully mined out
similarly its better to see if someone has solved a problem or a similar one much more efficiently
We all know diamonds grow near lapis lazuli not coal
If one if/else block isn't enough, add another one
1:59 "It might be haa~😩-alf~ a block up..."
Yeah, I think that code performance, and good architecture is important, but I learned at some point that especially when you trying to solve a complex problem, especially when you haven't solved similar problems, you can't make it good immediately. And this is what slowed me down. And even sometimes I just gave up because I was trying to make something impossible for the first try.
When you at least have an already working implementation, you can see more clearly how you can improve it. Sometimes you anyway can't know how to do this, but you just need some time. Better continue working on other parts of your project, and, what's happened to me a lot of times, one day you understand how to make it really better.
The raycast example reminds of me a block game I was working on. I knew I could transform points from world space to camera space, do a triangle point intersection, and sort intersections from closest to furthest.
What I created was a horrific algorithm that took every block in a certain radius of the player, got the mesh data of that block (it was already available for the chunk meshing algorithm), transformed it to screen space as if it was going to be drawn, tested each triangle if it's inside the block, and added the intersections into a list be sorted and the closest one chosen. I was actually pretty proud of it at the time. That entire codebase was full of nonsense algorithms like that, but in my defense it was my first ever substantial coding project.
yeah the algorithm sounds horrible indeed 😂, btw you can implement mouse picking more easily by rendering into an offscreen buffer. It is cool that you managed to make it tho
man i love your videos ❤
thank youu 💪💪
Brute force is the method I use when I can't stop overthinking things. If I turn my brain off and just have something tangible it makes a world of difference
Sometimes it just goes all above my head but indeed I like to watch 😊
I was working on my own Minecraft clone recently for fun, and ran out of steam when I started working on the raycasting. There were a lot of possible optimizations and other considerations to make, which just made my head spin. I did implement a simpler 2D raycasting algorithm that worked, but extending it to 3D was tedious and complex. I might use this brute-force approach though in my own code, if I ever get back to it.
Can't you just make an equation of a 3d line that satisfies two points where one point is on the player and the other being done with bruteforce?
@@friedrichmyers Yes, I was thinking of implementing the Bresenham line algorithm. This would work fine for simple block placement and removal, but what about intersecting slabs, fences, and other special block shapes? What about intersecting entities? How should I handle chunk borders? I should've just settled for something simple, but overthinking is my worst habit. I was making considerations like this for the entire codebase, so I burned out.
in your clone make optimizations so that blocks visible further away that have a light level of 0 are not rendered.
Or display these blocks as a black box with no texture.
yoo, I read your comment, unfortunatelly it's not that easy. First of all there is always ambient light so those blocks aren't completely black, also you would introduce an if in the shader thar can be an optimization or do harm depending on some things. Also there wouldn't be that many pixels on the screen to save on
I wish that was possible at work :/
But our iteration times are 4-5 min locally, and 2-4h in the cloud
My men be working on his own Bedrock 😂😂
Bro we need OpenGL tutorials!🗣️
yooo, on it 💪 the next tutorial is on OpenGL debugging 💪💪💪
What would you recommend for beginner in programing? I was thinking about learning c as first language.
yo I started with cpp, others start with python, honestly I think c is a great option, just go for it don't overthink what tutorial to choose, just start learning and making projects 💪
Ok thanks@@lowlevelgamedev9330
Me on my way to write 1,000,000 if/else for my A.I. project
if gpt best ai
I would event extend to say that optimization is least imporant of important things. Even with live products you optimize when somebody complains and you might lose money/reputation, not just for the sake of it. Ofc sometimes you need to optimize at the point in your code beyond which it would be a bigger hassle later on.