I Remade my Voxel Engine from Scratch...

  Рет қаралды 11,045

MaxMakesGames

MaxMakesGames

Күн бұрын

Пікірлер: 66
@finalforeach
@finalforeach Жыл бұрын
The nice thing about the prototype stage is that you don't need to be scared of tech debt... Rewrites galore!
@ragdude7323
@ragdude7323 11 ай бұрын
Nice seeing you here.
@ragdude7323
@ragdude7323 10 ай бұрын
I got terrible memory, saw this video again, saw this comment again and was about to comment “Nice seeing you here.” Again
@half_invisible
@half_invisible 8 ай бұрын
@@ragdude7323 no way, i literally did the exact same thing for a finalforeach comment on another voxel game dev video :p
@talis1063
@talis1063 11 ай бұрын
OpenGL would've been fine if you understand the limitations. In OpenGL you can mapBuffer on main thread, fill it on a different thread and pass an event to main thread that unmaps it again. The highest performance approach is probably allocating a large buffer, and using something like glMultiDrawElementsIndirect to render stuff. Can basically implement a custom allocator that way, and render opaque chunks with a single draw call. The thing not clear about OpenGL is that you're writing commands to memory not executing them on the GPU directly. Important to know to avoid freezing.
@kpopalitfonzelitaclide2147
@kpopalitfonzelitaclide2147 11 ай бұрын
You could just use vulkan and c++
@Lemonzy
@Lemonzy Жыл бұрын
Very cool! I love Rust and Bevy, it's easy to get started but it can sometimes be difficult.
@orangomango
@orangomango Жыл бұрын
Really nice videos, I'm making a voxel engine too (just that it's taking me like a few months lol) and I randomly discovered your videos. Great work!
@MaxMakesGames
@MaxMakesGames Жыл бұрын
Cool, thanks!
@MaxIzrin
@MaxIzrin 10 ай бұрын
"Max is stupid" Extremely relatable. I also remake my whole [insert project here] from scratch on occasion.
@oglothenerd
@oglothenerd Жыл бұрын
Do you use Git for version control? It allows you to rollback if you make mistakes.
@MaxMakesGames
@MaxMakesGames Жыл бұрын
I don't use Git right now but I might. And yes I'm using Bevy !
@oglothenerd
@oglothenerd Жыл бұрын
@@MaxMakesGames OMG! You are shooting yourself in the foot without Git! You MUST use it! Not using Git is one of the painful mistakes early programmers make! Just learn the basics. You can get away with just knowing the add, commit, restore, and maybe some other Git commands.
@oglothenerd
@oglothenerd Жыл бұрын
@@MaxMakesGames Shameless plug: I may make a simple Git guide on my channel later.
@AndrewBrownK
@AndrewBrownK 11 ай бұрын
Thinking about TNT in minecraft, the performance on your engine is looking really promising so far
@AdamElMenshawi
@AdamElMenshawi 20 күн бұрын
To optimize the engine you can use ocular exclusion
@ThePC007
@ThePC007 3 ай бұрын
What GPU are you running this on? I’m currently trying to render voxels myself and it’d be kinda nice to put the performance you’re getting into perspective. :)
@MaxMakesGames
@MaxMakesGames 3 ай бұрын
I have an nvidia geforce RTX 3060 :)
@RicardoRocky0
@RicardoRocky0 2 ай бұрын
Step 1. Making a voxel engine from scratch Step 2. Remaking my voxel engine from scratch Step 3. Recreating a computer from scratch
@Skeffles
@Skeffles Жыл бұрын
Brilliant! How do you like working with bevy and rust?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
I feel like bevy is easier than just raw graphics api, but also harder than common game engines like unity or unreal. You still have to do a lot of low-level work but it helps with spawning things and basic features like PBR, transparency, etc and also has an ECS so that helps for managing a lot of entities ( it will be a big help later if I want to make pieces fall to the ground and stuff I bet ). Rust is actually pretty similar to c++ but it has a lot more safety so I don't get memory leaks and crashes like I did in c++, but it's a bit harder to use imo.
@PotionScape
@PotionScape 10 ай бұрын
In the unity game im making, I somehow got it up to 1 billion voxels rendered, but that is like, totally out of the use cases that i would need
@MaxMakesGames
@MaxMakesGames 10 ай бұрын
How do you even store 1B voxels in memory ? Each one has to be at least 4 bytes so that's a minimum of 4Gb and going through that would take a while even with an octree
@naterthan5569
@naterthan5569 Жыл бұрын
If you only turned on release mode at 8:00, does that mean that the performance tests in the middle of the video were also in debug mode?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
Yes haha but I think using debug mode only caused lag when I had multiple entities ( aka chunks once I added the loading ). Before I added the loading, the whole thing was 1 entity so it probably didn't affect much.
@the0neskater
@the0neskater 8 ай бұрын
I can assure you opengl and c++ were not your issues haha...
@MaxMakesGames
@MaxMakesGames 8 ай бұрын
You are right actually it wasn't :P
@IsaacCode95
@IsaacCode95 Жыл бұрын
So theres no way to achieve the same with c++ and vulkan instead of opengl ?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
I think it's possible for sure, but rust offers a lot of tools for multithreading like rwlock, arc, etc. that makes it easier to manage multithreading without having errors, crashes, etc due to data race. With c++ you would have to use mutex and stuff like that which would end up locking the thread often ( at least that's what happened to me ) and it's just overall more difficult to manage. Rust will prevent you messing up so it's cool for that, but if you're really careful you could probably do the same thing in c++.
@Joerje
@Joerje Жыл бұрын
ofc there is but what's even the point of dev if you don't rewrite shit in rust?
@FrankGennari
@FrankGennari Жыл бұрын
@@MaxMakesGames In C++ you can use OpenMP and put a parallel for loop around the iteration over blocks to update. This is how I do it. The large edits that cross multiple blocks are the ones that cause lag and also the ones that distribute well across threads.
@tadeohepperle7514
@tadeohepperle7514 Жыл бұрын
From your experience, would you say that creating inividual triangulated meshes from voxel data first, is much better than sending the voxels to the GPU as simple primitives (quads) using instancing?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
It's a bit more difficult to implement but not that much and it's a lot better in terms of performance!
@tadeohepperle7514
@tadeohepperle7514 Жыл бұрын
@@MaxMakesGames That is really great to hear! What size are the individual meshes you generate from the voxels? E.g. what kind of voxel volume / triangle count do they cover? One mesh for each loaded chunk?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
@@tadeohepperle7514 Right now I create 1 mesh per chunk and my chunks are 50x50 but I might reduce the chunk size because it becomes a bit laggy when doing queries for collisions and stuff. At this size the meshes are around 10k vertices I think but it depends on how flat the surface is. Flat means less side faces so less vertices and triangles. I also started generating structures on them so that increases the count a bit because I put them in the same mesh, but I might seperate them to facilitate physics later.
@tadeohepperle7514
@tadeohepperle7514 Жыл бұрын
@@MaxMakesGames Thanks! Btw how are you doing collisions and raycasting for picking a block with the cursor?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
I'm actually not 100% sure how my raycasting works lol I think I found it online and it's been a while so idk where, but here's the code in rust: pub fn raycast_hit_cube_pos_dist(cubepos: Vec3, raycastPos: Vec3, raycastDir: Vec3, dist: f32) -> Vec3{ let halfsize = 0.05; let dirInv = 1.0 / raycastDir; let tMinVec = (cubepos - halfsize - raycastPos) * dirInv; let tMaxVec = (cubepos + halfsize - raycastPos) * dirInv; let t1 = Vec3::min(tMinVec, tMaxVec); let t2 = Vec3::max(tMinVec, tMaxVec); let tNear = f32::max(f32::max(t1.x, t1.y), t1.z); let tFar = f32::min(f32::min(t2.x, t2.y), t2.z); if (tNear > dist || tNear > tFar || tFar < 0.001) { return Vec3::new(-10000.0,-10000.0,-10000.0); } return raycastPos + tNear * raycastDir; } halfsize is half the size of my cubes/voxels so mine are 0.1x0.1 so 0.05 halfsize. it checks from the raycastPos in the raycastDir if cubepos is hit within dist distance. If not it returns a -10000 vector and if so it returns the pos hit ( you could also just make it return false/true if you dont care about pos hit ). I just run that on every cube in the chunk and if there's no hits, move to the next chunk in the aim direction and check again. That's why I think I'll reduce my chunk size because looping 50x50 cubes for no hit is very bad lol. It can prob be optimized too but I hope that helps.
@agoatchannnel
@agoatchannnel Жыл бұрын
Why did you say “my videos suck” on discord, there really good
@AIAdev
@AIAdev Жыл бұрын
pigboss x max collab? sus.
@MaxMakesGames
@MaxMakesGames Жыл бұрын
Wait until I add a pig boss to my game before you :)
@HAAAAAAAAHHHHHH
@HAAAAAAAAHHHHHH Жыл бұрын
Not really related to the video, but are you from Quebec ? xd
@MaxMakesGames
@MaxMakesGames Жыл бұрын
Yeah 😎
@HAAAAAAAAHHHHHH
@HAAAAAAAAHHHHHH Жыл бұрын
@@MaxMakesGames damn thats cool, i haven't seen any youtuber from there make coding/gamedev videos before
@oglothenerd
@oglothenerd Жыл бұрын
Do you have a Discord server?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
No sorry I don't because it takes a lot of time to manage and everything. I prefer to spend my time on my projects and videos
@oglothenerd
@oglothenerd Жыл бұрын
@@MaxMakesGames Could I be the moderator? Or could you at least point people to mine? I want there to be an environment where devs can talk to each other about this channel and stuff, I want to verify that you have the correct Bevy settings in Cargo.toml, etc... Also, Discord has a pretty good (annoyingly good) AutoMod.
@delphicdescant
@delphicdescant 9 ай бұрын
The Rust hype is greatly overplayed tbh. You could have done just as well, just as easily, with C++. Mostly it's just usually not worth switching languages or API's based on popularity contests, and sticking to something that you're familiar with has a greater advantage imo. But I'm not criticizing you - just hoping you don't get stuck in a loop of "stack switching" like sometimes happens to programmers' hobby projects.
@stiliok
@stiliok Жыл бұрын
What AI did you use? 2:53
@MaxMakesGames
@MaxMakesGames Жыл бұрын
The bing AI :) I just open Microsoft Edge and it's there, but idk if you can use it in an other browser. It's cool because it can search online. An other cool option is www.phind.com/ it's similar
@AdamElMenshawi
@AdamElMenshawi Ай бұрын
Make this open source or make a tutorial with source code
@MaxMakesGames
@MaxMakesGames Ай бұрын
@@AdamElMenshawi It's too big for a tutorial and maintaining code quality for open source would require a lot of work :(
@AdamElMenshawi
@AdamElMenshawi Ай бұрын
@@MaxMakesGames ok it's alright but amazing game
@ImGelling
@ImGelling Ай бұрын
If mineceaft Java exists, YOU DONT NEED OTHER Languages. If they cab do it, so can you.
@MaxMakesGames
@MaxMakesGames Ай бұрын
@@ImGelling Minecraft java is terribly inefficient tho... Why do you think they made a new one?
@Gabriel-rg7cy
@Gabriel-rg7cy Ай бұрын
​@@MaxMakesGames this is the point. If they made such a banger with so little, just go with the flow
@Vilebreken
@Vilebreken Жыл бұрын
Do you speak french?
@MaxMakesGames
@MaxMakesGames Жыл бұрын
oui bien sûr :)
@Vilebreken
@Vilebreken Жыл бұрын
ça fait du bien de pas etre le seule baguette a regarder ce genre de vidéos mdr@@MaxMakesGames
@toao_rainys
@toao_rainys Жыл бұрын
not as impressive since you used an engine 😤anyways, the shadows finally look good though.
@AllExistence
@AllExistence Жыл бұрын
NOT from scratch.
@PeterKilian
@PeterKilian 6 ай бұрын
What the fuck are your expectations? Do you want a single person to somehow create a renderer, physics engine, input and windowing api, and everything like.. LITERALLY from scratch? On top of needing to need deadlines for his content creation? Seriously? He doesn’t need to be Id software to make something without a typical “game engine” and still have it be impressive and entertaining. Where is your game engine from scratch in assembly, that uses no external code? I think rust and vulkan is respectable by a single dev.
@AllExistence
@AllExistence 6 ай бұрын
@@PeterKilian Don't fucking lie then.
@PeterKilian
@PeterKilian 6 ай бұрын
@@AllExistence it isn’t a lie? there isn’t 1 way (your way) to interpret the phrase “from scratch”. When he says without a game engine, then that can still be interpreted as from scratch to an extent without him needing to create his own fucking OS for a youtube video.
@PeterKilian
@PeterKilian 6 ай бұрын
Maybe get him to build the computer from scratch too with a hammer and nails he built from scratch!
I Added RAYTRACING To My Voxel Engine ! ( From SCRATCH )
13:39
MaxMakesGames
Рет қаралды 9 М.
YOUR IDEAS Made My Voxel Engine EPIC
9:11
MaxMakesGames
Рет қаралды 3,2 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 31 МЛН
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,7 МЛН
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 33 МЛН
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 88 МЛН
I Remade Minecraft But It is Optimized!
9:39
Low Level Game Dev
Рет қаралды 108 М.
Making a Voxel Engine from SCRATCH (w/ Destruction)
14:31
MaxMakesGames
Рет қаралды 37 М.
Making my Voxel Engine faster
16:38
Tantan
Рет қаралды 46 М.
I could NEVER finish a game UNTIL THIS...
9:17
DevWhale
Рет қаралды 55 М.
I Spent 2,000 Hours Using Scratch
13:59
ggenije
Рет қаралды 627 М.
Trying OTHER PEOPLE'S voxel game engines
20:02
Douglas
Рет қаралды 11 М.
Blazingly Fast Greedy Mesher - Voxel Engine Optimizations
23:35
I Added Procedural Generation to My Voxel Engine !
10:20
MaxMakesGames
Рет қаралды 7 М.
I Designed Custom Minecraft Weapons…
9:21
Daniel Krafft
Рет қаралды 180 М.
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 31 МЛН