No video

Unity DOTS vs Handbuilt: Sample Project

  Рет қаралды 676,968

Nick Caston

Nick Caston

Күн бұрын

Пікірлер: 1 200
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
A few folks have pointed out that the Unity project I'm comparing against is converting from old-style GameObjects instead of being built as DOTS from the ground up, and that this impacts how much can be read into the results. This is a valid concern and it's something I should have done better to clarify in the video. I don't believe this completely invalidates the results, I personally still find the data very interesting, but I'm pinning this comment so (hopefully) future viewers are aware of this point.
@kunkerkar
@kunkerkar 3 жыл бұрын
And why u didn't build the game with IL2CPP enabled for unity it gives much more performance because when u run it in editor it gives bad performance
@sodaguy5835
@sodaguy5835 3 жыл бұрын
great comparison
@nandomax3
@nandomax3 3 жыл бұрын
I think that if you're a solo indie dev, use unity guilty free, I want to be a game dev, not a game engine engineer
@rathodpragnesh3738
@rathodpragnesh3738 3 жыл бұрын
@@kunkerkar true
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
@@kunkerkar He clearly stated he wasn't going to use run time because of the mandatory splash screen. He built the game, didn't run it on the editor.
@rojenmaharjan2033
@rojenmaharjan2033 3 жыл бұрын
"Let me open my fancy IDE" *opens notepad*
@gameginger5529
@gameginger5529 3 жыл бұрын
lol , only legends can code in notepad
@nonenone9002
@nonenone9002 3 жыл бұрын
IDE's are anyways bloat
@mustafazakiassagaf1757
@mustafazakiassagaf1757 3 жыл бұрын
Use vim
@algj
@algj 3 жыл бұрын
@@mustafazakiassagaf1757 Did you mean: *emacs*
@subliminalcastillo2126
@subliminalcastillo2126 3 жыл бұрын
@@sdrawkcabmiay Hey man, come on now. Notepad was the shit for writing batch script text based adventure games on your grandmas windows xp
@psyneur9182
@psyneur9182 3 жыл бұрын
12:02 no full auto in the buildings!!!
@pivotman319
@pivotman319 3 жыл бұрын
*"It's not full-auto."* "That's not full-auto?" *"This is."* *_12:03_* *"That's full-auto."* "Damn, bro! Okay."
@danielkolev
@danielkolev 3 жыл бұрын
This meme is useless though. Full auto IS for close quarter combat....so you spray everywhere and hit everything. Unless there is a hostage situation.
@ananttiwari1337
@ananttiwari1337 3 жыл бұрын
@@danielkolev Hi
@matheusgclassen
@matheusgclassen 3 жыл бұрын
@@danielkolev in IRL combat full auto is only useful for suppressing fire, control and accuracy is a lot more important.
@danielkolev
@danielkolev 3 жыл бұрын
@@matheusgclassen Read my message again. I was reffering to close quarter combat...
@joaohudsonlacerdaoliveira5253
@joaohudsonlacerdaoliveira5253 3 жыл бұрын
Difference between specific solution and generic solution, good video.
@vladmakarenko6641
@vladmakarenko6641 3 жыл бұрын
So what to drink?
@kristiyanivanov7414
@kristiyanivanov7414 3 жыл бұрын
@@vladmakarenko6641 wine
@neon_dev1l113
@neon_dev1l113 3 жыл бұрын
@@kristiyanivanov7414 wine drink only Linuxoids🌚
@kristiyanivanov7414
@kristiyanivanov7414 3 жыл бұрын
@AngryJoeIsRacist Super Racist me
@kristiyanivanov7414
@kristiyanivanov7414 3 жыл бұрын
@AngryJoeIsRacist Super Racist I definitely am.
@Yhushe
@Yhushe 3 жыл бұрын
I didn't realize I just watched 28 minutes of this, you got me really engaged, great job.
@Hyraethian
@Hyraethian 3 жыл бұрын
What the heck, I didnt even scroll the comments until after the 20 minute mark.
@angrynerd2103
@angrynerd2103 3 жыл бұрын
Yeah it makes sense. The more layers you strip away between the hardware and the software the faster something can run. Now time to try it in machine code lol.
@adamw.8579
@adamw.8579 3 жыл бұрын
Assembly coding critical functions is very good solution, commonly used up to now, when any single opcode counts.
@Nexus-rt1bm
@Nexus-rt1bm 3 жыл бұрын
You would suprised by the number of people who write assembly for "fun"
@adamw.8579
@adamw.8579 3 жыл бұрын
@@Nexus-rt1bm Not surprised, I write firmware for relatively small devices and frequently insert assembly functions. No matter when main code in written in C++. Some critical operation as registry unlock sequences can't be made in C++ due time restrictions. Every cycle counts.
@Nexus-rt1bm
@Nexus-rt1bm 3 жыл бұрын
@@adamw.8579 Damn, sounds thrilling and at the same, incredibly boring. Still kinda cool though. I'll just sit back on the good abstraction layer that is rust.
@adamw.8579
@adamw.8579 3 жыл бұрын
@@Nexus-rt1bm ASM inserts are in fact some type abstraction layer, similar to driver functions. In desktop app programming these functions are yet implemented and programmer simply use it from library, but in microcontroller world coder is responsible to made all near from scratch. Of course there are advanced library frameworks as Atmel ASF. Simple use but very ineffective (as mentioned "rust"). Universal library = easy use, custom library = top efficiency. Ethernal truth in programming.
@caxco93
@caxco93 3 жыл бұрын
time to learn that so called "Handbuilt" engine
@necrago
@necrago 3 жыл бұрын
I think you ought to move to unreal engine if you want to learn something
@necrago
@necrago 3 жыл бұрын
@Screw Kalergi In case you were asking me it's because it's a superior 3d engine compared to Unity. If you want 2d then I guess you could choose on your own.
@necrago
@necrago 3 жыл бұрын
@Screw Kalergi I did not mean... hmmmmmmmmmm
@TheMarovan
@TheMarovan 3 жыл бұрын
@Screw Kalergi nintendo gives you special tools for unity but doesn't actually require you to use it
@Goodpecker123
@Goodpecker123 3 жыл бұрын
@@necrago In case you're still available to comment on that, I'm interested on your thoughts on why Unreal Engine is superior to Unity. Or perhaps you'd refer me to an article or a post?
@error200http
@error200http 3 жыл бұрын
Wow good job reimplementing this complex shadows, models and animations in C++
@passivecryptoearnings3605
@passivecryptoearnings3605 3 жыл бұрын
OpenGL magic
@mattmmilli8287
@mattmmilli8287 3 жыл бұрын
@@passivecryptoearnings3605 black magic*
@danielb270
@danielb270 3 жыл бұрын
this video is just a flex on how good you are with Open GL, isn't it? (I will give it to ya, looks waaaay too good)
@danielb270
@danielb270 3 жыл бұрын
@Qrly Hey, all I ever did with OpenGL is a curve with a stickman on a bicycle and a ray-tracing collidoscope with only spheres and discs as supported shapes; so I have a very vague idea of how to even approach creating something of that complexity, furthermore with support of external models, animations and textures. Hats off to the dude. (Re-reading my original comment I thought it sounded a bit rude)
@shreksthongg
@shreksthongg 3 жыл бұрын
@Qrly Maybe for you making the video would have been way harder, but for many people, that is not the case. I would argue just based on the difference in complexity between the two, if you take someone with equal skill and experience in each, the video would have taken much less effort than getting all the lighting, texture mapping, etc working with opengl.
@kanjakan
@kanjakan 3 жыл бұрын
@Qrly Your reasoning is fundamentally flawed as different people have wildly different skill sets. For example, I am a professional animator and editor so making a video like this would take some time but would honestly be a breeze whereas coding a handbuilt engine from scratch is something completely out of my league even though I do have a bit of programming experience under my belt.
@theinconceivablerat
@theinconceivablerat 3 жыл бұрын
@@kanjakan bruh
@theinconceivablerat
@theinconceivablerat 3 жыл бұрын
@@shreksthongg bruh
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
I love the comparison. The performance gain is significant, given the same level of expertise. I must say though that there are a few other considerations I'd make, especially considering that the Handmade project used a much much different architecture. Let me start by saying that the "converting MonoBehaviour to entities" thing is not a big deal, as it is the de facto way of working with DOTS as per the documentation. There's no other way that doesn't involve building all entities by code, but that would increase code complexity by at least an order of magnitude, and the performance gain is negligible (I've tried). Secondly, the ECS example was made to show relative performance, i.e. compare the performance of creating, simulating and deleting GameObjects VS DOTS Entities. That said, this Unity Sample is an example of a badly performant codebase, simplified for clarity to be used in a Slides Presentation. When actually using DOTS in the real world you would add and remove the Disable component to bullets instead of deleting and creating new ones, for an example. The point is: comparing this code sample (bad performance by design) and an unreadable simplicity/performance first codebase does give some insight, but needs a very healthy pinch of salt. Thirdly, the DOTS example is a lot easier to build upon and contribute. And I don't mean only DOTS specifically, but ECS in general. If you were to integrate my favorite ECS library, EnTT, instead of directly hardcoding data manipulation, you'd instantly lose some of that ~10x performance. But then comes Jerry and wants you to add Walls, Conveyor Belts, Cameras, Alarms, X new enemies, Weapons, [...], you'll have a much easier time with EnTT/DOTS than the hardcoded specialized approach AND better performance in the end result, with the much much easier parallelizing. That also affects teams/contributors. If working on a team, ease of extendability is all that more important. Overall, I am actually impressed with how many lines you managed to complete this, I expected at least twice that number. This video is pretty old already, so it might also be interesting to state that DOTS changed a lot this year. So much that you'd need to rewrite most of the code from the original sample to get it running. The changes not only brought better performance, but also made the API a lot more sane than it was before. If I was to remake this comparison today, I'd make sure to use ECS on both sides, and would use the same optimizations on Unity whenever possible. Enable the burst compiler, and make sure to parallelize systems execution whenever possible. And lastly, but not leastly, make something a bit more complex as a test of extendibility; extend both Unity's prototype and the handmade counterpart with a few more features. And if you read all of this, congratulations! You are probably interested in seeing some code. Look me up on github and you'll find a DotS project that is a tad bigger than this prototype, and with the new v0.16 API.
@excitedbox5705
@excitedbox5705 3 жыл бұрын
Expansion/ adding more items etc should be easy since you already have all the movement mechanics etc. You are only adding a new item and the new functionality if there even is new functionality. A new enemy only requires a new model while using the same movement and collisions where a conveyor belt needs to perform specific function such as spawning and moving items. I agree that the unity example wasn't built efficiently and his time investment was building a "game engine" for HIS game instead of a game engine for EVERY game which unity has to support. I think that is where the biggest differences in performance come in. These game engines are like the F35 joint strike fighter. Good at lots of things but great at none because it has to fill many rolls and be adaptable. That is where a modular approach can help but then you need multiple versions of many features that can be interchanged. Instead of 1 global Data Structure you are building many etc. (I know you need many anyway it is just an example). I also think many people would lack the skills to even build their own game from scratch. Unity's most popular add-ons are still those node based low code solutions.
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
@@excitedbox5705 I'm not sure what you are referring to in your first paragraph, but I'll assume it is about an ECS version, and I would strongly agree. If it is not about the ECS version, then you clearly did not look at the source code before commenting if you honestly believe building up on that would be that trivial. Read that code, and if you still believe that all it takes to add a new enemy is to copy the new enemy's FBX then I must have no clue how C++ programming works; but I believe am proficient in C++. The Unity example wasn't just "not built efficiently", it was deliberately built inefficiently for both readability's sake and to make a good relative benchmark. It had to create and delete gameObjects and entities when it wasn't necessary, akin to a synthetic benchmark. And a relative benchmark at that. It created unnecessary workload just to test how one API fared against the other. The C++ project, on the other hand, was built to have "feature parity", comparing its performance to something that was intentionally built to have bad performance. This is akin to comparing the PI to the nth decimal using Gregory-Leibniz and _#define__ PI = 3.14159[paste all digits until the nth here]_ . Like comparing Cinebench and an image visualizer with a PNG. It simply makes no sense, these have different applications and different objectives. I'm not saying a specialized game engine won't have better performance, it probably will. I'm saying that this comparison does not reflect Unity's real performance. I'm also saying that a hardcoded programming style is not a good alternative for game development, whatever the *initial* performance gains are. So it makes no sense to pretend this hardcoded approach would work for anything other than a simple arcade game/demo. Don't get me wrong, the C++ code would not pass any code reviews here where I work, entanglement. Check what files would need to be changed if we wanted to add 3 new features: 1 - slow motion (without breaking playtime tracking) 2 - a triple form boss 3 - walls and doors In a less hardcoded C++ code, maybe even using ECS, this would be fairly easy with the boilerplate in place. In this example's hardcoded code, you'd need to change almost all source files. Imagine that list with not 3, but 300 entries. This complexity grows exponentially. This ends up misrepresenting both Unity's and C++’s performance.
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Thanks for taking the time to share your thoughts. In terms of using the particular sample as a point of comparison, I mostly selected it because Unity Technologies themselves presented it as a "look at how good DOTS performance is" example, and also it looked fun enough for me to even bother going through this whole exercise :P. I'm certainly open to the idea that there's a more suitable project out there to compare against. It's true that if the scope of the game were to be changed then this comparison becomes less and less applicable. This is why I was very careful with my "for this particular game, for this particular developer, here's a single data point" disclaimers. I apologise if it still seemed like I was misrepresenting the situation. It would be interesting to do this again today! However, if I had the time to do something like this again I'd probably try do a different comparison, like with UE, or between rendering APIs or maybe ECS vs non-ECS in handmade. I'll take a look at your project on github! Happy coding!
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
@@NickCastonNZ They actually presented it as "look at how good DOTS API performance is compared to MonoBehaviour", and they made a comparative and readable benchmark for that. That was made to compare both APIs. If you ever want to make a follow up to this one, be it ECS vs OOP or revisit this Unity vs C++, I'd be up to lending a hand
@jayjaygolden5123
@jayjaygolden5123 3 жыл бұрын
As an artist Thank you for considering us and other team members hahahahaha
@algj
@algj 3 жыл бұрын
I fell asleep, 12:01 woke me up. Rewatched this, damn that is nice.
@ndrsg3013
@ndrsg3013 3 жыл бұрын
I thought the world was ending outside and jumped, like what the hell?
@mohammadazad8350
@mohammadazad8350 3 жыл бұрын
LOL
@SrSproductionsS
@SrSproductionsS 3 жыл бұрын
Great video! This is the kind of video you search for years without any success, and suddenly goes into your recommendations randomly. As I've never written an engine by myself, I am looking out for finding an answer if writing your own engine is worthy or not. You made an excellent comparison between how faster an in-house engine performs compared to a general-use commercial engine! Also, maybe another thing to take into consideration is that you don't have to pay any amount of money (in revenue) if the game comes out as a big hit for using your own custom engine. It probably won't be anyone's concern, but I think it is a thing to keep in mind. Subbed.
@joey199412
@joey199412 3 жыл бұрын
There are revenue free engines like Godot available out there. You can also freely customize the source code from Godot to fit your needs when needed. Basically I would only recommend building in-house engines if you're either trying to make something extremely unique that requires a new way of thinking about something that game engines didn't consider. Or if you want to either make a really big AAA product pushing the hardware. Or the polar opposite, building a really small indie project where performance is important. I don't recommend custom engines for basically all mid-sized projects. Anything from large indie to small AA studio is best off just using a generic engine.
@nilstrieb
@nilstrieb 3 жыл бұрын
Making your own engine for a game only makes sense when the game is either too weird or unique to do it in an existing engine or because you want to build an engine.
@billymonks7771
@billymonks7771 3 жыл бұрын
I promise, if you are an independent developer, making your own engine does not make sense. It only makes sense for educational purposes. The additional effort easily eclipses the performance gains. Recreating this sample scene might have only been 4x effort (for a C++/openGL expert), but adding weapons, enemies, and levels will become exponentially more difficult with the handmade approach.
@SchemingGoldberg
@SchemingGoldberg 3 жыл бұрын
@@billymonks7771 Would it be? Once you have the shader and material systems created, you can reuse them for all the things in your game, so at some point the amount of effort will be equal between the two engines.
@peytonfaz
@peytonfaz 3 жыл бұрын
The reason why I am building an engine is because I enjoy the challenge, I wanted to learn more about how engines work, and just to improve myself really and have fun. If you're interested in making a game then you should use a prebuilt engine, if you are looking for a challenge building an engine would actually be a nice pay-off as you know exactly how it works too. My honest answer would be, if you're making a huge complicated 3d game then you should probably use a prebuilt engine (unless you're like me and enjoy a fun challenge) although everyone forgets that 2D games exist while talking about game engines 2D games in my experience so far aren't too difficult to make while building your own engine. Sure it's still time-consuming, but not as time-consuming as a 3D game. And just to give an example I started a new 2D project completely from scratch and in 1 day I was able to get sprites and collisions and movement and stuff like that. Sure in a prebuilt you could just drag and drop a sprite in and probably do it in less than 30 minutes, but a day after work for all of that isn't a lot either. In one week I had a nice level laid out.
@rkalla
@rkalla 3 жыл бұрын
12:04 the gun I dream about having in every horror survival game.
@KyleHarrisonRedacted
@KyleHarrisonRedacted 3 жыл бұрын
imagine being that comfortable that you're just like *a few days later* "Okay so I built the thing from scratch for this youtube video" and then doing so.. so much more than the average programming benchmarker
@MrIcer42
@MrIcer42 3 жыл бұрын
I would like to see this updated with the addition of UE4.
@MrBratkenSolov
@MrBratkenSolov 3 жыл бұрын
UE4 is crap like Unity
@spydergs07
@spydergs07 3 жыл бұрын
@@MrBratkenSolov UE4 over the last couple of years has really stepped their game up. I wouldn't say they are crap.
@gkato
@gkato 3 жыл бұрын
Me too, specially since they both use C++. Not sure if the difference would be that great but certainly it'd be interesting.
@maulikshah28
@maulikshah28 3 жыл бұрын
kzbin.info/www/bejne/l6epgWlteq6MrNE
@brickabang
@brickabang 3 жыл бұрын
@@gkato I thought unity used c#
@delphicdescant
@delphicdescant 3 жыл бұрын
Why is the algorithm just barely giving me this, over a year later? I would have loved to see it when it was fresh. Also, I agree. I've had more luck writing bare C++ than I have with a pre-made engine.
@dimanarinull9122
@dimanarinull9122 3 жыл бұрын
wow, that is actually inspiring. if it's only 4 times harder to build, but you end up with better control understanding and performance with margins this big(I know that results may differ, I've seen my coding skills). maybe going full rogue wasn't that much of a bad idea after all.
@ducky8075
@ducky8075 3 жыл бұрын
I bet that it takes him only 4x as long Because he has experience in the field, and lots of experience writing low level graphical renderers. If you want to jump in and do it for your first time, it’s likely going to be 10-100x as long as the math required to truly understand it all is *very* heavy.
@dimanarinull9122
@dimanarinull9122 3 жыл бұрын
@@ducky8075 no shit. It's not like I was coding myself for the past few years and have my profile picture be my first working GUI.
@krele14
@krele14 2 жыл бұрын
@@dimanarinull9122 Past few years of coding shitty demos using SDL is not scratching the surface of low-level graphical renderers...
@dimanarinull9122
@dimanarinull9122 2 жыл бұрын
@@krele14 yes because ALL I ever coded with was SDL and I definitely started only 4 years ago and never had ANY other experience with multiple OS and wanted a simple and mostly easy interface to work with instead of literally making everything from scratch whenever I move from Windows to Mobile to Linux or whatnot. it's not that I literally tried to search for tools that are easy to teach others and are a simple way to get away from "engine coding" into "real coding". and it's definitely not that I mostly code demoes and other things that are almost completely different to everything I have made prior and the things on the internet are explicitly from the first few revisions so they are less obfuscated by debugging and other things and can be reverse engineered into better products. I can show the revised Chess game I made but it's completely different and only uses the inferred logic from the original one. pretty much anything was exported into a LUT, the scoring system is revised, there are board hashing and multiple levels of optimization. anyone reading it would either need prior knowledge of the way chess engines work, or would need a lot of time to understand most of the "meaningless" changes that are there literally only for runtime optimization. it also moved to a fully portable codebase which includes the CLI using calls for system on both windows and linux depending on the system and uses the ANSI way of printing formatted text to the screen. I know it may seem like some of us are incompetent but for the most part it's something we want the newbies to think so they can believe "I can do this too", it's not for A-holes to lord over you with no knowledge of how writing a manual works. don't try to gatekeep if you are not even capable of knowing who is this you are gatekeeping.
@krele14
@krele14 2 жыл бұрын
​@@dimanarinull9122 Hey nice essay scrub, makes you look like a hardcore script kiddie indeed.
@andrewgilgallon8852
@andrewgilgallon8852 3 жыл бұрын
Phenomenal Nick. This problem is always happening in software development of all kinds. Great capturing the problem, constructing a problem setup, and putting the work in in attempt to reveal something instructive. Also learned what could be accomplished in the hands of an expert. Thanks for your video. I've walked away with a lot.
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Thanks for the kind words! :)
@tejonBiker
@tejonBiker 3 жыл бұрын
Thankyou very much for this effort, after some tweeks and hours I was able to compile your example, I Will make a pull request to extend the instructions for a more fast compilation phase
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Oh nice! I chucked it on github in a bit of a rush before I went on my xmas break and looking back I see the instructions are a bit brief. Glad you got it working! I'm more than happy to accept a PR
@maxxim0071
@maxxim0071 3 жыл бұрын
​@@NickCastonNZ I can't launch main.exe, console outputs: bad png sig All textures used in main.cc are present in /assets/ folder.
@mortkebab2849
@mortkebab2849 3 жыл бұрын
16:49 It's interesting that the progression of frame time against bullets is roughly a parabola (O(n²) for Unity and a straight line (O(n)) for handbuilt.
@ill4374
@ill4374 2 жыл бұрын
In unity - exponential progression. In my opinion.
@molewizard
@molewizard 8 ай бұрын
This is very interesting. Why does that happen? What is scaling at n^2 in Unity?
@emersonharris142
@emersonharris142 3 жыл бұрын
I think this question of unity vs hand built is a general problem with all development. For me this is the "the right tool for the job" question. If my game requires a low amount of graphical needs, an adventure game, puzzle game, or whatever then yes unity might be a good option. It has all prebuilt code and based on the needs of your game you will never tax that system. If you are trying to make a fast paced FPS or top down that is using hordes of enemies while your player character is wielding 30 types of weapons at once at 4k resolution... then ya you may have to go hand built for that. The correct solution is always what will get the job done per the requirements in the fastest time possible.
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
I agree! There's definitely a place for both approaches
@hugocorreagomez3649
@hugocorreagomez3649 2 жыл бұрын
You really convinced me to learn C++ and OpenGL, thanks man 👏🏻👏🏻👏🏻👏🏻👏🏻👏🏻
@astroid-ws4py
@astroid-ws4py 2 жыл бұрын
Also check some interesting you low level languages like Zig, Rust, Nim and maybe even Odin, And do not forget after you learned OpenGL to use libraries like WGPU, BGFX or TheForge for cross platform rendering capabilities so you will have a uniform graphics API that targets all of the devices
@astroid-ws4py
@astroid-ws4py 2 жыл бұрын
** new low level languages , If I edit my comments to fix a typo KZbin removes them for some reason.
@jackcottonbrown
@jackcottonbrown 2 жыл бұрын
"So let's just take a look, in my fancy IDE" *Opens notepad* haha
@woodbyte
@woodbyte 3 жыл бұрын
Interesting watch, but I'm left wondering how long it would take an experienced Unity developer to optimize that (intentionally brute-force algorithm to show DOTS strengths) sample further, and how much of a difference in performance that would achieve. Without those data points it's really hard to make any serious conclusions even just limited to this one project. I'd also love to see a face off between 2 people coding the same project - one experienced Unity developer and another experienced in C++/OpenGL - give them both a week and see what the results would be.
@fededevi1985
@fededevi1985 3 жыл бұрын
Yeah.. This is interesting but in the end it is just a single exceptionally marginal case where you instantiate thousands of objects in a single frame. THe point is.. nobody forces you to do this. If you really want to have this specific case where you shoot thousands of bullets you can easily handle all the bullets in a shot with a single gameobject and have pretty much the same performance of a custom built engine. This is also the perfect example where you are supposed to use object pooling and not create/destroy gameobjects.
@sirdiealot7805
@sirdiealot7805 3 жыл бұрын
@@fededevi1985 Somehow no one of all the hundreds of pro Unity devs here have stepped up and done it. More than a year later.
@BrunodeSouzaLino
@BrunodeSouzaLino 3 жыл бұрын
You still wouldn't be able to lower the Ram usage. If anything, the optimization would require even more ram.
@donovan6320
@donovan6320 3 жыл бұрын
@@BrunodeSouzaLino By lowering the amount of objects you absolutely could. Do not get me wrong you are not touching a custom built engine in terms of ram usage, That being said they're bloated for a reason. Those generic game engines hold Complete non biased Implementations of everything you need. With a custom game engine you can cheat. You can cut corners and make assumptions however these assumptions are not viable for a game engine that wants to support many different types of games.
@donovan6320
@donovan6320 3 жыл бұрын
@@sirdiealot7805 It's totally possible it's just not worth anyones time. Not to mention the results will still work better On a custom game engine for the reasons I outline above.
@cihadturhan
@cihadturhan 3 жыл бұрын
I thought it's a clickbait and started watching this video with a bias but man this is very accurate comparison. Thanks for all your efforts (1084 EU (effort units) for unity and 3638 EU for handbuilt :)
@joey199412
@joey199412 3 жыл бұрын
Great demonstration and I appreciate you making this video. Another measure I think would be very important is the amount of development cost both demos would require. Something like (Amount of hours * median game dev salary) for both the Unity and handmade engine. My old manager said it perfectly: Making optimized quick code saves our customers money. Making unoptimized slow but working code saves US money. Thus this metric could argue in favor of using a pre-made engine simply because it's the most economical option. Lack of time and resources are the biggest bottleneck of every software project after all.
@dealloc
@dealloc 3 жыл бұрын
It depends on your goal as a business and a company. If your goal is just to use generic solutions for your product, then using pre-made solutions is obviously the way to go. However, if you also focus on other aspects rather than the specific thing a custom solution may be what you need. Pre-existing engines makes a lot of sense for a lot of game studios who just want to make games. But for studios which want to make innovation, they bet on their own engine because they can have control over the technology. It could also be that you want to be in the business of making your own engine, or technology around it.
@antipainK
@antipainK 3 жыл бұрын
Not gonna lie, making resource heavy application natively would probably make sense, due to performance benefits, but nowadays multi-platform'ality is kinda a must.
@TheR971
@TheR971 3 жыл бұрын
Just use SDL and some of the 1000s of libraries for GUI, ECS, pathfinding, etc. If your platform does not have a c++ compiler and SDL support it's probably not worth supporting. Though that said I only have experience with pretty small projects. And never done anything for a console. But another overlooked benefit of your own engine/rendering code is that it all belongs to you and you alone. And it will still work in 30 years when unity might be long dead. (or the effort of making it work will not be insane)
@androidgameplays4every13
@androidgameplays4every13 3 жыл бұрын
@@TheR971 Wrong, you must update your engine in order to make it work with new quickly changing technologies, now more than ever, using an game engine is a must.
@Danilocked
@Danilocked 3 жыл бұрын
@@androidgameplays4every13 Yeah, his comment doesn't make sense 😂
@SrIgort
@SrIgort 3 жыл бұрын
@@androidgameplays4every13 You will also have to update your game to use these technologies lol
@8bvg300
@8bvg300 3 жыл бұрын
Every game studio i worked at used their own engines primarily. Cater it to what you need, genres, etc and then if you are lucky you have an engine which you can try to sell on or share across studios if you get bought out etc. Also, no licensing fees :)
@Scottx125Productions
@Scottx125Productions 3 жыл бұрын
True but running your own engine also incurs costs. You need to have engineers to develop it and add new features. And documentation to actually make the engine useable by employees. I worked with the Playstation phyre engine as part of a Uni project and it was one of the worst projects I've worked on. Poor documentation led to frustrating attempts of jerry rigging code together to try and get things to work. Also no 2 engines are equal. One engine might be focused towards FPS whilst another might be focused towards RPG's. Perfect example of when not to use a company made engine is with EA's Anthem. Forcing bioware to use that engine for a game it wasn't suited to, whilst also not having the engineering staff to make proper character creation systems within the engine caused major project issues. Aside from poor management decisions. Unity is great because it's a generic engine, pretty good at everything. Sure it's not the most performant but there's always ways around that. Where as developing your own engine from scratch takes additional time and money, neither of which you might have.
@KasperSOlesen
@KasperSOlesen 3 жыл бұрын
Yeah, its pretty much only AAA studios that make custom engines, and when that is not the case it usually means the game is some simple 2D game, or at least a simple 3D game, without advanced physics, animations, graphic effects and so on. There are a few examples where it has happened. Like Serious Sam. But its pretty rare an indie studio uses a custom engine for complex games.
@tomasbenders922
@tomasbenders922 4 жыл бұрын
This is awesome. I'm positive DOTs will be a nice change, but I'm very impressed by your hand-building! I can't wait to learn to build game engines someday.
@joey199412
@joey199412 3 жыл бұрын
You can start now. Learn SDL2 (window manager + sound library and input manager) and OpenGL (learnopengl is a good resource). If you are familiar with C or C++ you can probably build a small first project within a week.
@tomasbenders922
@tomasbenders922 3 жыл бұрын
@@joey199412 Thanks! Hadn't heard of SDL before. I don't have any experience with C or C++, but I have spent quite some time in monogame. From what I've read SDL is another step lower than monogame (not sure you'd say it like that). Would be a fun project to learn when I've got time, but I've been planning on learning C++ so that'll have to happen first.
@astroid-ws4py
@astroid-ws4py 2 жыл бұрын
@@tomasbenders922 After you learn OpenGL, It is best for you to move to using open source cross platform rendering abstraction layers like WGPU or BGFX, Also use cross platform audio libraries such as OpenAL or others, Enitity component system libraries like EnTT and physics libraries like PhysX or Bullet and others, And after that you will be in a good shape to make your own engines and engines tailored to specific games and use cases.
@tomasbenders922
@tomasbenders922 2 жыл бұрын
@@astroid-ws4py I've heard of all except WGPU and BGFX. Been watching some cherno which is fun. Have since been using c++ and opengl, mainly doing basic graphics stuf so I'm on my way :)
@zigmar7
@zigmar7 3 жыл бұрын
I'm quite surprised it only took you ~4x time to do it from scratch. Given how hight level Unity is and complexity of writing shaders and rendering code yourself, I would have assumed different to be at least x50 if not x100. You ml must be really fluent in low level graphical development. For me it would have only taken couple of days reading articles and papers on how to implement basic techniques like shadows and bloom, something we take for granted with high level engines.
@Borgilian
@Borgilian 3 жыл бұрын
You see, that's the problem... People think that building a custom engine for your game is useless simply because IT MUST HAVE the same features! It's like an unwritten rule. "Gee dude, you're building a story driven, linear style FPS? ON A CUSTOM ENGINE? BLASPHEMY! You'll never release your game... you'll also have to code features XYZ that allow you to also create a third person camera open world game, because that's what -insert favorite commercial engine here- does. If you don't code those useless features that you'll never need or use, your engine will suck". The thing is, a large percentage of that commercial engine's features are simply dead code for you. What many don't understand is that, if you know what you're doing, it doesn't take that much more time to build a custom engine for your specific use case. Your engine might only be able to do FPS games (if those are the only features you insert), but it's gonna do a MUCH BETTER JOB at running your FPS game, with higher flexibility, than Unity or Unreal will ever be able to. True, the "startup" time of the project (aka groundwork) is going to be higher, but once you have all the basic tools, the overall time of the entire project is gonna match the time it would take to build it in a commercial engine.... sometimes it might even be lower. Not to mention the payoff at the end... having access to the entire codebase, being able to apply quick fixes and optimizations, not being tied to some company, being able to support your game for a long time and having a flexible code base etc. Another benefit is having the possibility to reuse that custom engine / functionality / libraries in the future on another project (no need to rewrite them... simply refine and optimize over time). Also, these big engines are GENERAL USE engines. Meaning they need to have a predefined framework (that most of the time restricts what you can or can't do inside the engine... which sucks big time) that you must respect. If you're trying to do something innovative / groundbreaking / interesting, the engine is going to make it hard to do anything other than generic/standard things for which it was designed. You might end up having to rewrite big portions of that engine trying to build your custom functionality (if you even get access to the engine code), which pretty much defeats the purpose of these big engines, and you might as well have written a custom one in the first place. Not to mention that this is EXACTLY what companies are going through when building their next game. P.S: Even if you use Unity, you'll still have to write your own custom shaders.
@pmoneyish6869
@pmoneyish6869 3 жыл бұрын
@@Borgilian I mean some people like to build their own cars so it has everything they specifically want, but most people just prefer buying existing cars because it can get them from point A to point B without them needing to do much work on how it got them there ya know. Their concerns isn't what the car is made up of it's to get them to their destination as soon as possible.
@ZigealFaust
@ZigealFaust 3 жыл бұрын
@@Borgilian *laughs in UE4 blueprints*
@Borgilian
@Borgilian 3 жыл бұрын
@@pmoneyish6869 I'll let you ponder more on why your car analogy is completely parallel with the idea of a graphics engine (aka dead wrong).
@pmoneyish6869
@pmoneyish6869 3 жыл бұрын
@@Borgilian Thanks for letting me ponder on that lol. What kind of pretentious response was that dude?
@mrjean9376
@mrjean9376 3 жыл бұрын
Btw, Very great video!!! Very love to see finally there is people make performance comparison on game made with raw/pure code with internal api's and compare it to game created using game engine.. im soo interesting to performance optimization topic like this, im sub man.
@Morraak
@Morraak 3 жыл бұрын
And here I just learned how to create a prefab... Awesome video!
@UnidayStudio
@UnidayStudio 3 жыл бұрын
Alright, that's literally one of the best video I found on internet. Well done, please keep it up! Also, you're a very skilled game engine developer :)
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Thanks for the kind words! I really appreciate it :) I'm glad you liked the video!
@ferroscraft3434
@ferroscraft3434 3 жыл бұрын
carai, vc aqui
@jomy10-games
@jomy10-games 2 жыл бұрын
Very thorough video. I love how you didn’t claim anything here, it’s usually “for this specific game”, etc.
@Darkcatofmovie
@Darkcatofmovie 3 жыл бұрын
KZbin recommended me this video; it's awesome ! greetings from Argentina !
@yasin_karaaslan
@yasin_karaaslan 8 ай бұрын
This video was exactly what I was looking for. Nice clean explanation, such a good video. Thank you!
@bgwg80
@bgwg80 3 жыл бұрын
When we need to develop for general purpose, we need to balance between trade-offs. When we develop for single purpose, we can focus on single goal. The latter usually have more opportunity of optimizations. Generally, the observations made in this video makes sense, and I'm not surprised. Unless you have multi-person team that includes non-technical members, for small projects, the handbuilt solution seems the better option. Good to know.
@ffr4314
@ffr4314 3 жыл бұрын
And that's the reason that the graphics are improving more slowly. Because games are becoming more demanding due to easy production, using ready-made algorithms, and hardware is also becoming more powerful. This does not greatly benefit end-users, but it becomes easier and more profitable for developers, especially indie developers.
@CyberQuickYT
@CyberQuickYT 3 жыл бұрын
A note for those who want to benchmark something: closing applications often isn't enough, from my experience even windows downloading an update can take up 30% of CPU. Just pause updates and check that there aren't apps that use much of system resources
@franchocou
@franchocou 2 жыл бұрын
He can code low level, what make u think he didn't know that?
@bamsgian9759
@bamsgian9759 3 жыл бұрын
If my memory is correct, compiled empty unity project cost about 60MB storage. They still include core things before our project is added to the engine (I am not sure how since compiled game is encrypted) But in scratch code, we may code more freely without many feature like unity do. But building engine from scratch is so time consuming and needs more than knowing math and it is computer science
@BjornMoren
@BjornMoren 3 жыл бұрын
Interesting, thanks for making this video. Ok so you spent 3-4x the time to make it work from scratch. But then you'll also have a code base to reuse in future games, you basically have a mini game engine you can reuse. So for the next game it will maybe take 2x the time compared to Unity. And then continue to be smaller for each project. I almost always code my stuff from scratch for this reason. You cut away the bloat, you get better performance, and you'll learn more too. But for something simple that doesn't require high performance, Unity is of course the way to go.
@owdoogames
@owdoogames Жыл бұрын
"It still performs pretty well" Unleashes bullet hell Armageddon.
@liesdamnlies3372
@liesdamnlies3372 3 жыл бұрын
“So we can see the” DING DING “the character” DING “actually a little” DINGDINGDINGDINGDINGDING DING DING DING DING DING
@MotoCat91
@MotoCat91 3 жыл бұрын
Alright Mr Salamanca, no need to hurt yourself
@yrds96
@yrds96 3 жыл бұрын
look like a berserk episode
@magnusm4
@magnusm4 2 жыл бұрын
It's obvious performance would be a winner in a software made for the hardware. The main issue is, now clone the lighting, shading system, post processing effects, animation system that allows you to both animate and add scripts to animations, direct Blender and model rigging etc. In the super long run it's a winner, but unless you're gonna be a huge experienced team with a massive budget project, then it's better to use another engine that gets updated and gives you the tools to start making your game right now. A good example is WARSHIFT and Overgrowth. WARSHIFT was made by one guy in Unity for a couple of years and is a marvel in independent development. Overgrowth is a masterpiece in responsive and great gameplay and was hand crafted work can be from scratch. But even the developer himself admits he did a lot of flaws and wrongs with this approach. As it's taken him many many years to just get a playable campaign to it. Personally I'd say get experienced in an engine like Godot or Unity, make some games and learn the structure and code design with software and hardware as well as library structure. Then you can start practicing from scratch as that's a huge difference. Even with open source graphical programs and physics engines. It would take a lot of time to get to a big triple A level compared to in Unity. I'd rather make a laggy masterpiece in Unity, then spend my time optimizing it. It also helps with motivation to see your work rather than spending more time making a work station for your project then make a custom map editor before getting started on the actual game.
@leonardomadona
@leonardomadona 3 жыл бұрын
I would have liked to see the footage of the c++ version tests
@FamastChannel
@FamastChannel 3 жыл бұрын
11:44 ?
@leonardomadona
@leonardomadona 3 жыл бұрын
@@FamastChannel Yeah, but i wanna see the framerate in realtime with it shooting 90 000 bullets per shot
@DejaimeNeto
@DejaimeNeto 3 жыл бұрын
@@leonardomadona recording software would affect the result.
@leonardomadona
@leonardomadona 3 жыл бұрын
@@DejaimeNeto i didn't mean for him to show it as a proof, just for our viewing pleasure of seeing what that looks like
@simoncodrington
@simoncodrington 3 жыл бұрын
Great performance comparison. The mixed version from unity that still uses gameobjects is a fair representation of how most developers will start with ECS.
@TackerTacker
@TackerTacker 3 жыл бұрын
Now add the amount of effort it takes to bring a finished game to all platforms to your formula xD
@lordgraga
@lordgraga 3 жыл бұрын
This here is the reason Unity is king 👍
@luckylove72
@luckylove72 3 жыл бұрын
In modern world you can pay money for lack of skills. Ain’t that a good thing?
@wiktorwektor123
@wiktorwektor123 3 жыл бұрын
@@luckylove72 You always paid money for lack of skills or time. It doesn't matter if it is today or was 1000 years ago. Technology changed, professions changed but principle is the same.
@CYXXYC
@CYXXYC 3 жыл бұрын
So Unity is pointless when you are doing it single platform? Doubt
@KingJellyfishII
@KingJellyfishII 3 жыл бұрын
Zero, if you choose your libraries correctly. I'm writing a game in c++ and (once I got the IDE to work) it compiled just fine on windows (I usually run on linux) and even ARM Linux as well. Of course if you want to go to consoles it will be harder.
@Darkry
@Darkry 3 жыл бұрын
Nicely explained. Now I'd like to refer to this as a "rookie" programmer. As for my skill: I've never done big projects or anything like this in 3D. I only once made a sample 3D platformer and all you could do was move, jump and collect coins. No cam rotation, no animations. I only make simple 2D projects, currently working on a GeometryDash-like gravity-based platformer, so I'm not good at all :D But even so I stumbled upon many problems regarding the fps amount. Like- simple 2D UI animations can lag the game a bit for no reason. But the biggest issue I had was with Audio Source. I tested a few options of putting it into the game and, surprisingly, when I put it on a moving player object, my fps dropped from 250 to 30. I tried putting it on static object, resulted in 40-50 fps. Putting it on canvas gave me 70-80 fps with occasional spikes. And the only way not to hurt the fps was putting it on an empy object, which gave me 230-250 stable fps once again. I find these small issues with Unity interesting and although they are not that big of a deal for me, who does nothing impressive, I can't imagine this issue on a bigger project. I know there must be better optimization and many things I don't know, but still... To wrap it up- if you look at it from a newbie point of view, the difference between effort needed for Unity and handbuild game is huge. Just consider point of view of someone who literally knows 0 about game dev. For me, learning to write "OnCollision" is like 10 times faster than learning to make a collision for handbuild games. To put it this way- I think Unity is great for beginners to get them hooked into this. If they want to improve and move on to something different afterwards, then leaving Unity behind is good. As for me- I think I will stick to Unity. I'm a lone developer, I know only a little stuff and I don't have great ambitions for this anyways (I'm more of a story writer and teacher than pro developer. My stories brought more attention than game projects themselves...). I'll be glad if I release 1 successful game for now. I have 2 released shitty projects behind me, so it's time to make something better. Who knows? Maybe you'll some time in the future play my game, guys :D
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
I think using Unity (or any third-party engine) is a perfectly valid choice in many situations - and it sounds like you've landed on a decision which works well for you! My goal with this video was just to provide some data and leave it up to the viewer to decide how it applies to their situation. Best of luck with your games!
@Darkry
@Darkry 3 жыл бұрын
@@NickCastonNZ Yes, I can see that :) It was kinda eye opening video, to be honest. Thank you for your response.
@celivalg
@celivalg 3 жыл бұрын
I usually prefer to go the hand-built route for my projects, just because it's more fun and I get more experience with things I wouldn't have.. Plus I like having more control over my projects, yes it does mean that there a many more ways you can go wrong, but hey, at least now I know I'm actually gaining a significant amount of performances for my work, so it's quite reassuring!
@RobinCawthorne
@RobinCawthorne 3 жыл бұрын
the subtleties were the first thing i noticed. incredible performance increase with code optimisation. nice!
@kinguitar1987
@kinguitar1987 3 жыл бұрын
I wonder if this result scales. In my opinion, it does not. The effort can be 3 times for a small project, but it can be much greater for a more complex / complete game. The other thing that must be taken into consideration is that it is much easier to train someone to be Unity programmer than to be an C++ game programmer. The real effort is the cost of building that and it will be more costly to pay someone to build it from scratch than to use Unity. The last point is that you are cloning a project that was built on Unity. A fair comparison would be using a design document as reference. The good thing about engines is the ability to iterate over ideas, because you have access to a lot of resources and prebuilt components. Doing stuff from scratch with an ambiguous goal is very challenging.
@Radgerayden-ist
@Radgerayden-ist 3 жыл бұрын
To your first concern, I agree. But for small games (the kind you would make on your own anyway) and for specific genres (not asset heavy/procedural, mechanics focused for example) your own engine can still go a long way. About writing C++, you can very easily hook something like Lua into your own engine if you have more design/gameplay focused programmers in your team that you wouldn't want to be concerned with engine code.
@Lubieerror
@Lubieerror 3 жыл бұрын
​@@Radgerayden-ist On the other hand I'd say it also depends. If you have small team without much game engine related knowledge it's still might be worth to use Game Engine just because nowadays there isn't much difference if a game need 55 or 500... even about 800 MiB of RAM should be ok. It's because it "steals" your focus. It's not something running in the background that uses resources that other application could use.
@raulrivadeneyra4627
@raulrivadeneyra4627 3 жыл бұрын
You somehow made a 28 min of nearly just text quite interesting and in part entertaining.
@381delirius
@381delirius 3 жыл бұрын
Vulcan: hold my beer.
@c0mbine536
@c0mbine536 3 жыл бұрын
yeah why he not using vulkan it does have lower performance on handbuilt?
@igorgiuseppe1862
@igorgiuseppe1862 3 жыл бұрын
@@c0mbine536 because its fucking hard.
@Lord2225
@Lord2225 3 жыл бұрын
@@igorgiuseppe1862 Vulkan is simpler and more fun than OpenGL. But for maximum performance it is just as complex as the dx12. But still Vulcan loves to work with high level C++ and std. OpenGL looks more like "uglest" C.
@Navhkrin
@Navhkrin 3 жыл бұрын
@@Lord2225 Vulkan is simpler than OpenGL? As far as i peeked, it looked significantly harder. If you have any good sources for learning Vulkan please do share.
@Lord2225
@Lord2225 3 жыл бұрын
​@@Navhkrin ​ @Navhkrin I used to learn from source. It wasn't my first graphic lib and all of them usually repeat same pattern so it wasn't so hard to learn for me. For someone that is new in CG learining vulcan from doc could be confiusing. Form my perspective it is more modern, gose with trends and it is intuitive.
@DrakiniteOfficial
@DrakiniteOfficial 3 жыл бұрын
This was a VERY good video! I didn't know much about game engines or how it compares to making things from scratch, but this gives some great insight into it.
@kyleleblancvlogs3820
@kyleleblancvlogs3820 3 жыл бұрын
Did you ever consider comparing unreal engine 4 with c++ to unity and the hand-built? Would be fascinating to see how ue4 compares using c++ as opposed to handmade c++
@joey199412
@joey199412 3 жыл бұрын
It isn't the C++ that provides the speedup. Sure there's some overhead it removes from the C# runtime stuff but the real gain in performance is because you remove the overhead of engine features you're not really using but are still being applied behind the scenes. UE4 while performing better in optimal cases than Unity would still perform significantly worse than a special made engine for a single task.
@hvanmegen
@hvanmegen 2 жыл бұрын
Very interesting videos, and I'm commenting on all of them to improve their metrics based on engagement.. thank you for all your effort, I love these videos!
@tehdave192
@tehdave192 3 жыл бұрын
Would be interesting to know how this scales going further into the project. Like, does the hand built version count as a lot of groundwork, or does the effort continue to be 4x the unity effort?
@jpeg6338
@jpeg6338 3 жыл бұрын
That one guy who codes his own game engine: "Look it can draw a triangle." Anyways its a pretty good video and it was awesome to watch.
@davel101
@davel101 3 жыл бұрын
Thanks for this Nick. I did the same a while back when deciding to write a 2d game that's been in my head for 10+ years. I'm not a coder but know how to code, I'm old school (z80, 6800, Cobol, c, c++ and c#) and as such struggled with Unity structure. That said, I was prepared to learn Unity but wanted to make sure I was making the right decision as I had heard that performance was an issue for Unity. I did what you did but with not as much detail, I just wanted to know about memory usage and fps. I was so surprised by my results that I was sure that I'd made a mistake because the Unity results were so poor. Granted that this was a few versions of Unity ago but I'm glad that I decided to use c++ although writing a UI library sucked but I won't have to write one again. I used DirectX 11 with DirectXTK to aid with maths and audio. I'm not scared by the low-level nature of DirectX but I do understand that this scares a lot of people which is why Unity is great at hiding it all. Unity is great if you're not an experienced programmer or want to prototype something, but if want to write a complicated game, either in graphical or data detail, it may struggle. I'm aware of a few teams that had to almost start again as they couldn't get Unity to perform as desired, even sending their codebase to Unity didn't help.
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Really cool to hear about your journey. Thanks for sharing! It's interesting to hear you went down a similar path and reached a similar conclusion. I'm also glad I went down the C++ path for my game, but I do totally understand the case for using an existing engine. Good luck with your project!
@senpaimememaster9202
@senpaimememaster9202 2 жыл бұрын
Thas awesome
@tanura5830
@tanura5830 2 жыл бұрын
Unity has bad performance for 2D why didn't you try out 2D game engines
@ThomasChen-ur2gt
@ThomasChen-ur2gt 3 жыл бұрын
very informative, thank you. For the difference of effort, I feel like the difference will be more significant if we include the time to learn Unity/OpenGL if you are not an export.
@joey199412
@joey199412 3 жыл бұрын
From my personal experience it's a lot harder to learn unity than it is to learn OpenGL. OpenGL feels like just a library of functions. While unity is a sophisticated tool that makes you feel lost in a forest. If you want to start you can just do so with OpenGL and only uncover features as you need them. With unity though you need to learn how to navigate the entire toolset. How they are used etc which is significantly harder.
@ThomasChen-ur2gt
@ThomasChen-ur2gt 3 жыл бұрын
@@joey199412 But unity has a huge community and tons of resources. My experience with OpenGL is limited but I had little place to look for help when in my game engine class when we were using it.
@badjano
@badjano 3 жыл бұрын
this video never gets old
@rnovak4
@rnovak4 3 жыл бұрын
With sure, doing in C++ is very faster to execute, very better performance and we can use too Data-Oriented design in C. The main problem inside Unity is the quantity of layers to abstract from low to high level of programing and the builds to more plataforms with the same code. And the problem with C++ is the time to develop all code. Unity has the advantage too of constant atualizations to new platforms with the same code. I remember not so long time ago, 1 month to do a good water simulation, and now, drag and drop and it is ready, because this game engine as Unity is all. Very good comparisions ! Some especialized applications need to be in C++ yet where performance is more important.
@saltybrick5643
@saltybrick5643 3 жыл бұрын
do unreal vs handbuilt next
@sacredgeometry
@sacredgeometry 3 жыл бұрын
Its not going to be much if any better.
@mikicerise6250
@mikicerise6250 3 жыл бұрын
I'm curious about that, too.
@cagefury3789
@cagefury3789 3 жыл бұрын
@@sacredgeometry I don't know about that. Sure it has a ton of overhead (abstraction, generalization, etc) just like Unity, but the user code is also C++ instead of C#. You might be right, but I certainly would like to see the hard data.
@NikolasMauropoulos
@NikolasMauropoulos 3 жыл бұрын
@@cagefury3789 Unity has IL2CPP, also unity is made with C++. Sure you would have performance differences, but that mostly comes from memory management which isn't an issue on this scenario .
@cagefury3789
@cagefury3789 3 жыл бұрын
@@NikolasMauropoulos Obviously it's made with C++, I specifically said user code.
@_not_real
@_not_real 3 жыл бұрын
My opinion on this (that this video also seems to support) is that pre made high level engines like unity are useful for smaller projects or prototypes, where it's mostly important to get the project working without it taking too much time and effort to make, while making a project from scratch is better for more advanced projects where optimisation is important.
@Usorth
@Usorth 3 жыл бұрын
Thank you! This was extremely informative. It makes a case for handbuilt games in the indie space, especially in some niche, data-oriented genres like bullet hells. Losing the easy multi-platform support is something to be seriously considered, though.
@joey199412
@joey199412 3 жыл бұрын
This would be easy multi-platform as well. OpenGL and window managers like SDL run on basically everything so you would just need to recompile it for every platform and maybe revise resolutions a bit to match handheld devices and it wouldn't be very different. I agree with your main point and I think small indie projects in particular would benefit the most from hand-made engines. Especially if you want to do something unique. Notch's Minecraft comes to mind which would have been impossible to develop with UE3, Unity or Source Engine at the time it was made.
@cyberpope2137
@cyberpope2137 3 жыл бұрын
It's like with using C++: usually most compilers generate good enough machine code for most of the cases, but if it doesn't or you want it to go faster and you have the knowledge you can usually outperform it. Answering the question whether it's worth it is entirely up to you. Setting up your own engine with physics, logic, graphics, animation, sounds and everything else is a massive undertaking and is an order of magnitude harder than using a general-purpose engine like Unity.
@darrengrant8598
@darrengrant8598 3 жыл бұрын
The exponential growth in frame time in the Unity version doesn't seem to correlate to any of the other metrics gathered. I wonder what is causing that? Is it possible, for example, that something like lighting per particle in the Unity version is leading to some material*light complexity? (What happens if particle lighting is disabled?)
@user-lz2mu9uq4e
@user-lz2mu9uq4e 3 жыл бұрын
It's RAM bandwidth. You can't see it so it's ULTRA hard to find out and prove.
@f.f.s.d.o.a.7294
@f.f.s.d.o.a.7294 3 жыл бұрын
I was thinking it might also be an issue of CPU cache being exhausted at a certain point. Once CPU cache is exceeded for the critical code/data paths, you can really hit a performance wall. So, related to RAM bandwidth in the previous reply, but closer to CPU cores.
@illusivec
@illusivec 3 жыл бұрын
The best example of this is Crysis. When you build your engine from the ground up with the most important parts being written in Assembly, you can do things other generic engines can only dream of. The price being, you have to worry about compatibility, coss platform and all that fun stuff etc.
@tanura5830
@tanura5830 2 жыл бұрын
You can't make Crysis on your own so go use game engine
@SlowGuy
@SlowGuy 3 жыл бұрын
It feels like every single day I find a new reason to create my own game engine...
@keokawasaki7833
@keokawasaki7833 3 жыл бұрын
dont we all?
@venumspyder
@venumspyder 3 жыл бұрын
This is why I coded my own 3D engine in C++ from scratch on my KZbin channel. Like you I also get massive performance gains even on low end mobile devices.
@GonziHere
@GonziHere 3 жыл бұрын
Thanks for the video, it was something I thought about recently (since my project doesn't really use much from the engine itself). I would maybe suggest some followup where you'll try to implement the bullets (and only bullets) in the optimized fashion in the Unity. I somewhat know the UE and the general workflow is to "build it fast" with the Unreal and then optimize away... just implementing "BulletManager" (instead of bullet actors) will be significantly easier than building the whole solution, but It still might not get as far as your fully native implementation. It would be interesting to see this, instead of the naive unity implementation, so to speak. That being said, would you expect your 3-4x effort ratio to go up, or down if the project would be bigger? I would argue that it might go lower, but I have no real frame of reference for it.
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Thanks for the feedback! There's definitely a lot of room for other investigations to be done here. In terms of the effort ratio, I don't have any experience with large Unity games, so it's just my thoughts. I expect the ratio would go down as the project gets larger. Getting a 3D animated model running around and shooting is like Unity bread and butter, whereas a lot (not all) of the costs for building from scratch are front-loaded. Later on in large projects is where the lack of control in Unity might start to hurt (e.g. if you start running into serious memory problems). This seems to be reflected in industry with large AAA companies more skewed towards custom engine and indies skewed more towards third-party engine - of course there are plenty of exceptions and lots of factors at play, but it seems to be a general trend.
@donovan6320
@donovan6320 3 жыл бұрын
I would argue that depends on what your scope is in this case where it just needs to run on a single system on a single platform it's probably fine. However you do need to keep in mind Many publishers won't take you if you have a custom game engine Because they don't want to have to sit there and port your massive code base to xbox or playstation. Playstation in particular if I remember correctly has their own graphics API. Also it also would depend on how long you've been using the engine and how many engines you've made prior. If this is the 1st game with the engine and you've never made an engine before then trying to create a first person shooter without networking Is going to be a lot more time consuming if you are originally doing a first person shooter with no networking. So I would argue it really depends on what you're trying to do. Not to mention you also have no tooling, Every tool needs to be created by you which can add up But it can also mean that you can streamline your workflow.
@Lycam
@Lycam 3 жыл бұрын
Unity one is just an example and its super unoptimized code, bullets are GameObjects with a MonoBehaviour to control it. The c++ code is the oposite, bullets are like Transforms: position and rotation only. To do something similar on unity you would need to use only a list of transforms, doing it yourself the calculations on 4 threads (or even ComputeShaders) and render on a particle shader. No DOTS needed.
@OmegaF77
@OmegaF77 3 жыл бұрын
*Nobody:* *A-10 Warthog:* 12:02
@Micz84
@Micz84 3 жыл бұрын
Greate comparison. You had old information about the release date. DOTS was planned to be released on Q1 of 2020 a long time ago, it was pushed back. I think it is possible to write own rendering solution in DOTS instead one provided and reduce memory usage but it would require the extra effort of course.
@igorgiuseppe1862
@igorgiuseppe1862 3 жыл бұрын
1 day vs one weak may not sound like a lot, but if your project takes 1 year to be complete, then it would take 7 years without an engine. and if you want to make an comercially viable game, you will need to spend time developing it. (i know we cant extrapolate like that, but it helps put it into perspective)
@user-lz2mu9uq4e
@user-lz2mu9uq4e 3 жыл бұрын
There are many AAA developers who write their own engines. And I don't believe it takes 7 times more human resources.
@nilstrieb
@nilstrieb 3 жыл бұрын
I think it would be even more extreme. A simple hardcoded project takes 4x as much time as in Unity. But imagine introducing tons and tons of new features.
@igorgiuseppe1862
@igorgiuseppe1862 3 жыл бұрын
@@user-lz2mu9uq4e writing your own engine is an good option if you have tons of employees. it uses more resources from the company, but the performance pays off at the end, those companies can solve the time difference by puting tons of employees. (eg: 100 employes to do in 1 year, what 10 employees would waste 10 years to do, its just an example, in pratice its not so simple, most of the time you cant throw 10x more people at an problem and expect it to be solved 10x faster) writing your own engine work at scale, but for smaller companies it might not have the desired result, quite the contrary. in any case, if you plan to start your own engine, you probably wont want to reinvent everything. unreal licenced part of its code to companies who were willing to pay and nowadays its open source for everyone. many of those other engines were born out of parts of licenced code from thirdy parties. (eg: lumbeyard) godot is another good option of open source engine. i recomend contributing back to those projects instead of starting from scratch.
@igorgiuseppe1862
@igorgiuseppe1862 3 жыл бұрын
@@nilstrieb i think the main issue is iteration. i mean, what if the feature that took you ages to implement end up not being fun? you wasted years to discovery it, and now you will waste more years to code another feature... an game engine allow you to test new ideas quickly, either for gameplay or for art direction or for anything... then, when you are satisfied with the results you can decide if you will need to make it on your own code base (due to the performace requirements) or if you gona use the engine.
@nilstrieb
@nilstrieb 3 жыл бұрын
@@igorgiuseppe1862 that's what I said. The 4x is for simple things. It gets bigger fast
@WinterAodh
@WinterAodh 3 жыл бұрын
Great video, but I'm a bit wary on some of the details: -The assumption of effort. There was a lot of arbitrary numbers for the Unity part. Sure, it serves as a base of discussion, and that's great, but I'm a bit iffy on the finer points. I'd rather see a project made by a senior c# dev, vs a senior c++ dev with similar experience. -Total effort: You're matching a project that someone else made as an example, not necessarily optimized for performance either. What happens with larger projects? How much time is added, when you utilize Unity built-in features, and have to engineer them yourself for the HB engine? I suspect the time it takes to make systems play nice, and also enable designers, to increase the effort way more then one would think. -Language vs language: C++ is way more performant. Stat. I'd like to see a hb-c# game vs a unity c# game, or a c++ handbuilt engine vs unreal engine, in order to bring out nuances of what's actually going on. All in all, cool. I liked the comparison. I'd just like more data to see. Great effort. Bottom line for me though, is: Do whatever you feel like. There's no true answer. If your game calls for 400000 bullets per frame, sure, go ahead, Unity isn't gonna work. Good luck implementing more systems though. Do you want to build something akin to counter strike, hearthstone, or other classic games, then follow your feelings. If you're like most of us humans, having a community helps with motivation though. That, for me, seals the deal, and nestles me softly into Unity and Unreal. You wouldn't create the next blender to create your models, would you? I wouldn't, just as I wont forge my own frying pan just to have eggs and bacon. And that's my hot take on game engines discussion.
@seraaron
@seraaron 3 жыл бұрын
I was not prepared for 12:00, I almost spat my coffee and laughed so hard my split lip started bleeding again! 😂 ouch
@solaris413
@solaris413 Жыл бұрын
6:13 world was not ready for this
@ibrahimrashwan
@ibrahimrashwan 3 жыл бұрын
Did you tried various performance tricks on unity before the build to sqeeze as much performance as possible same on the handmade build
@incole7041
@incole7041 3 жыл бұрын
Apparently, no. He thought that this sample project is the most optimized implementation of shown gameplay that Unity can make. It's sad to see how many people see this as a good comparison.
@rasulseidagul
@rasulseidagul 4 жыл бұрын
Man, that was awesome. I never thought that handbuilt game could be SO much better in performance than what unity team achieved with all: ECS, Jobs and Burst compiler. Now, thanks for you, I will think twice on: “should I use existing game engine or try to write game from scratch”?, for my future games.
@odo432
@odo432 3 жыл бұрын
Why? Game engines like Unity aren't about providing you with the best performance. They are about providing you with the tools you need to build games. It can take, literally, years to build a game engine and that's before you even start building a game with it. Unless that's what you want to do why waste your time? Before I discovered Unity, Unreal Engine, Godot etc I was making my own game engine in C++. I'd spend months and all I'd achieve is some playable 2D sprites on the screen. With Unity (or equivalent) I can get a 3D first person shooting game up and running.
@rasulseidagul
@rasulseidagul 3 жыл бұрын
​@@odo432, I didn't say anything about how easy(or fast) is to create your own game(or game engine). Why did you start to point it out? Also, what is the meaning behind "wasting" time? What if I care about the game, but not about the money and time I spent on it? What if my game involves high computations and it requires better perfmormance? What about the time and effort you spent learning Unity or other game engines? Is it really good to depend on someone's engine? What if you want to make changes to the internal work of the engine? The answers to all those questions are not exact and depend on people's personalities, experiences, abilities, goals, etc.
@odo432
@odo432 3 жыл бұрын
@@rasulseidagul As you said. All depends on what you want. Given that both Unreal Engine and Unity have both been used in AAA games and games requiring lots of computations it really doesn't make any sense to build your own game engine other than for it to be a hobby or learning experience. Building a game engine is like trying to recreate the wheel. Someone's already done it. You're really not going to achieve much of anything by making your own. As for "is it really good to depend on someone else's game engine". We are talking about game engines that have had YEARS of development by hundreds/thousands of developers and battle tested by millions of users. I have no issues with trusting them. They are very stable.
@rasulseidagul
@rasulseidagul 3 жыл бұрын
​ @Mat O ok, so what about people who do create their own game engines or write their games from scratch(as, for example, Jonathan Blow do)? Do you think they are recreating the wheel? And, you know, there is a well-known product: Google Docs, which has been "battle-tested" by billion users but still has annoying and not elaborated control over images in the text. Having a big community means that the most popular cases are covered(at least), but not all of them guaranteed to be solved. And yeah - it does make sense to write your game from scratch if it requires better performance than Unreal and Unity could provide you with their bloated insights. The video, under which we are talking, has clearly shown that.
@odo432
@odo432 3 жыл бұрын
@@rasulseidagul Well, yes. The only reason to create your own custom engine is if it offers you something that an already created game engine does not. And there really isn't much in that regards. Also, unless you are an exceptionally good programmer, chances are any game engine you create is going to be riddled with a lot more bugs and issues than one that's already been created.
@andrew.r.lukasik
@andrew.r.lukasik 4 жыл бұрын
Thanks! Interesting comparison. Sour but needed reality check for state of DOTS. I'm aware of few optimizations that Unity version could employ (stripping bloat of data from bullet entities and changing how instancing happens to be more memory-friendly) but for sake of performance-vs-productivity comparison this is still a valid sample project to test.
@Tiagocf2
@Tiagocf2 3 жыл бұрын
Some unity games are nearly unplayable on my PC, even with simple graphics and minimun settings the game barely runs at 10 FPS (one exemple would be UnderMiner). My PC isnt that good but i can play a good amount of games, but when i see a game is mad with unity a give up instantly because it will not run
@Joystick111
@Joystick111 4 жыл бұрын
Great comparison! However you have to take into account many other factors. Unity is a well known game engine. Working in a team requires everyone to be aware of what they are doing, which is very difficult to achieve for handmade solutions. People are used to certain workflow. Total effort/performance ratio could be way different for a game that has slightly larger scale. I think for very small games you could go with either handmade or unity (cause unity overhead for small games usually doesn't show up, unless you have really complicated stuff going on) For middle scale games unity is a way to go. For large AAA games you have to make your own game engine.
@NickCastonNZ
@NickCastonNZ 4 жыл бұрын
Thanks for the feedback and input! Originally I had more discussion in the video about this kinda stuff but it got way too long so I decided to cut it down to just background context and raw results with a "this is just one data point" disclaimer. At any rate... I agree that looking at a project of this size means a lot of factors which are important for larger projects don't get represented. I realize I might come off a bit handbuilt-biased (and maybe I am slightly) but it can't be denied that a huge number of successful projects have been built with Unity (and other engines). You make a good point about being used to certain workflows. Using a widely-adopted engine definitely has its advantages there. I have a huge selection bias, but I've seen a lot of experienced devs getting frustrated with Unity when they don't have the control they'd like. So it's possible to go both ways. It's definitely a very nuanced decision, dependent on the project, the team, and the available resources. And hopefully this video helps someone out there, not as a complete answer, but an interesting anecdote.
@y09i_
@y09i_ 3 жыл бұрын
Awesome comparison video. You forgot to include the difference between skilled handbuildist vs unity developer. I takes a lot more years and more money to train and hire a skilled handbuildist. And even if that was not the case, 7 days instead of one day would justify using Unity is the better choice for most games.
@osamabahrouz3069
@osamabahrouz3069 3 жыл бұрын
Jim Browning's doing this now huh? For real he sounds really like him
@TheJeffybarrondo
@TheJeffybarrondo 3 жыл бұрын
I thought the same thing
@marcofe82
@marcofe82 3 жыл бұрын
Nick, really interesting video. I can define you approach like an engineereistic approach and I find this the best you could have chosen. Thank you so much!I think i will use the handbuild approach cause even if it's longer , I can learn a lot from it.
@andreasandersson7685
@andreasandersson7685 4 жыл бұрын
Thanks for sharing, very interesting results
@fallenknight5298
@fallenknight5298 3 жыл бұрын
At the start of the video, you mentioned that one of the strong points about game engines was the ease of making games for multiple platforms. It would be interesting if you took that into consideration in your comparison, specially in terms of amount of effort. It seems to me that if the comparison was made for a multiplatform project, and not for windows only like it is stated in your github project, the difference in terms of amount of effort would be much greater. Good video, nonetheless!
@alterWarOfficial
@alterWarOfficial 3 жыл бұрын
are we all just skip the fact that unity uses a fully fledged particle system while he just renders some sprites for his guns?
@csakdee
@csakdee 3 жыл бұрын
exactly the comment i was looking for... awesome results and video, but still feels like comparing a "recorded video" with a "real time rendering" as for "particles system vs. sprite(sheet)"
@csakdee
@csakdee 3 жыл бұрын
@ i understand Your point and don't want to be too nit-picky, but since the video argues performance of a "pre-built vs handmade", it's not about being more clever and creative - it's about how a custom build can be less bloated than a "one size fits all".
@csakdee
@csakdee 3 жыл бұрын
@ i think we speak about different things here... @AmazingTurtle and me where merely pointing out the fact that without using the same techniques the comparison will be always a bit flawed, fruits against vegetables.
@superscatboy
@superscatboy 3 жыл бұрын
Isn't that kind of the point if the comparison? It shows that if you strip out 99% of the stuff you aren't using (a fully fleshed-out particle system) in favour of just the 1% you aren't using (a few triangles), you get better performance. I'm sure he didn't write a fully fleshed out general purpose physics system either, and again that's the point. It shows the significant runtime performance gains to be had by paying for it at development time rather than letting the user pay for it at runtime. It's all about the trade off.
@muuubiee
@muuubiee Ай бұрын
old but. This is probably entirely about memory allocation, especially given how slow opengl is. Ecs is probably not using object pooling, and so makes a huge amount of structural changes allocates space, and maybe converts the object to entity each spawning frame, and delete expired entities.
@DennisJ42
@DennisJ42 3 жыл бұрын
I'm not sure if this has been discussed already, but default build in windows would be using direct X. There would also be definitely some difference there unless you forced OpenGL on Unity? It's a lot more difficult making a game engine with a great API. I remember making a 3D Game Engine using OpenGL to target Android, Linux and Windows at the time using Free Pascal. Most of my time was spent making the API easy to use.. and it was built completely from ground up including math, windowing, input, everything and was modular so someone could add a different input module very easily. But that took a loooooong time. So patch building a quick engine that won't hold up for future games is easy.. making one that everyone can use in many scenarios and targets and examples.. that's the time consuming part. Edit: Also worth some discussion is if you used HDR mode, Forward rendering / deferred, and other quality settings like antialiasing. I'm sure you looked into those already.
@N1ghtR1der666
@N1ghtR1der666 2 жыл бұрын
I fell another useful metric would be how easy it is to get to the level of knowledge to make that project and how many recources there are for beginners, I think you will find unity shines here
@falxie_
@falxie_ 3 жыл бұрын
I'm gonna have to try writing a game without a game engine soon, seems like an interesting experiment
@NickCastonNZ
@NickCastonNZ 3 жыл бұрын
Definitely! Even if you go back to using third-party engines you'll have still learned a lot in the process. Happy coding!
@weatherman1504
@weatherman1504 Жыл бұрын
I'm just now learning that there's essentially a graphics API equivalent to the Python vs C debate and it's Unity vs OpenGL vs Vulkan.
@Red-di7zb
@Red-di7zb 3 жыл бұрын
This is amazing video. Thanks, it was very interesting to watch.
@CobusGreyling
@CobusGreyling 3 жыл бұрын
I think it's important to note that as your game project become more and more complex over time, that 3-4x increased effort becomes very significant
@Merthalophor
@Merthalophor 3 жыл бұрын
Nice work, but I don't think the result suggests anything. In programming, making something go fast is only one of the concerns, out of many. More important than that is keeping the code manageable, extendible, portable, modular, and usable by multiple people. That's what Unity solves; that's what any game engine solves: management of complexity. They don't advertise DOT's speed stand alone; anyone can code simple graphics that are fast. They advertised their speed _given that it's running on Unity_ , a full engine. You might as well say "I've written a for loop in C that outperforms a for loop in Python by 500x!!". Nicely done, but it's not really Python's claim to be faster than C, and it won't compel any Python user to switch. (That seems a bit harsh, sorry about that, don't mean it this way)
@maindepth8830
@maindepth8830 3 жыл бұрын
Been usin unity for 3 years, i must say that using a game engine makes it considerably harder to ubderstand concepts such as rendering and shading. Hoever game engines also make life way easier for the developer as the dev mostly needs to code in the game mechanics. Great video and really well explained
@thomasipad7719
@thomasipad7719 3 жыл бұрын
One of the best videos! Well done :)
@dimaryk11
@dimaryk11 3 жыл бұрын
Conclusion - use Unity for quick demos and "sketching", whilst building the end product using "hand-built" method. I don't know why, but this kind of comparison reminds of the story how Crysis was created, where they build the game and the engine to match the quality of the cinematic movie
@askeladden450
@askeladden450 3 жыл бұрын
Thats only viable for AAA studios. For individuals or small teams, making an engine from scratch for every type of game that you make is just not possible. Only make a game engine when you are sure you want to make a specific type of game, and only if the already existing engines don't provide the features or performance you are looking for. Unity /Unreal etc should be enough for 95% of the games that you can dream of
Unity DOTS vs Assembly Benchmark - Which is fastest?
30:34
Lingon Studios
Рет қаралды 81 М.
Nurse's Mission: Bringing Joy to Young Lives #shorts
00:17
Fabiosa Stories
Рет қаралды 14 МЛН
Фейковый воришка 😂
00:51
КАРЕНА МАКАРЕНА
Рет қаралды 5 МЛН
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 43 МЛН
Recreating Noita's Sand Simulation in C and OpenGL | Game Engineering
10:03
1 Year of Indie Game Development - Starmaul
14:39
Nick Caston
Рет қаралды 24 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,5 МЛН
One year of my C++ SFML journey
5:39
Snapi
Рет қаралды 416 М.
The Downfall Of Gameloft - WTF Went Wrong? *COMPLETE STORY*
8:41
The Game Explainers
Рет қаралды 792 М.
20 Advanced Coding Tips For Big Unity Projects
22:23
Tesseract
Рет қаралды 181 М.
Tierlisting the BEST (and worst) GAME ENGINES
33:51
BiteMe Games
Рет қаралды 220 М.
Non-Euclidean Worlds Engine
5:15
CodeParade
Рет қаралды 11 МЛН