I Optimised My Game Engine Up To 12000 FPS

  Рет қаралды 462,540

Vercidium

Vercidium

Күн бұрын

The source code and demos are available here: / vercidium
The greedy meshing algorithm is available here: github.com/vercidium-patreon/...
I spent the past 6 years creating a game engine, and I've been shocked at the things that can make or break performance.
I put together 4 simple optimisations that you can use to make your games run much quicker.
The music is Saturation, Spectrum, Shadows Azure and Chroma-quay by Disjoint Square
disjointsquare.bandcamp.com
Timestamps
0:00 Intro
0:33 Massive Meshes
1:56 Tiny Triangles
4:51 Particle Perfection
7:34 Dont Talk So Much
9:22 Limit Breaker
10:43 The Finals
11:33 Optimise Further
#gamedev #gamedevelopment #gameengine

Пікірлер: 1 700
@astreakaito5625
@astreakaito5625 2 ай бұрын
Just unironically assume your game need to run ok on a PS2
@lorenzvo5284
@lorenzvo5284 2 ай бұрын
Actually that makes me wonder how good a voxel game would actually run on the ps2 since the graphics hardware is so esoteric compared to something that supports opengl. There probably would be some optimizations like the ones in this video but maybe other ones are also possible
@roberthickman4092
@roberthickman4092 Ай бұрын
​@@lorenzvo5284I'd imagine you could use VU2 to perform very similar optimisations. The channel 'gamehut' discusses a very similar approach in optimising a PS2 particle system.
@informagico6331
@informagico6331 Ай бұрын
No jokes, a reduced render distance version of this game could actually run on a Nintendo DS
@LumStormtrooper
@LumStormtrooper Ай бұрын
Get yourself a shitty Dell laptop from the early 2010s and optimize it to run at 60 FPS on that.
@MalessaHolt
@MalessaHolt Ай бұрын
@@LumStormtrooper Someone on an early 2004 laptop of a brand you've never heard of will still complain about performance lmao
@turoklive5329
@turoklive5329 2 ай бұрын
Please show this to Mojang
@Waterdog37
@Waterdog37 Ай бұрын
Yes
@RiversJ
@RiversJ Ай бұрын
They know, practically guaranteed that graphics engineers have thought of most of these. The question that rises is, will it be worth the number of hours spent on refactoring huge chunks of an existing working solution. Most likely the answer is hell no. This solution also wouldn't fit all the usecases in minecraft, so they'd need bespoke solutions for those edge cases. Final bill would be tens to hundreds of thousands of dollars minimum.
@fullyverified7491
@fullyverified7491 Ай бұрын
​@RiversJ Yeah no, given they took the time to completely rebuild the game in C++ (bedrock edition), they clearly can do these optimizations.
@inpoverty4128
@inpoverty4128 Ай бұрын
It's probably far too late to change the source code from Java to C++. It would probably make the modding community especially mad 😂
@seekyunbounded9273
@seekyunbounded9273 Ай бұрын
​​@@inpoverty4128wdym, bedrock is coded in c++ and the java edition well in java, they already done it
@Chizypuff
@Chizypuff 2 ай бұрын
Imagine somebody complaining on the forums about lag, then the next update they can play in 8k 200fps on their 10 year old setup. Insane.
@LavaCreeperPeople
@LavaCreeperPeople 2 ай бұрын
Lol
@GameBacardi
@GameBacardi 2 ай бұрын
What if players try 4K first...
@creeperlolthetrouble
@creeperlolthetrouble 2 ай бұрын
many of those optimizations sadly only work on voxel games like minecraft
@jc_art_
@jc_art_ 2 ай бұрын
​@@creeperlolthetrouble actually minecraft cant use alot of the things done in this video, like combining multiple voxels into one voxel, as each individual voxel can be interacted with by the player. These optimizations would work for most other voxel games though
@SketchyThe1th
@SketchyThe1th 2 ай бұрын
@@creeperlolthetroubleminecraft rly needs that if ur already addressing it 😭
@user-pt2rv6br6w
@user-pt2rv6br6w 2 ай бұрын
Damn, I can't imagine the amount of work you put to visualize all these incredible techniques.
@Vercidium
@Vercidium 2 ай бұрын
Some of these animations have the spaghettiest of spaghetti code, so I'm glad they paid off. Thank you :)
@simonnilsson1572
@simonnilsson1572 2 ай бұрын
This customer doesn't care what goes on in the kitchen, as long as the spaghetti is tasty. 👍@@Vercidium
@pro_gemer
@pro_gemer 2 ай бұрын
@@simonnilsson1572well said
@Andrii-zc4dp
@Andrii-zc4dp 2 ай бұрын
As an OpenGL beginner, this is scary and inspiring AF!!! Thanks!
@Vercidium
@Vercidium 2 ай бұрын
@@simonnilsson1572 this is my new favourite quote
@Blxz
@Blxz 2 ай бұрын
Not using the Todd Howard school of thought where you instead just blame gamers for not having modern high powered computers?
@cumburger69
@cumburger69 2 ай бұрын
its a next gen game though 😢😢
@vacucumber_enjoyer
@vacucumber_enjoyer 2 ай бұрын
Each optimization like this has limitations of it's own. Imagine trying to add a new mechanic, for example something that has elements of a voxel, but behaves differently.
@conspiracydawg
@conspiracydawg 2 ай бұрын
@@vacucumber_enjoyerWhich is where actually knowing what you're making comes in. Something I'm pretty sure he does know.
@thecrazything95
@thecrazything95 2 ай бұрын
Just fyi.. all modern games do these optimizations already. The first is just occlusion culling. That's not even a modern game thing, that's shit the of Doom did.
@onibean
@onibean Ай бұрын
these techniques work much worse / not at all when you consider the fact that most games arent voxel games with simple meshes and materials..
@astridwilde
@astridwilde 2 ай бұрын
I've made a voxel engine before and literally half of these optimizations never even occurred to me. Bravo
@Vercidium
@Vercidium 2 ай бұрын
I hope they help! And save you a lot of time :) this video is many years of trial and error summarised into 10 minutes
@ckpioo
@ckpioo 2 ай бұрын
​@@Vercidium woah!, that is extremely impressive please keep doing what you love
@ToyKeeper
@ToyKeeper Ай бұрын
I made a voxel engine once, but it was way back in DOS demoscene days before opengl or GPUs existed. None of these optimizations were even relevant then, since engines were all bespoke and didn't have so much extra processing to cut out. Today's engines are way waaaay better, but I kind of miss how simple things were. Rendering 64k voxels with textures, lighting, and detailed fluid physics running each frame on each voxel, even an old 486 could maintain 60 fps. Good times.
@stickguy9109
@stickguy9109 2 ай бұрын
I wish Minecraft had these optimizations it's devouring my ram and anything beyond 10 chunks of render distance will dip below 20 fps
@Dudex11a
@Dudex11a 2 ай бұрын
I'm rather curious on which of these optimizations does Minecraft have? Surely it's not as unoptimized to not have any of these
@manfredrichtoften8848
@manfredrichtoften8848 2 ай бұрын
​@@Dudex11a The very first one, as that is basically the reason any xray exploit even works. In game chunks are also split into "sub-chunks", which are just the chunks mentioned in this video. For everything else I can't say.😊
@IfeelKindaSick
@IfeelKindaSick 2 ай бұрын
There are mods that will bring you above that value
@idedary
@idedary 2 ай бұрын
Only face culling. Nothing more. Minecraft is a massive pile of tech debt. First issue is that it was written in Java. The state of the code is like a prototype that survived and went into production and tried to be fixed along the way. ​@@Dudex11a
@white_145
@white_145 2 ай бұрын
you can use mod Sodium that greately optimizes rendering
@weidiocrow
@weidiocrow Ай бұрын
So to summarize - Core principles: - CPU cycles expensive, GPU cycles cheap so we want to reduce CPU cycles by: - Passing as little data as possible to the GPU, which costs CPU cycles - Doing as few draw calls as possible to avoid redundant CPU cycles - Voxels have certain principles we can leverage mainly: - They exist at discrete coordinates in space - They're cubes, so only three sides are visible at a time - They have a uniform size - Techniques - Avoid drawing geometry the player won't see: - Internal faces - Backfaces(the counterclockwise vertices strips) - The three(or more) faces of the chunk the player can't see - Batch draw calls and info - Combine adjacent voxels into one mesh, forming a chunk - Combine adjacent faces sharing a normal to form "runs" that can be drawn as one face - Using instances, draw strips instead of triangles, - Use the symmetry of a cube to flip one strip into all six positions - Send one indirect buffer to the GPU in one draw call instead of by chunk - Reduce memory usage - Using the fact that voxels use discrete coordinates, ditch floats. - Pack location information, normal enum, length/width run info, and texture id into one 32-bit number - Use the fact that we're chunking in combination with the SSBO to further reduce information individual voxels must hold, so now voxel world info is only meaningful with the chunk info Wonderful video. The best part of this is how you took something "toyish" like voxels and showed off many optimization techniques that would be much hard to reason about otherwise.
@anon1963
@anon1963 24 күн бұрын
don't know where you got the idea that CPU cycles are expensive tbh
@TheJorge100
@TheJorge100 19 күн бұрын
CPU cycles arent expensive, transferring data to the GPU is expensive. Indirect draws can be more efficient because it allows you to upload all of the parameters needed to draw to the GPU and the gpu can do different calculations without having to communicate back and forth between the CPU and without having to set up fences to wait for the gpu
@sIkLeGAMING
@sIkLeGAMING 2 ай бұрын
Insane production quality! Explaining complex problems so precisely is quite the skill. You are as good at presenting what you know as you know it. Well played brother
@Vercidium
@Vercidium 2 ай бұрын
Thanks heaps! I'm glad they were conveyed well, these things are tricky to visualise
@tylercathey8848
@tylercathey8848 2 ай бұрын
@@Vercidium 11:25 i have an idea to optimize it further. what if you somehow combined the faces of the different chunks when needed because when you look at the long flat areas there are alot of unneeded extra triangles
@emanuel_orozco_rodriguez
@emanuel_orozco_rodriguez 2 ай бұрын
​@@tylercathey8848 That's an intresting point, however, since you are already doing everything in chunks, i belive combining them is going to be tricky, and not that good of an optimization .
@budgetarms
@budgetarms 2 ай бұрын
A few things I want to mention, not ever game uses clockwise order for culling. Just an example, DirectX and Opengl dont have the same winding order. And yes, basically every game uses culling in order to improve their game. Disregarding the fact that with some textures, fire, leafs, windows, the culling will be set to none.
@Vercidium
@Vercidium 2 ай бұрын
Yes excellent point. The winding order can be set to clockwise or anticlockwise in OpenGL, I just used clockwise as the example here for simplicity And yep there's no culling on leaves, but extra logic is needed to determine the normal direction, since it should be darker on the side that's facing away from the sun
@budgetarms
@budgetarms 2 ай бұрын
@@Vercidium Yeah, well that depends on what logic you use in your game, maybe the ambient lighting is for you already enough, and if you want phong shading added to that, then you will need even more variables.
@darthpotwet2668
@darthpotwet2668 2 ай бұрын
Apart from in minecraft
@budgetarms
@budgetarms 2 ай бұрын
@@darthpotwet2668 What??
@qlx-i
@qlx-i 2 ай бұрын
@@darthpotwet2668If you are not using any mods, you can see all 6 sides of leaves, which is usually described as "no culling"
@pseudo_goose
@pseudo_goose 2 ай бұрын
I already knew about a lot of this, but you demomstrated it so well that I couldn't stop watching. And then you dropped a BOMBSHELL of one mesh per face direction! I've always wondered how you could bulk discard those faces, and now its so obvious
@maxis_scott_engie_maximov_jr
@maxis_scott_engie_maximov_jr 2 ай бұрын
Edit: I have unintentionally started a war in replies and I feel guilty My brain is melting and thinking "How did nobody think of this earlier?" at the same time The amount of data that can be stored in a single 32bit integer is amazing
@trusterzero6399
@trusterzero6399 2 ай бұрын
This guy is just really smart. Normal people get the stock tools and just deal with problems or say stuff is impossible
@Poldovico
@Poldovico 2 ай бұрын
They did, a lot of this stuff does get used. If games like Minecraft were just rendering unlit, immobile scenes, they'd get thousands of FPS too.
@General12th
@General12th 2 ай бұрын
​@@PoldovicoI don't think Vercidium meant to imply that _all_ games lacked these optimizations and he's the first person to think of them. But plenty of games don't have them and plenty of programmers don't know about them, so.
@Poldovico
@Poldovico 2 ай бұрын
@@General12th Oh, I think this video is great, and a great way to explain these techniques. No knock on Vercidium here, it's just the realities of the KZfaq algorithm mean that the titles and thumbnails that will get you clicks will also mislead the viewers a bit, by framing a perfectly sensible video in a somewhat less sensible context. There's kind of an implied story here, intentional or no, that the games that frustrate us could run smooth as butter, at thousands of FPS even or on much weaker hardware, if only programmers cared enough to optimize, and that's unfortunately just not quite right. Improvement is always possible, to take the Minecraft example we have mods like Sodium, but I want to make clear the numbers in the video have a context to them that does not translate directly to a finished game.
@thegoldenatlas753
@thegoldenatlas753 2 ай бұрын
​@@General12thmost games don't use voxels. And alot of this is voxel only. And many games only use voxels for things like volumetric lighting, which doesn't have actual meshes.
@DevDunkStudio
@DevDunkStudio 2 ай бұрын
This is so impressive to see! Thank you for putting this much effort and knowledge into an understandable video. Hope to make these kinds of videos one day
@Vercidium
@Vercidium 2 ай бұрын
Thank you! I'm glad it helped make these concepts easier to understand
@SatisfiedOnion
@SatisfiedOnion 2 ай бұрын
Somehow you've outdone your previous videos... wow. This was incredibly easy to follow for a layman like me! One thing I'd be really interested in is learning about how you optimize for file sizes. Games these days are seemingly unapologetically massive. The recent Star Wars Classic Collection launch saw a (I think) 10x increase in file size without really anything added
@Vercidium
@Vercidium 2 ай бұрын
That is great to hear, thanks man! I hadn't considered doing a video on that, I'll add it to my list. I did some pretty tricky stuff with textures and maps in Sector's Edge to keep the download size small, that would be fun to talk about
@MrHamof
@MrHamof 2 ай бұрын
The new release has AI upscaled textures, which is presumably what they spent 40 gigabytes on. I'd expect they could have done less than half that and gotten an equivalent increase in visual quality though.
@Twistedpaolumu
@Twistedpaolumu 2 ай бұрын
@@Vercidium Unrelated to the video. Have you thought about integrating VR to your engine? A light version of sectors edge could probably run on Quest2 and 3.
@sentient9478
@sentient9478 2 ай бұрын
I'm pretty sure I understood maybe 10% of what was said in this video. On the bright side I'm now 10% more educated on how to optimize game engines using voxels. Great video. :)
@rmt3589
@rmt3589 2 ай бұрын
You didn't have to do this for me, but I appreciate it so much. Litterally made a bridge between the projects I've been planning, and did it in OpenGL. Thank you so much! You're awesome!
@Vercidium
@Vercidium 2 ай бұрын
I'm glad to hear! Happy to help
@Mad3011
@Mad3011 2 ай бұрын
Awesome video! Actually there is a way to "break up" triangle strips. When using index buffers you can set a special "Primitive Restart Index" value that the gpu interprets as the end of a triangle strip!
@reitinet
@reitinet 2 ай бұрын
it's basically called a "degenerate triangle" (one where 2 vertices are at the same spot) .. not sure if the GPU actually "recognizes" this (I doubt), but as it's a triangle with no area, it basically lets you render individual strips out of a big one - so it's basically free as there is no extra VS or PS involved
@appc23
@appc23 2 ай бұрын
5:28 Btw what you were looking for there was Primitive Restart. Allows to restart a strip without using degenerate triangles.
@Vercidium
@Vercidium 2 ай бұрын
Thank you :) that requires an index buffer though, which would use more memory (since the vertex data is already packed so tightly)
@distantrepublic
@distantrepublic 2 ай бұрын
You can use the same index buffer for every chunk.
@user-ir8on2ho4v
@user-ir8on2ho4v 2 ай бұрын
​@@Vercidiumisn't using index buffer reduce the matrix multiplications count in vertex shader?
@monfera
@monfera 2 ай бұрын
There is also the option to use degenerate, zero-area triangles to link non-contiguous meshes into a single triangle strip
@monfera
@monfera 2 ай бұрын
Oh I see in the video that you considered it too.
@tommycard4569
@tommycard4569 2 ай бұрын
Such an underrated channel. I've seen a lot of voxel rendering videos and this by far takes the cake. clear visualization, concise explanation, and thorough coverage of the topic. Very engaging for how informative it is
@Vercidium
@Vercidium 2 ай бұрын
That means a lot, thank you :)
@monawoka97
@monawoka97 2 ай бұрын
This is extremely well produced. The title is a bit click bait though, as all optimizations (other than backface culling) rely on the use of voxels. And few games use voxels. Still really cool!
@ordinarygg
@ordinarygg 2 ай бұрын
This is just insane quality of material/video/description/music/idea and result! Amazing!! Wish you huge success! And joining your patreon!
@XnecromungerX
@XnecromungerX 2 ай бұрын
Quite incredible, thank you for sharing this sort of stuff.
@Max-jq3qz
@Max-jq3qz 2 ай бұрын
This is amazing. Thank you so much for all the work you put into that video !
@whitneysmiltank
@whitneysmiltank 2 ай бұрын
One of the best channel I have discovered recently. Your stuff is awesome and very much educational. Well done.
@Stromoto
@Stromoto 2 ай бұрын
Damn it vercidium, that map you used as example made me nostalgic for sectors edge :(
@starplatinum3305
@starplatinum3305 2 ай бұрын
Lets gooooo, optimizations !!! Btw how about the data structure thingy can you make a vid about it ?
@Vercidium
@Vercidium 2 ай бұрын
Hey which data structure? For the voxels?
@starplatinum3305
@starplatinum3305 2 ай бұрын
@@Vercidium no no, any kind of optimisations data structure, i think, the "tree" things the octree quadtree or something
@Vercidium
@Vercidium 2 ай бұрын
@@starplatinum3305 ahh gotcha. I haven't worked with trees or octrees, but I've spent a lot of time optimising arrays for games, raycasting, particles, etc. I could do a video on that
@wizaral
@wizaral 2 ай бұрын
Maaaan, you accumulated the many info in one single video. That's astonishing! I looked for info about voxel games and yours is so well presented.
@RiesenpiIz
@RiesenpiIz 2 ай бұрын
Incredible explanation! I always struggled with OpenGL but your explanation is so clear that I wanna try to experiment with it again
@Vercidium
@Vercidium 2 ай бұрын
I highly recommend it! Any kind of visual programming is the most fun to experiment with
@ZuluboProductions
@ZuluboProductions 2 ай бұрын
Now this is some good optimization! It's amazing how much you can get away with when you know all your verts are on a regular grid. Splitting meshes based on face direction for quick backface culling is so clever.
@purplepelt3042
@purplepelt3042 2 ай бұрын
The simplistic way you put these optimizations into perspective is absolutely incredible. Many explanations I've seen miss this level of simplicity and make it sound much more complex than it needs to be.
@-ef
@-ef Күн бұрын
Insane effort went into this video, editing and code-wise, this is fascinating
@chaddicusthegreat
@chaddicusthegreat 2 ай бұрын
This was really cool, but honestly, with your description 4:02, I finally understand bit masking. So simple when you put it like that.
@Vercidium
@Vercidium 2 ай бұрын
It took me a while to wrap my head around it too, glad it helped!
@FirefighterVision
@FirefighterVision 2 ай бұрын
The optimisation level is insane! Thanks for the great insight and especially the well animated explanations.
@fanatic9752
@fanatic9752 2 ай бұрын
I am addicted to these optimization videos, you explain them so well
@wonkywonky6307
@wonkywonky6307 2 ай бұрын
This is fantastic. Wonderful job!
@ElZafro_
@ElZafro_ 2 ай бұрын
The explanations and visualizations were just astonishing! Thanks
@MrLonelyDK
@MrLonelyDK 2 ай бұрын
Great video man 🔥
@fiffy6572
@fiffy6572 2 ай бұрын
this video is amazing! i want to learn this stuff and your channel is a literal gold mine! thank you!
@Vercidium
@Vercidium 2 ай бұрын
Thank you! You are most welcome
@fiffy6572
@fiffy6572 2 ай бұрын
@@Vercidium 😁
@shawndeprey
@shawndeprey 26 күн бұрын
Buffers in the GPU are sick. I remember when I first learned of vertex buffers and they blew my mind. Your presentation of all these techniques is really well refined and summarized, great job dude. Loved the video.
@Teflora
@Teflora 2 ай бұрын
I love love love these kind of optimization videos! Very satisfying and educational!
@Chaos_insurgents
@Chaos_insurgents 2 ай бұрын
game dev stuff can get pretty crazy its cool to see all the little things that add up to make something "simple"
@pigable
@pigable 2 ай бұрын
I love this so much because everytime a bug comes, it gets fixed without me needing to do anything.
@Blap7
@Blap7 2 ай бұрын
absolutely LOVE the 3d visualizations and motion graphics. Very good video, with very good tips!
@SteamedToast
@SteamedToast 2 ай бұрын
Love the way this is all demonstrated with visual examples, makes it all very clear and easy to understand! Some very clever optimising.
@Finding_Fortune
@Finding_Fortune 2 ай бұрын
I'm glad there is another voxel optimization video out there! I used to just refer everyone to Hopson's voxel game mesh optimizations video, but this is way more detailed that that 😛
@Vercidium
@Vercidium 2 ай бұрын
Thank you for your help creating this video! I owe the face-in-SSBO optimisation to you
@Finding_Fortune
@Finding_Fortune 2 ай бұрын
@@Vercidium It was a pleasure ~
@StripeRose
@StripeRose 2 ай бұрын
Really great and pedagogical way to go through these techniques. Well visualised, well explained and neat showing how each level of optimization might lead into another that may not be possible before. Though the title is quite clickbaity, making it seem like it's techniques applicable to any and all games at first when it's pretty specific to this type of meshes and level data setup.
@KrarupJakob
@KrarupJakob Ай бұрын
Very well done! 😍 Excellent explanation and visualization!
@SeanDSandland
@SeanDSandland 2 ай бұрын
Incredibly well-put-together video, easy to follow and understand!
@Snoozy96
@Snoozy96 2 ай бұрын
A-are you the Gigachad of Optimization?
@Vercidium
@Vercidium 2 ай бұрын
Gigachad? That would use too much memory. I'd rather be the Kilochad
@MBSfilms77
@MBSfilms77 2 ай бұрын
@@Vercidiumbro 😂
@UNhaN_hgag
@UNhaN_hgag 2 ай бұрын
@@VercidiumThis is the best comment I have ever seen
@warrenarnold
@warrenarnold 2 ай бұрын
​@@Vercidiumbased💀
@dmas7749
@dmas7749 2 ай бұрын
love me some programmer jokes@@Vercidium
@jalon1337
@jalon1337 2 ай бұрын
You should be hired by mojang to optimize minecraft
@newforgis
@newforgis 2 ай бұрын
kid named jellysquid
@legendaryz_ch
@legendaryz_ch 2 ай бұрын
Minecraft 2500fps on my fridge tomorrow
@Splatpope
@Splatpope 2 ай бұрын
do you really think they're not already squeezing out every possible optimization that doesn't compromize gameplay ?
@vaelophisnyx9873
@vaelophisnyx9873 2 ай бұрын
@@Splatpope not for the original, just their rebuilt mimic that they use to sell skins to kids
@tjorvenblader
@tjorvenblader 2 ай бұрын
It is optimised lol
@itsTyrion
@itsTyrion 2 ай бұрын
proper good job with the code, visualizations and video in general
@DREAD0
@DREAD0 Ай бұрын
Brilliantly explained, and amazing visuals to show exactly what you’ve done. Bravo
@Vercidium
@Vercidium Ай бұрын
Thank you!
@Sylfa
@Sylfa 2 ай бұрын
Triangle strips (particle perfection) can be merged through degenerate triangles: the GPU will skip drawing triangles that have 0 area. So by first duplicating the last vertex in a strip, then the first vertex in the second strip you create two 0 area triangles that allow you to hop to the next location and maintain winding order properly. Backface culling (limit breaker) is enabled by default in modern game engines, you have to explicitly turn it off to get double sided geometry. It is *not* something too many developers ignore. Mesh batching (massive meshes) requires marking meshes as static, or using a batched renderer. Generic game engines can't normally enable this automatically as if it chooses to merge meshes that are moving, or even better skinned, it can negatively effect performance. It's not impossible to figure out, but it's CPU cycles spent on doing heuristics when the developer can just flip a flag instead. Merging geometry (tiny triangles) is generally handled through Level of Detail, for a voxel game it's clearly more powerful due to the massive amount of coplanar triangles however but since you're building the geometry procedurally you have to code specifically for that case. Interestingly, tesselation is a way to flip the problem around, allowing you to generate more geometry for high graphics settings and have a base mesh with lower geometry.
@BrightLikeSnow
@BrightLikeSnow 2 ай бұрын
Minecraft devs: 📝📝📝
@seccentral
@seccentral 2 ай бұрын
Bro i'm not even doing game design/optimization rn since I'm learning functional programming and using typescript, but your video is amazing and very interesting! Liked and Subbed ! Def not dissapointed with the random suggested youtube video
@colin_actually
@colin_actually Ай бұрын
Your animations are super cool. Makes it so easy to understand.
@ThereIsNoRoot
@ThereIsNoRoot 2 ай бұрын
Keep making videos exactly like this 🤩
@Vercidium
@Vercidium 2 ай бұрын
Thank you for your generosity! I definitely will, I have so much I’d love to talk about
@skybirdprojects5489
@skybirdprojects5489 2 ай бұрын
All of these optimizations basically boil down to how much information is factorable. In other words, what is the minimum required amount of unique information needed for a specific task. Something interesting happens when you realize this. While every single voxel is completely unique, both before and after the optimizations, there is just enough common between each of them for patterns to emerge. For instance, the ordered set of numbers between 0 and 10 all differ by one while indexing in a direction which allows a simple rule to be implemented to both calculate and store it. However, a equal set of the same cardinality may not differ by one while indexing in a given direction resulting in drastic costs to computation and storage. Excuse any incorrect or imprecise language.
@c0der23
@c0der23 2 ай бұрын
Really cool, I already knew about some of these, but I learned something new about all of them, great video!
@Da-DOS
@Da-DOS 2 ай бұрын
Man thats impressive, congrats and thanks for the content!
@nocturne6320
@nocturne6320 2 ай бұрын
Was watching with dropped jaw the entire time, this is genius! Even crazier to me is the fact that this is 100% C# code, which destroys the assumption that you need an AOT compiled language like C++, or Rust to achieve this kind of performance. Thank you for all your work and I am looking forward to your next big project
@user-sl6gn1ss8p
@user-sl6gn1ss8p 2 ай бұрын
well, the GPU seems to be the bottleneck there, so the language comparison is not as strong, I think
@tubaeseries5705
@tubaeseries5705 2 ай бұрын
​@@user-sl6gn1ss8psending data to the gpu is a bottleneck, modern GPUs can render millions of triangles at crazy fps, since it's opengl rendering cpu overhead is pretty big, reducing amount of data reduces cpu load because it has to process less things and that's the main reason of speed ups shown in this video
@JG-nm9zk
@JG-nm9zk 2 ай бұрын
Those meshes are made on the CPU so if the player can modify them then the language will matter. The actual intensive C# code in this is run once and then just calls opengl in a loop.
@user-sl6gn1ss8p
@user-sl6gn1ss8p 2 ай бұрын
@@tubaeseries5705 true, a lot of it comes down to reducing the time transferring data to the gpu. But also, he shows in the video the gpu as working for 8 times as long as the cpu. My point was just that this is not cpu-bound, so it is limited in that sense when it comes to comparing the effect of different languages in performance. Data transfer times only add to that point, right?
@nocturne6320
@nocturne6320 2 ай бұрын
@@JG-nm9zk Sectors Edge, which uses all of these techniques, is written in C#, including the net code and the fact that the chunks have to rebuild each interaction, so I'd say that Sectors Edge as a game showcases that C# can be extremely performant
@dorbie
@dorbie 2 ай бұрын
Very cool and detailed optimization. The technique to draw disconnected triangles in a single strip is to introduce multiple degenerate triangles between sets of primitives, but for your ratios it doesn't make a whole lot of sense. There's also the option of drawing GL_QUADS which might have worked well for you depending of driver implementation. Also you could reuse vertices by indexing, with the final invoking vertex on each primitive having the correct interpolated normal or shading result allowing sharing of vertices despite not having common attributes relying on FLAT varyings. With your final optimization it doesn't necessarily make sense of course.
@AfuExistente
@AfuExistente 2 ай бұрын
Incredible video, fantastic explanation. Keep up the good work!
@GarDenofThieves
@GarDenofThieves Ай бұрын
Astonishing Presentation and info!
@platinumsun4632
@platinumsun4632 2 ай бұрын
I think it would be wise, to put voxel in the title to signify its continuity with your voxel project. I follow alot of voxel projects. But I only found yours today becase a guy was complaining about your thumbnail and title. Anyways its super impressive what you’re doing. Its cool to get a glimpse at the issues an experienced programmer like yourself has to tackle at the very bottom level. Unlike say the tentical scenes in the first dead space due to bad team coordination and planning. By the way whats the gsme for the engine going to be like.
@kelet-std
@kelet-std 2 ай бұрын
He must be hired
@dex6782
@dex6782 2 ай бұрын
By FromSoftware
@igorthelight
@igorthelight 2 ай бұрын
Wouldn't that kills creativity? ;-)
@FreeSalesTips
@FreeSalesTips 2 ай бұрын
Mojang, hire this man!
@kelet-std
@kelet-std 2 ай бұрын
@@FreeSalesTips nah, valve hire that coding god
@kelet-std
@kelet-std 2 ай бұрын
@@ZEROxDEADDEAD agree XD
@glaseeze
@glaseeze Ай бұрын
These animations and editing are extremely impressive, very interesting and well explained, keep up the incredible work!
@Vercidium
@Vercidium Ай бұрын
Thank you so much!
@ZoranRavic
@ZoranRavic 2 ай бұрын
Solid advice with a surprisingly good explanation. I think I got an idea how to optimize it even further, but it will have to wait until my current project is done.
@codedeus
@codedeus 2 ай бұрын
Fantastic video content and visuals! Btw, your website link in the about page doesn't link to your website, but to your Patreon - I'm not sure this is wanted.
@Vercidium
@Vercidium 2 ай бұрын
Thanks! Yeah I've put the content pages on Patreon as I'd like to build a community (both public and paid) over there
@abjoern
@abjoern 2 ай бұрын
I'd assume this would introduce an overhead if you want to edit the world at runtime, i.e. you'd have to recalculate the combined faces in a chunk whenever you add or remove a voxel. Of course the loss is likely negligible compared to the gain, but I'm just curious if it's something you took into consideration when making it? dope video
@MINIMAN10000
@MINIMAN10000 2 ай бұрын
You simply have to rebuild the chunks that you modify which means rebuilding 32x32x32 or 32,768 blocks out of the 9.6 million blocks. It's rendering the entire scene at 17,000 fps so clearly a non issue, you would just have to go through the effort of programming the recomputation function.
@Vercidium
@Vercidium Ай бұрын
Yep a chunk's mesh has to be regenerated when a block is added or removed. This can be done on background threads though and written to a separate region of the large combined buffer. This means the meshes can be updated in real-time without causing a stutter
@OMNI_INFINITY
@OMNI_INFINITY Ай бұрын
Thanks for posting that code and guide👍🏻 Subscribed
@mikem9755
@mikem9755 2 ай бұрын
This is so impressive not just the optimization but the video editing. Bravo! Subed and notified!
@Vercidium
@Vercidium 2 ай бұрын
Thank you! Glad you enjoyed it
@AFCMS
@AFCMS 2 ай бұрын
I wonder if using Vulkan with VK_EXT_mesh_shader extension would allow even more performance in that case? 👀 There is a Minecraft mod which uses the OpenGL NVIDIA equivalent to give a pretty nice performance boost. Really nice video by the way! Definitely saving it for when I get the time to learn low level graphics lol
@Vercidium
@Vercidium 2 ай бұрын
I'm super keen to try mesh shaders, I still haven't wrapped my head around it but I reckon it would render this scene much quicker!
@toxiccan175
@toxiccan175 2 ай бұрын
Incredible work, as always. Not very many technical programming KZfaqrs can keep me on the edge of my seat-you’re one of the few that can make content like this engaging. I look forward to seeing how you optimize networking, anticheat, and other key parts of your game. Keep up the good work.
@ukyoize
@ukyoize Ай бұрын
Great video! I'll need to go over it again later, which is why I added it to favorites.
@Vercidium
@Vercidium Ай бұрын
Thank you! Happy to answer any questions you have
@barthpaleologue
@barthpaleologue Ай бұрын
The part about splitting the meshes based on face direction blew my mind! Well done
@Furkan-ll4gy
@Furkan-ll4gy 2 ай бұрын
great video but I prefer to see millisecods per frame instead of frames pre second. Most of the time fps is not what you mesure while doing optimizations
@mirkonamore
@mirkonamore 2 ай бұрын
awesome
@crazychris0905
@crazychris0905 2 ай бұрын
absolutely fell in love with the anumation style!!!
@JamieT1986
@JamieT1986 2 ай бұрын
Can you talk a bit more about how you get these numbers? For example, the profiling tools you used, as well as how to determine memory speed between the CPU and GPU etc, and what the limit would be if you were going to target a certain frame rate...
@Vercidium
@Vercidium 2 ай бұрын
Sure thing, I use the GPU Trace feature in NVIDIA Nsight to profile the rendering. I use it to figure out what the bottleneck is (shaders, memory, colour/depth output, etc). I posted a screenshot of it on the Community tab on my page I'm not sure how to benchmark memory speed between the CPU and GPU. I also use glQueryCounter before and after rendering commands to profile at runtime, I wonder if it's possible to use that to benchmark memory operations too, e.g. call glQueryCounter before and after a glBufferData call For the next game I'm working on, I'm targeting 144 FPS at 50% GPU usage, on my new 3440x1440 monitor. I'd like to play it without worrying about my GPU melting!
@Natural_Mindset
@Natural_Mindset 2 ай бұрын
I just like how you pronounce that "chriangle" thing)))
@benjaminschultz6501
@benjaminschultz6501 2 ай бұрын
Just started the first 25 seconds and I’m already hooked. Love the content!
@Vercidium
@Vercidium Ай бұрын
That is great to hear, thank you!
@jatomisstevenson141
@jatomisstevenson141 21 күн бұрын
This presentation is gorgeous and the optimization algorithms fantastic.
@ChrisDaGamer
@ChrisDaGamer 2 ай бұрын
to those who think 17000 fps is silly, hes not doing any fancy lighting, the tiny frame-time means there's so much room for all kinds of effects and other things. the high frame rate also means we can get away with much smaller voxels for a more detailed world.
@MINIMAN10000
@MINIMAN10000 2 ай бұрын
I'd be curious to see him pull off some cleverly baked tricks. Baked SSAO, Baked light map.
@MariaNicolae
@MariaNicolae 2 ай бұрын
Also people using less powerful computers
@joshuanorman2
@joshuanorman2 Ай бұрын
Having just purchased a 24,000Hz monitor, I'm very disappointed in the lack of performance
@Vercidium
@Vercidium Ай бұрын
Must optimise further!
@JacobDuenke
@JacobDuenke Ай бұрын
This was awesome. Awesome techniques and awesome visualizations.
@Chickengbs
@Chickengbs 2 ай бұрын
Love you sir, thank you so much for these videos!
@Wishbone_Games
@Wishbone_Games 2 ай бұрын
This is so incredibly well explained that my monkey brain understood all of it
@philbertius
@philbertius 2 ай бұрын
Wait, how did you achieve a speed up with instancing? It’s been years, but I profiled with instancing and it was a major slowdown for such tiny meshes. It’s been common knowledge not to use instancing with < 256 verts, and I believe NVIDIA docs mention this somewhere as well.
@shayan-gg
@shayan-gg 2 ай бұрын
maybe because each voxel uses single 32bit integer
@philbertius
@philbertius 2 ай бұрын
@@shayan-gg That’s not the issue, the issue is work the driver does to render every instance. Instancing is intended for larger meshes, like an entire character model, foliage, etc.
@surplusking2425
@surplusking2425 2 ай бұрын
Yes, this video's optimization technique is mostly outdated and seems not so practical. Some of them are effective but....most general-purpose game engines already implemented them.
@Vercidium
@Vercidium 2 ай бұрын
I haven't experienced a slowdown using tiny meshes with instancing. There was a performance improvement for all players - AMD, Intel on old laptops, NVIDIA - after deploying this rendering change to Sector's Edge. My guess is that 4x4 matrices were used for instancing, which would be a quite a lot of data for each voxel face here and definitely cause a slowdown.
@philbertius
@philbertius 2 ай бұрын
@@Vercidium You mean me? Definitely not, I instanced faces, 4 vertices 6 indices. It’s been a long time (years), so maybe they just improved the drivers.
@dycodem
@dycodem 2 ай бұрын
Simply amazing! Respect! 👏
@DoubleBob
@DoubleBob 22 күн бұрын
This is so awesome! Great job!
@DDrift-DE
@DDrift-DE Ай бұрын
Please make a Playlist, in which u fix other Games or creat a Game yourself!
@SpeedyGwen
@SpeedyGwen 2 ай бұрын
now port it to the nintendo 3ds and see if it can handle it !
@AlexTrusk91
@AlexTrusk91 26 күн бұрын
I'm just starting out with game dev and I'm glad I found you
@MikeCampo
@MikeCampo 2 ай бұрын
Good job! Optimization is a lot of fun.
@daegandg
@daegandg 2 ай бұрын
nice optimizations! now where can I find that 17000 Hz monitor?
@Vercidium
@Vercidium 2 ай бұрын
!remindme 30 years time
@merren2306
@merren2306 2 ай бұрын
5:40 TIL GL_QUADS was deprecated
@FelipeMendez
@FelipeMendez 2 ай бұрын
Again amazing work congrats!
@HuskyMoment
@HuskyMoment 2 ай бұрын
Was amusing seeing the Helldivers 2 clip at the beginning when that's been one of the most stable and well-running new titles I've played recently. Great video!
@eineatombombe
@eineatombombe 2 ай бұрын
5:20 why not use an index buffer?
@Vercidium
@Vercidium 2 ай бұрын
An index buffer would work but needs 4 vertices to be stored per face, whereas instancing only needs one Index buffers are also great for vertices that store a lot of data. Since the voxel data is packed so tightly, index buffers don't provide as much benefit
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,3 МЛН
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 300 М.
Каха с волосами
01:00
К-Media
Рет қаралды 6 МЛН
Sigma Girl Education #sigma #viral #comedy
00:16
CRAZY GREAPA
Рет қаралды 11 МЛН
He Threw A Banana Peel At A Child🍌🙈😿
00:27
Giggle Jiggle
Рет қаралды 17 МЛН
Don't eat centipede 🪱😂
00:19
Nadir Sailov
Рет қаралды 22 МЛН
Games that Don't Fake the Space
31:02
Jacob Geller
Рет қаралды 2,7 МЛН
A Game Engine Built For Optimisation
5:16
Vercidium
Рет қаралды 167 М.
I made a game with less than 100 pixels!
10:38
inDevelopment
Рет қаралды 12 М.
The Art of Game Optimization
10:18
Worlds In Motion
Рет қаралды 243 М.
Better Mountain Generators That Aren't Perlin Noise or Erosion
18:09
Josh's Channel
Рет қаралды 255 М.
I'm a Mess, so I'm Making My Own File Organizer [TagStudio]
23:32
I Created a Game Engine Just to Optimise This
4:50
Vercidium
Рет қаралды 895 М.
choosing a game engine is easy, actually
15:08
samyam
Рет қаралды 182 М.
When Optimisations Work, But for the Wrong Reasons
22:19
SimonDev
Рет қаралды 773 М.
Games Don't Actually Need Loading Screens
3:28
Vercidium
Рет қаралды 45 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 12 МЛН
A4 Reset to zero
0:26
STYLE YT
Рет қаралды 16 М.
🤖Вернулись в ПРОШЛОЕ🤪
0:28
Demin's Lounge
Рет қаралды 99 М.
Nokia 3310 versus Red Hot Ball
0:37
PressTube
Рет қаралды 1,7 МЛН
Распаковка айфона в воде😱 #shorts
0:25
Mevaza
Рет қаралды 1,6 МЛН
Что еще за обходная зарядка?
0:30
Не шарю!
Рет қаралды 2,3 МЛН