After uploading I realized I never specified it in the video. Basically every game where you have a big enough (or complex enough) connected game world that you have to load and unload content to achieve 60fps in the build. In my specific case it was when we had more than 3million triangles on the screen while going through the world, at about 100k GameObjects, about a map size of 2km x 1km. At that point lightmapping stopped working, occlusion culling broke, it took 70 seconds to recompile or jump into play mode and we had less than 30 fps. I profiled the game and editor for two months and tried absolutely everything to fix it. This video shows what I've found out. What works and what doesn't work. Recompile time is now about 10 seconds, jumping into play mode 5 seconds, navigating the scene camera is smooth, the game runs at ~70-80fps at 4k with an RTX 3070 and 6-Core CPU and in 2k on many systems (playtesters had no issues). And it's now scaleable, we can add levels without any slowdowns and we can collaborate without merge conflicts (the last point took another month, creating the multi-scene setup).
When using a game with a large open world: keep in mind the problems with float imprecision. If your camera gets away more than like 2000 units from the origin, animations can start to flicker and shake. Look up various methods of "origin shifting" to solve that problem by moving the scene dynamically closer to the origin point.
Well, origin shifting is one way to do it, aswell I know teams have just modified the engine they're using to use double-precision coords (CIG did this with CryEngine to get their space, yknow, space-y without having to deal with MMO synchronized world origin shifting, also Epic did this and UE5 natively uses double precision coordinates out of the box now), and then your distance limit becomes so ludicrous that it's barely even worth considering unless you're making a space sim in which everything must always exist in the same scene at the same time. However, with Unity, you need to pay them ridiculous sums of cash to get access to the source code in the first place to even begin on a change like this (which is absolutely insane on its own and anti-consumer as hell when every single other major engine has source out of the box), so YMMV if using this engine.
@@xanderkyron I never saw this as much of a hassle. The C# code can run just fine logic with using custom double Vectors. Custom Netcode can also use double precision. Just anything that has to do with the client visualization and local physics needs to be converted to 32bit float. But then again, the relevant scene is near the camera anyways. Things further away would be turned off or rendered in a different way (second scene camera to render a scaled down solar system, that is the backdrop when travelling for example). The world in a huge game like Star Citizen is also not just a simple scene with objects plopped in, but a more complex process to generate local scenes on the fly. So its also possible in Unity with the right approach. Of course, just compiling all those systems with using doubles would be the cleaner approach, if the engine allows that.
I noticed this while working on a scene that would move the focus of the scene to a location, which would never be reachable by conventional means, as a way to do some tutorial cutscenes without having to load an entirely new scene... my animated model was shaking like she was on a speedball drug or something. My solution was inevitably to move these constructs closer to the bottom of the terrain mesh. It didn't make any sense to me why the issue was resolved by doing this and it's still not something I completely understand but it is what it is.
I think one of the biggest hurdles (atleast for me) working with larger projects is to say "no" to things I want to have in the game. There is usually sooo much that I want to add to the game, there is a need to mash all those idéas into doable tasks.
While working on the event system video, I am thinking about a video about scoping and planning a game, the whole preproduction phase that a lot of devs seem to skip. (I am guilty of this too, as well as feature creep)
Honestly, this is a good problem to have. My boss (20 years of xp in the industry www.youtube.com/@SamuelAsherRivello) was telling me stories of some people that were excellent at coding but couldn't come up with the visual aspects of the game, which is honestly what should drive everything anyway
@@hollow_dbd not really lol, it's an excellent tool that has some unfortunate limitations. It's a perfectly good engine for games with smaller scopes and for beginner game devs looking to prototype things quickly.
This video is amazing. On RUclips the most of the videos about Unity are good enough for beginners or intermediate, but there aren't too many videos about these complex topics. I think that if you could create some videos about coding a big game it should be fantastic! Thanks again for the video
Videos like these are legendary and must saves. This talks about many things you don't often hear about in 99% Game Dev videos. And it was purely knowledge, and no bull shit.
Interesting topic, good to see more videos about it. I think there are more aspects to it, but these are def. some important ones. The part about the navmesh volumes was awesome, I didn't know about that! There is something for GPU/shader analysing too, the Frame Debugger, where you can step through separate draw calls and such.
The frame debugger really helps when you know what you are doing. Back when we had GPU performance problems and I had basically no idea about batching, instanced rendering and draw calls and so on, it wasn't a helpful tool for me. But you are right, I sould've mentioned it.
@@johnleorid hello there im just started to learn and bought gaia pro 2021 that has an option for multi tile terrain streaming but im not a coder but wanne be an artist do you have some tips. Like how to load and unload like building or vegetations only on the terrain tile where the player is at the moment how does that work whithout coding is that possible . And should i do when making the things like you said in your video to only stream load and unload where the player is like vegetation or buildings. I know that with npc s and crowd you can spaan them in when enter a region by triggers but what about buildings props vegetation etc is that possible
The Unity Frame Debugger isn't very good. Use RenderDoc (or Pix or Nsight) instead. Right-click the game tab to get a button for taking a RenderDoc capture.
I guess it goes without saying, but if you want to make a big complicated game, you need to be knowledgeable about game development, intelligent, and experienced. Too many inexperienced developers have big dreams of making big games that will be the next [insert open world game here]. I'm 36 now, and I've been doing this since I was about... 15. At this point in my life, I'm more than just a "jack of all trades, master of none," I know most aspects of game development on a deep level. I'm a jack of all trades and master of many of those trades. When I set out to make a big complicated game, the planning phase is monumentally important. I need to plan what the game looks like structurally before I place a single cube down in Unity. I need to have an idea of what the data will be structured like, I need to figure out if I'm going to use virtual texturing, HDRP, URP, how I'm going to pack my textures, what kind of audio fidelity is needed, what the art style needs to be to suit my aesthetic and performance desires, decide how modern the game will be and how that will affect how many people will be able to run it (will I be making a game with baked lighting? Am I making a very modern game that uses no baked lighting and uses ray tracing features exclusively? Is there a level of dynamism in the game that it even warrants real time lighting?)... There's a lot to consider, and if you're only a couple years into game development you might not even be aware of what questions to ask and what to consider, let alone how to consider it. As far as optimization, in my experience I've come to realize that rather than "don't optimize until you need to," time and experience will teach you what optimizations can be done in all kinds of situations, and you should carry those optimizations into EVERY project you do. Because if you optimize (and PLANNED!) your game all along, you won't have to after it's done which can lead to soul-crushing code refactors and bugs on the tail end of your development.
Not sure if you're aware of the full quote because of the way you used it sounded quite condescending, at least that's how I interpreted it. Here is the full quote though “A jack of all trades is a master of none, but oftentimes better than a master of one." I hope if you were unaware before you'll now be able to enlighten any ignorant person that tries to use that quote as an insult. Cheers!
I once tried using pure raytracing in a game using ships made of components made 100% in OpenSCAD for a simple (well okay not really) Eve clone prototype, but with Nexus: TJI ship combat, with each ship having their own 100% virtual machine to run the ship. Not for the weak of cpu, but size was tiny for what I had. Even if cpu was no issue, it did not run very well and looked way too Fortnite, but the idea was solid. Too much work though.
32 here, and I frankly disagree. I am a hobby programmer at best, doing the starts of an MMO here. Knowledgeable about game development, sure. Intelligent, sure... Experienced? Nope... but it helps. But all you really need is basic knowledge, know that you have to optimize, etc. and search up the rest. A plan? Not really. You do need to know an overall goal you want to work towards, but even with huge games, you can still take it step by step. It just needs more prework than most other projects. EDIT: Oh yeah, by pre-work, I more mean the optimization, step by step keeping the game together and not just solve problems at "some point".
Heyho, Game Dev here for Unity. I do a lot of profiling, and we are using Renderdoc. Its an extremely important tool as you can link it to Unity and grab Frames to analyze. It is similar to the Frame Debugger, but much much more indepth. When we started optimizing we were constantly checking our builds, and with Renderdoc we removed about 1/3 of GPU overhead already. One important topic to mention from GPU sides are shaders, lights, shadows and texture sizes. But thats probably a whole other video as well. Great Job otherwise. Grüße
this is really good content, this type of information is kind of hard to find when you encounter an issue related to them, so it's really beneficial to know them before you encounter these issues, just having the knowledge that a solution exists for a certain problem will save a lot of time when you encounter them. game devs really need someone like you, keep it up I think your the next Brackeys
Thank you for teaching about the material override. I had no idea that was a thing and makes things SO much better than having to create another material instance when I just need a slightly different material.
One of my first unity projects was in URP and one of the first issues I ran into was placing more than 8 real-time point lights and they’d disable themselves kuz only 8 can be loaded at a time- that pushed me to learn about baked lighting and light probes. So fucking worth
mixed lighting means one light illumination works for baked lightmaps for static objects, realtime lighting for dynamic objects, and realtime shadows for all ( or shadowmask for static). it's no better than baked lighting workflow. The pc/console game industry has ditched lightmaps (baked and mixed light in unity) for years, So just use realtime gi workarounds.
I'm half way through the video and so far I wanna say that this is all extremely valuable advice. I've been a programmer for over 25 years, but in the business world... I write games as a hobby. Every single thing you've said so far is 100% accurate and of high value.
I would greatly appreciate another video on the event system you mentioned and a more in-depth look at organizing code for a complex game like that. Excellent video btw.
Some real helpful things to consider here, even though I personally don't intend to make a "big" project and instead focus on smaller contained maps myself, keeping all these things in mind is still important and good practice. Will subscribe and look out for more helpful vids from you. :D
walls arround cities is good for 2 reasons. 1)you dont have to render the city if you are distant from it, as you said. 2)you dont have to render everything outside the city if you are inside it.
Not to mention that any game with a civilization that's often at war, has massive internal conflicts, or is pre-modern era in style would realistically have walls for towns, villages, and cities anyway.
Thanks for this content! There is a lot of content about making demos and for beginners of Unity, but really lack content like yours about how to build complex systems and larger project! Subscribed!
I work full time for a small company doing mobile games, so i got a little bit of experience, but very little when it comes to PC games. Had already figured out i would have some of those problems, but thank you for you video. I'm going to develop the game systems using a terrain with 10% of the full size, but sooner or later, i'll have to upgrade my PC to continue. (btw, i'm using Polaris, which seems to be better than Unity's built in terrain)
Yes please! I would love to see some videos about structuring performant code for large games...particularly the usage of ECS for batching groups of scenery into subscenes and using DOTS graphics.
Great video! +1 for Event Systems. There can never be enough videos about single-responsibility and modularity in development. Please talk about how powerful event systems can work in different game types and how interdependencies can cause nightmares.
I'd also recommend looking into texture compression like crunch compression, especially for things like roughness/metalic maps (where you can also reduce the resolution) where the compression is less visible, or masks for special shaders. But generally crunch compression for everything but hero objects won't have an obvious visual reduction. And as a result can take a 10GB game down to like 1GB. Also with URP and HDRP it's ideal to have as few shaders as possible.
I would really like to see a video diving more into the event manager and organizing your code. Great video, you held my attention the whole time and earned my subscription. Keep up the great work!
I think that, for baked lighting and especially in the example you were showing, that you can split your game into rooms and bake those rooms. You could also create a scene dedicated to this room just to bake stuff or cheking and verifying how everything in this room plays. You could also, I think, develop the room on its own scene so that you can navigate in your environment. I think this particular point was brought up during the Editor Performance video chapter, but I think that adding the tip that you could bake lightings per room or divisions and only rely on realtime lightings on light sources that could span in multiple rooms or object groups. I find the optimising part of a game as interesting as it is crucial. My current computer was made in 2014 and was an average gaming build at the time (meaning a good machine in the broader PC configs) but it's starting to feel less and less powerful for more recent games... especially with indie games. It may seem weird that indie games are harder on the hardware than AA or AAA games. But I think that's even more logical. Big game studios theoretically have more budget to optimise. While indie studios aren't even aware of the performance issues, or do not care enough. I have a will to make my games more accessible to more modest PC configurations, so optimisation is a very important topic to me. My computer can still handle gamedev because of the "extra mile" my friend invested into the CPU at the time. To be honest, when I am downloading the one map demo of an indie game that in itself weighs 12+ GB, I internally suffer. One, because even if my download speed is good, I think that there are still many many gamers that have a less powerful bandwidth. Two, because I know that, even in lower graphic settings, it will most likely have performance issues and few optimisations to offer. It's a general feeling I have and it may be exagerated, but I feel like most of those indie demos would really deserve more optimisations.
Good video! These concepts are crucial for any game developer not only Unity devs. Unity is "good" enough for bad games and if more people like you will teach others this low levels stuff. Then we all, as gamers will benefit from it as well as the Unity's reputation xD. Keep it up!
I've only really started programming with Unity off and on for about six months now, so what is said in the video isn't familiar with me (instead of a different language though, it's like a dialect). The stuff that I do understand though is wise and is chalk-full of great ideas. While I can't enjoy this video now, I look forward to the day I can. Cheers, and best of luck in your own coding endeavors, both creator and viewer alike!
RUclips needs more videos like this. Thanks for your insight. My only minor objection would be the use of Probuilder... when used properly, it's a very useful tool and really helps cut development time with no performance loss... key word here is *properly* though. You did quickly address how to get around its main issue, which was nice. One would *never* want to use a Probuilder mesh in a released product... always always ALWAYS export without exception. The built-in exporter works fine but the FBX exporter package works too. What would be nice to see more of is some detailed videos on specific concepts. I know it always varies from game to game but some good practical examples is indispensable for those who learn from example rather than from theory. For example, specifics on how to activate/deactivate interactive entities around the player character... that would be super useful to a lot of newcomers to RPG dev. It's easy to just say that this should be done, which so many dev videos state and which is such an obvious concept in and of itself that most already know that it should be done, but seeing specific implementations of the principle would really help out a lot of starting devs, and is something that is rarely given any concrete attention to.
I'm not sure what you mean. In Unity, deactivating is just "npcGameObject.SetActive(false)", there isn't really anything to it, besides a simple distance check and maybe an angle check using "Vector3.Angle()". If it's a crowd system, there might be more to it, like pooling and randomizing their looks before re-spawing. Getting Spawn Points can be done using the NavMesh or using points, set by the level-designer, which run a simple sight of line check before spawning. Crowd systems can be much more complicated, especially when you want them to be visible from far away. There are so many attemps, using GPU Instancing, Billboards, excessive LOD in Visuals & Code, the whole pathfinding, sharing paths, using Flow-Fields instead of A-Star. But I don't expect any indie dev to make a game in a densly populated city. Even AA and AAA have problems pulling this off. And when it's a sparsingly populated town, the content loading system should do most of the work. Everything on top of that is just for further optimization.
@@johnleorid Yeah, that's what I'm referring to... using SetActive is pretty obvious :) but the process by which you determine which ones should be enabled and which should be disabled is what I'm referring to. I know it seems simple enough when you've been doing this for awhile but there are a lot of newcomers who don't understand algorithms to do this logic and I think such explanations would be super helpful for them. Even in your response to me, it pretty much came down to theory and rough ideas, which is something such people get told a lot... "just do this and this general idea" without any specifics as to how to do those specifics, and many of the tutorials I've seen online that don't delve into code just stick with general theory that doesn't really help those people in particular. It's something that I've personally always wanted to make tutorials on, but... well... I suck at making tutorials :) and having even more noise on youtube won't help anyone. :)
This sounds like I'm in the advanced section of game making. Sounds very useful for folks at a high level in game creation. I'm heading back to the basics department.
That's why it is important to actually know what's the engine doing in the background and not just to approach this naively based on a few tutorials. To me the skill and magic in creating the breathtaking large scenes is in knowing where to do the compromises, what to do, what to fake
I remember similar tips back in the glory days of Blender Game Engine. Lights were a big killer there, so you really had to switch them off when far enough/out of the room. Ultimately, creating Nintendo 64 level of quality will never kill the fun anyway. Graphics are beautiful, but that's not where all the fun comes from at the end of the day.
This was a really great video. I’ve only now started to dabble in unity. I don’t want to make a huge open world, something more sizable, but I’m a junkie for optimization and figuring out how to make things better. Really enjoyed the points you brought here, I’ve spent most of last night googling about them and learning alternatives lol😊
Great stuff I’m helping my friend with his open world game and I have never made a large game before, glad to know there is nothing too complicated that I didn’t already know.
I would love to see more videos like these as well as more in-depth content on the coding and planning side of things. Event System sounds good. I'd also maybe like to see some dedicated videos on the topics you discussed here that go more in-depth.
For Unity big project (from my experience) is appearing as an amount of Scenes and Prefabs you have plus all the resources like textures, meshes and materials. Each prefab is pain and scene is even more pain. In theory the solvation should come with use of assemblies definitions and Assets Bundles (via the Addressables feature) with witch you will control what should and what should not be loaded. But it is something to consider from the beginning of a project. And UE handles big projects better, but the approach to achieve it is the same. Modularity of code and modularity of content (check out UE Game Features thing).
Please make more such quality content if you get some time it is very helpful for newbies like me (learning unity currently and will join company soon) this helps alot to understand many situation and stuff.
Great video. Sadly the problem is that many clueless people go out, buy some assets, then slap it all into an environment calling it a "survival game" or whatever. Then when the game performs like crap, people who have no clue blame the engine. Engines are "tools" for EXPERIENCED developers, they are not "entry level" systems for the inexperienced people. I've worked on AAA games during my career where we wrote 100% of the code, and others when we used an existing engine. In ALL cases our code always outperformed the generic engine because our code was tailored and optimized at its core for our game. But the thing is, having the ability to write an understand your own code will GREATLY improve your ability to work with 3rd party engines like Unity and Unreal -- simply put, we know what happens at low levels, the inexperienced do not. Worst yet, they watch RUclips channels and assume the author has a clue, in almost all cases the author has never developed anything except a common cold/flu, they simply copy and re-release tutorials and the bad information gets propagated. Bottom line: Engines are a double sided sword, great to have experienced developers (with games under their belt) save time, but terrible for those who will never take the time to actually learn how to develop and program without one.
It is hard to find in youtube videos about actual production/commercial-quality projects. There is a lot of tutorial for beginners but not so much content for solving "real world" problems like these. Hoping to watch more videos like this one.
i go on about not checking every frame for things... I talk about the input system... I want to clarify that since the input system runs BEFORE or after render, you can hook into events that happen on button press instead of in the update function. This could really help with making sure things happen without taking over the render cycle. even better is coroutines. These don't run on the update thread. That means you can run code in them without affecting update. 3: you can make the initial modular pieces of the meshes with probuilder, then export those with the fbx export option. then, replace the probuilder mesh object with the exported version. since they'll be modular you don't have to do it every time you want to use that mesh again. 6: you say to look at the perspective of the player when placing and hiding objects in the scene... this could easily also be applied to ai/systems/input/searches and anything that could change over time. if the player would be considering pressing a to pick an item up before looking at it, don't check for if he's pressing a until they're looking at it 8: no automatic systems... that's a bit of a loaded statement... that's like saying not to make a factory where items can be converted into others using code... automatic isn't the problem... what is even considered automatic if any ai or item pickup system is not that?! 9: it's smart to think on the grid, but what's even smarter is pairing that with the correct events, timings and functions... if the player is not spamming a at every single frame why check every frame if they want to pick something up? wait until they do something to check if they can do it. (presses a button, enters a trigger, etc) 10: there's a max rigidbody count?! actually no there is not. no way to configure it, and i've spawned over 10,000 rigidbodys without taking a performance hit on my laptop with no gpu in the editor on a intel i5 cpu. 11 and 12: if the player's not seeing it happen, only update the ai's code. you don't need to be displaying animations that the player will not see. you don't need physical interactions and ai when a player doesn't even know they're happening. if you have to check every frame for what will happen in the case the player interacts, only check on input not every single frame if they can talk. 15: this goes without saying, you can pool assets. store a list of a type of mesh, their position, rotation and what their purpose is and have that configure itself when loaded... this way you don't need each object to be in the scene taking up all the resources even when you're not there... this could be worse but you can do it in a way that can really improve performance.
"Limited number of Rigidbodies" was badly worded - of course there isn't a real limit, I just worked on different building destruction games and managed to kill the performance thanks to the Physics engine every now and then. (I think the performance cost of one body has to do with the complexity of the map, the static colliders. Not 100% sure about that one, but it would make sense with how the broadphase works) ^^ Cool comment, thanks for sharing your thoughts :D
This is an amazing video - thanks! Would be interesting to see you go into more details on some of the techniques you mention, like the events system. These optimization videos are great 👍
Hey, loved this video. Thank you so much for making it! I'm super interested to hear about how you do scene management and your strategy for breaking objects into different scenes. Pretty much everything on screen starting at 3:20 Looking forward to more videos!
So I started building a scene management system and I still have so many questions about what you have on screen here. What does the "Free" indicate in the hierarchy view? Another clip seems to suggest it's some sort of locking for VCS? Is there a reason you don't remove the scenes from the hierarchy when unloading them? How did you go about making preview images for scenes? What does the Switch/Add tab do in the Load/Unload window? I assume Add New makes a new data structure to hold a multi-scene composition, but is that assumption true? What are the scenes titled "Notes_" used for? As in, what is in them? Sorry if that's a bit much. Thank you again for this video; it's a goldmine!
Free, Editing, Locked & Modified are the states of a scene, used for merge-conflict-free collaboration. States are written to a custom server and I am using git hooks to know when a user has pulled or pushed. So based on timestamps I can prevent someone from acquiring a scene that wasn't pulled and also preventing unlocking a scene that wasn't pushed. It's not perfect but with only one branch this solved all our issues.
Preview images.. I just used the scene camera, writing to a render texture, which I then convert to a standard texture and this into a byte array if I remember correctly. When opening the window for the first time after recompile, I convert the (serialized) byte array back to the textures.
The switch/add tab let's me jump to the main menu, debug/test scenes and it let's me quickly add the lighting and player scene. With those two scenes I have correct lighting and everything I need to play the game in any scene I want (player & UI are in the player scene. Despite not having any direct references, it's convenient to have those in the same scene)
Some good tips in here. Correct me if I'm wrong, but some of these tips are specifically only for large open world games running on PCs.Tiled rendering GPUs like those on phones can't handle GPU instancing to my knowledge and baked lighting is almost essential given how much of a negative impact real time lighting can make. Granted, mostly people don't make big games, open world or otherwise, for mobile processors as they're not typically seen as a 'gaming' system, but the Nintendo Switch and Meta Quest/Quest 2 have a lot of people trying to find the best ways to make big games on mobile processors . Those need much more vigilant and extreme forms of optimization. I'd love to see a video covering some of those processes and some best practices videos for coding/memory optimization.
Good video, great points. For my first game I decided to go as big and ambitious as possible. Five years later and I've learned soo much but... still no game lol. I still feel like its just within reach and Unity has come such a long way. Anyways, I find that packaging game areas and sub areas into prefabs and instantiating them at runtime OnCollisionEnter has been the fastest way to build massive levels that run great. AI and Rigidbodies are another issue though. I also decided to include physical objects that can be moved around and put on vehicles, etc. Interesting problems to solve for sure.
I have very little experience with game development, but I do have some experience with other things such as web programming, and always have had an interest in complex systems and understanding game performance. This was a very interesting video even though I don't really plan to make any sort of big game. It is very cool to learn that a lot of techniques are quite manual and rely on the developer to manually write them for the game. This is also reassuring and great to hear in case I do make my own games or even content for other games like VRChat which use Unity. I always have wanted to dig through a performance profiler of many of the games I play to find possible performance improvements. Great video!
Very useful information! You could also make a video on how to create better systems using encapsulation and depending on an event system rather than communicating back and forth between components.
Working on it right now :D Last two weeks I wrote the code I will share, because I can't talk about an event system and then tell you to go find one. Now I'm testing the system with a small prototype to see if everything is cool to write, the custom syntax and if it works as intended. Next will be documentation and then the video text, voice recordings and cutting. xD So ... maybe in a few weeks? You can subscribe and ring the bell to get a notification when I upload it. ^^
Was collecting footage, writing code, doing a lot of research and working on Games (also for the video) in the last weeks and started actually working on the video (in the videocutting software) within the last week. You can ring the bell to get a notification when it's ready and uploaded. ^^
Very interesting video. I'm not into unity and I surely never will, but I think that the overall concepts you've outlined here are also applicable to other engines like Unreal. Thank you!
Great content. I'm tired of videos on just small scale games. I want to know about big games! The potential of the engine! The limitations! More please!
BRO! The animation you showed on 14:39 on "Unified Communication System" through the Event System is really interesting. I'm really struggling with writing code that's extendable and maintainable throughout all my systems. Even in small mobile games, it can get pretty complex. Would love to watch a video on "Writing Code for A Complex Game" that you mentioned.
Had to do a lot of research, also I wrote a event system myself which I want to share with the release of the event system video and of course, working on Games. But I am actively working on it and I hope to release it soon. :) It's way more work than I thought it would be. As always. xD
@@johnleorid Awesome dude! Can't wait! I have you on my notification bell. Appreciate the content you're doing for us in the game dev community. Hope you make it big man!
9:30 a solution is to not iterate over it each frame use triggers, store items you're close to in a list when you enter a their trigger, remove them when you exit the trigger if it's related to a button press, you do not need to check every single frame while inside the trigger, use the input system to get an event, and do the item pickup code in that event this way you don't hold up the frame buffer when doing input checks.
Hey there! I rarely comment but I think you deserve one ;) Very good and interesting videos. What I love about it is , despite beeing about Unity, most of the advices works for all game engine. I'm trying to learn Godot , and depite it beeing a very good engine, it's also one that needs the devs to optimize their games a lot, especially if you are working on 3d games. And I knew some of the stuffs you talked about, but other were really helpful. Liked your videos and I do believe you really deserve it! Nice work! Edit: Also, would totally love a detailed video about optimizing scripts :P
Thanks a lot for your comment :D I'm looking forward to a Code Optimization video, but first I want to share the event system, as it's a very cool pattern (when used correctly). ^^
Yea, but seems like the new way is to use probe volumes, they are different than the old light probes in many ways and can be used in bigger levels. I still wouldn't use them everywhere in an open world map and they have quite some limitations (e.g. daytime change only works with blending).
This is one of the reasons that many games, especially old 3d games, use a tile-based rendering system. This allows the engine to load/unload chunks of the terrain as needed. Look at the original Ultima: Underworld. When you look down, sometimes you can see that the terrain behind you is missing. If you walk back a few steps, it reappears. This is because it only renders what you can see if you look straight ahead.
Thanks for the video! Very useful advises. The only problem for me is that I struggle before all of these problems start to appear in my project. I end up far before - when trying to manage code in a big project. I can program any mechanic alone. But when it comes all together I just got overwhelmed. I watched and read a lot about architecture approaches, patterns and other stuff. But in really it is almost impossible to separate systems to make it clean. And when you try to separate them by some kind of events system - you only make it worse. Because they now look like isolated but in fact they are still connected but in more complex and hidden way. And now it's harder to debug and maintain. So yeah. I would love to hear about managing code in a big games
It's a way of thinking, I'll try to cover it in the video but it will need more than one to show proper examples and applications of it in various situations. At the end of the day, architecture is all about connections, the less you have, the better. Stay tuned because I think this is exactly what my next video(s) will be about. ^^
Really amazing video, I saved this to rewatch now and then. In my personal opinion, the lightmapper is soooooo time consuming. I've tried so much times to use it, and kinda get to know how to make it work, but honestly it's waay more easier to simply use realtime lighting, and it looks pretty similar. I guess it can be used only in level based games, like portal for example
Great video! Almost all of the tips are sort of a must have in any more or less normal project. Unless you are stamping trash mobile games every week - all of these tips are really useful.
And now i have a question, what’s a big game ?
After uploading I realized I never specified it in the video. Basically every game where you have a big enough (or complex enough) connected game world that you have to load and unload content to achieve 60fps in the build.
In my specific case it was when we had more than 3million triangles on the screen while going through the world, at about 100k GameObjects, about a map size of 2km x 1km. At that point lightmapping stopped working, occlusion culling broke, it took 70 seconds to recompile or jump into play mode and we had less than 30 fps.
I profiled the game and editor for two months and tried absolutely everything to fix it. This video shows what I've found out. What works and what doesn't work. Recompile time is now about 10 seconds, jumping into play mode 5 seconds, navigating the scene camera is smooth, the game runs at ~70-80fps at 4k with an RTX 3070 and 6-Core CPU and in 2k on many systems (playtesters had no issues). And it's now scaleable, we can add levels without any slowdowns and we can collaborate without merge conflicts (the last point took another month, creating the multi-scene setup).
Thanks for answering !
@@johnleorid Amazing! Thank you for sharing! :D
@@johnleorid 3 million? my game exceeds 30 million very often lol
@@TYNEPUNK *3 Million, despite occlusion culling xD
When using a game with a large open world: keep in mind the problems with float imprecision. If your camera gets away more than like 2000 units from the origin, animations can start to flicker and shake. Look up various methods of "origin shifting" to solve that problem by moving the scene dynamically closer to the origin point.
Good point!
Well, origin shifting is one way to do it, aswell I know teams have just modified the engine they're using to use double-precision coords (CIG did this with CryEngine to get their space, yknow, space-y without having to deal with MMO synchronized world origin shifting, also Epic did this and UE5 natively uses double precision coordinates out of the box now), and then your distance limit becomes so ludicrous that it's barely even worth considering unless you're making a space sim in which everything must always exist in the same scene at the same time. However, with Unity, you need to pay them ridiculous sums of cash to get access to the source code in the first place to even begin on a change like this (which is absolutely insane on its own and anti-consumer as hell when every single other major engine has source out of the box), so YMMV if using this engine.
@@xanderkyron I never saw this as much of a hassle. The C# code can run just fine logic with using custom double Vectors. Custom Netcode can also use double precision. Just anything that has to do with the client visualization and local physics needs to be converted to 32bit float. But then again, the relevant scene is near the camera anyways. Things further away would be turned off or rendered in a different way (second scene camera to render a scaled down solar system, that is the backdrop when travelling for example). The world in a huge game like Star Citizen is also not just a simple scene with objects plopped in, but a more complex process to generate local scenes on the fly. So its also possible in Unity with the right approach.
Of course, just compiling all those systems with using doubles would be the cleaner approach, if the engine allows that.
Gaia has a floating point fix function, takes care of this auto 👍
I noticed this while working on a scene that would move the focus of the scene to a location, which would never be reachable by conventional means, as a way to do some tutorial cutscenes without having to load an entirely new scene... my animated model was shaking like she was on a speedball drug or something. My solution was inevitably to move these constructs closer to the bottom of the terrain mesh. It didn't make any sense to me why the issue was resolved by doing this and it's still not something I completely understand but it is what it is.
I think one of the biggest hurdles (atleast for me) working with larger projects is to say "no" to things I want to have in the game. There is usually sooo much that I want to add to the game, there is a need to mash all those idéas into doable tasks.
While working on the event system video, I am thinking about a video about scoping and planning a game, the whole preproduction phase that a lot of devs seem to skip. (I am guilty of this too, as well as feature creep)
@@johnleorid that would be awesome
Honestly, this is a good problem to have. My boss (20 years of xp in the industry www.youtube.com/@SamuelAsherRivello) was telling me stories of some people that were excellent at coding but couldn't come up with the visual aspects of the game, which is honestly what should drive everything anyway
@@alexandratrenkova9339that's me all the way lol trying to train myself to be more Creative, etc lmao
Even five minutes into the video, I could barely believe how densely packed this video is with useful information. Thank you for this great video.
Me making a 2D tic tac toe game: "Ah yes this is relevant to me"
This is quality content. Well done.
It's so hard to find topics about big projects with Unity. I hope you continue to share your knowledge.
Cause Unity is trash
@@hollow_dbd not really lol, it's an excellent tool that has some unfortunate limitations. It's a perfectly good engine for games with smaller scopes and for beginner game devs looking to prototype things quickly.
@@jomalomal Unreal Engine for has better and more tools and it’s free…
@@hollow_dbd Epic take 30% of your revenue
@@Finlzz and? With Unity you’re not getting any
This is very good content. I would love that video on an Event system.
Working on it ^^
@@johnleorid Nice, I would love it !
@@johnleorid cant wait to see it.
yeh i dont get that event system really
++++
This video is amazing. On RUclips the most of the videos about Unity are good enough for beginners or intermediate, but there aren't too many videos about these complex topics. I think that if you could create some videos about coding a big game it should be fantastic! Thanks again for the video
Videos like these are legendary and must saves. This talks about many things you don't often hear about in 99% Game Dev videos. And it was purely knowledge, and no bull shit.
Interesting topic, good to see more videos about it. I think there are more aspects to it, but these are def. some important ones. The part about the navmesh volumes was awesome, I didn't know about that!
There is something for GPU/shader analysing too, the Frame Debugger, where you can step through separate draw calls and such.
The frame debugger really helps when you know what you are doing. Back when we had GPU performance problems and I had basically no idea about batching, instanced rendering and draw calls and so on, it wasn't a helpful tool for me.
But you are right, I sould've mentioned it.
@@johnleorid hello there im just started to learn and bought gaia pro 2021 that has an option for multi tile terrain streaming but im not a coder but wanne be an artist do you have some tips. Like how to load and unload like building or vegetations only on the terrain tile where the player is at the moment how does that work whithout coding is that possible . And should i do when making the things like you said in your video to only stream load and unload where the player is like vegetation or buildings. I know that with npc s and crowd you can spaan them in when enter a region by triggers but what about buildings props vegetation etc is that possible
The Unity Frame Debugger isn't very good. Use RenderDoc (or Pix or Nsight) instead. Right-click the game tab to get a button for taking a RenderDoc capture.
@@johnleorid can i have a video or some informative links about these topics (batching and stuff) too. Would really like that
I guess it goes without saying, but if you want to make a big complicated game, you need to be knowledgeable about game development, intelligent, and experienced. Too many inexperienced developers have big dreams of making big games that will be the next [insert open world game here].
I'm 36 now, and I've been doing this since I was about... 15. At this point in my life, I'm more than just a "jack of all trades, master of none," I know most aspects of game development on a deep level. I'm a jack of all trades and master of many of those trades. When I set out to make a big complicated game, the planning phase is monumentally important. I need to plan what the game looks like structurally before I place a single cube down in Unity. I need to have an idea of what the data will be structured like, I need to figure out if I'm going to use virtual texturing, HDRP, URP, how I'm going to pack my textures, what kind of audio fidelity is needed, what the art style needs to be to suit my aesthetic and performance desires, decide how modern the game will be and how that will affect how many people will be able to run it (will I be making a game with baked lighting? Am I making a very modern game that uses no baked lighting and uses ray tracing features exclusively? Is there a level of dynamism in the game that it even warrants real time lighting?)...
There's a lot to consider, and if you're only a couple years into game development you might not even be aware of what questions to ask and what to consider, let alone how to consider it.
As far as optimization, in my experience I've come to realize that rather than "don't optimize until you need to," time and experience will teach you what optimizations can be done in all kinds of situations, and you should carry those optimizations into EVERY project you do. Because if you optimize (and PLANNED!) your game all along, you won't have to after it's done which can lead to soul-crushing code refactors and bugs on the tail end of your development.
Not sure if you're aware of the full quote because of the way you used it sounded quite condescending, at least that's how I interpreted it. Here is the full quote though “A jack of all trades is a master of none, but oftentimes better than a master of one." I hope if you were unaware before you'll now be able to enlighten any ignorant person that tries to use that quote as an insult. Cheers!
I am 37, literally have been at this as long as you have. I am a 3D artist that now teaches coding at the university level. I completely agree
@@ikobi4807 More like delusional air blower XD
I once tried using pure raytracing in a game using ships made of components made 100% in OpenSCAD for a simple (well okay not really) Eve clone prototype, but with Nexus: TJI ship combat, with each ship having their own 100% virtual machine to run the ship. Not for the weak of cpu, but size was tiny for what I had. Even if cpu was no issue, it did not run very well and looked way too Fortnite, but the idea was solid.
Too much work though.
32 here, and I frankly disagree. I am a hobby programmer at best, doing the starts of an MMO here.
Knowledgeable about game development, sure. Intelligent, sure... Experienced? Nope... but it helps.
But all you really need is basic knowledge, know that you have to optimize, etc. and search up the rest.
A plan? Not really. You do need to know an overall goal you want to work towards, but even with huge games, you can still take it step by step. It just needs more prework than most other projects.
EDIT: Oh yeah, by pre-work, I more mean the optimization, step by step keeping the game together and not just solve problems at "some point".
Heyho, Game Dev here for Unity. I do a lot of profiling, and we are using Renderdoc. Its an extremely important tool as you can link it to Unity and grab Frames to analyze. It is similar to the Frame Debugger, but much much more indepth.
When we started optimizing we were constantly checking our builds, and with Renderdoc we removed about 1/3 of GPU overhead already.
One important topic to mention from GPU sides are shaders, lights, shadows and texture sizes. But thats probably a whole other video as well.
Great Job otherwise.
Grüße
this is really good content, this type of information is kind of hard to find when you encounter an issue related to them, so it's really beneficial to know them before you encounter these issues, just having the knowledge that a solution exists for a certain problem will save a lot of time when you encounter them.
game devs really need someone like you, keep it up I think your the next Brackeys
Thank you for teaching about the material override. I had no idea that was a thing and makes things SO much better than having to create another material instance when I just need a slightly different material.
In V2022.1 there are material variants which provide pretty much the same functionality - but afaik they are still assets you have to create.
That's why its best to use mixed lighting (baked on some areas & realtime on others)
One of my first unity projects was in URP and one of the first issues I ran into was placing more than 8 real-time point lights and they’d disable themselves kuz only 8 can be loaded at a time- that pushed me to learn about baked lighting and light probes. So fucking worth
mixed lighting means one light illumination works for baked lightmaps for static objects, realtime lighting for dynamic objects, and realtime shadows for all ( or shadowmask for static). it's no better than baked lighting workflow.
The pc/console game industry has ditched lightmaps (baked and mixed light in unity) for years,
So just use realtime gi workarounds.
I'm half way through the video and so far I wanna say that this is all extremely valuable advice.
I've been a programmer for over 25 years, but in the business world... I write games as a hobby. Every single thing you've said so far is 100% accurate and of high value.
I would greatly appreciate another video on the event system you mentioned and a more in-depth look at organizing code for a complex game like that. Excellent video btw.
That's really awsome, no one ever talk about large games, I literally learn many things and realize i was wrong about many things
Some real helpful things to consider here, even though I personally don't intend to make a "big" project and instead focus on smaller contained maps myself, keeping all these things in mind is still important and good practice.
Will subscribe and look out for more helpful vids from you. :D
walls arround cities is good for 2 reasons.
1)you dont have to render the city if you are distant from it, as you said.
2)you dont have to render everything outside the city if you are inside it.
Not to mention that any game with a civilization that's often at war, has massive internal conflicts, or is pre-modern era in style would realistically have walls for towns, villages, and cities anyway.
overworlds lol
occlusion culling and static batching saved my game. Occlusion has a lot of hiccups but I'm glad I figured it out.
thank you for the video, soo much info in a single video.....When will the code architecture video is coming out ?
Thanks for this content! There is a lot of content about making demos and for beginners of Unity, but really lack content like yours about how to build complex systems and larger project! Subscribed!
Are you still working on the event system video??? I need that ASAP
Yes, I'm working on the animations right now. ^^
This is a 10 years of experience and knowledge compressed into a single video. Would be great to see the video about code optimization!
video was really great but it was totally overshadowed by the genius of the outro, keep it up
This video was such a relieving change of pace, I instantly subscribed.
I work full time for a small company doing mobile games, so i got a little bit of experience, but very little when it comes to PC games. Had already figured out i would have some of those problems, but thank you for you video. I'm going to develop the game systems using a terrain with 10% of the full size, but sooner or later, i'll have to upgrade my PC to continue. (btw, i'm using Polaris, which seems to be better than Unity's built in terrain)
Yes please! I would love to see some videos about structuring performant code for large games...particularly the usage of ECS for batching groups of scenery into subscenes and using DOTS graphics.
Great video!
+1 for Event Systems.
There can never be enough videos about single-responsibility and modularity in development.
Please talk about how powerful event systems can work in different game types and how interdependencies can cause nightmares.
I'd also recommend looking into texture compression like crunch compression, especially for things like roughness/metalic maps (where you can also reduce the resolution) where the compression is less visible, or masks for special shaders. But generally crunch compression for everything but hero objects won't have an obvious visual reduction. And as a result can take a 10GB game down to like 1GB.
Also with URP and HDRP it's ideal to have as few shaders as possible.
I would really like to see a video diving more into the event manager and organizing your code. Great video, you held my attention the whole time and earned my subscription. Keep up the great work!
Man these are such knowledge BOMBS! I'm making a small to medium-sized 3D project and a lot of what you said applies!
Also you nailed that outro
This was really helpful, thank you a lot! I would really appreciate the "coding big games" video in the future.
I think that, for baked lighting and especially in the example you were showing, that you can split your game into rooms and bake those rooms. You could also create a scene dedicated to this room just to bake stuff or cheking and verifying how everything in this room plays. You could also, I think, develop the room on its own scene so that you can navigate in your environment. I think this particular point was brought up during the Editor Performance video chapter, but I think that adding the tip that you could bake lightings per room or divisions and only rely on realtime lightings on light sources that could span in multiple rooms or object groups.
I find the optimising part of a game as interesting as it is crucial. My current computer was made in 2014 and was an average gaming build at the time (meaning a good machine in the broader PC configs) but it's starting to feel less and less powerful for more recent games... especially with indie games.
It may seem weird that indie games are harder on the hardware than AA or AAA games. But I think that's even more logical. Big game studios theoretically have more budget to optimise. While indie studios aren't even aware of the performance issues, or do not care enough.
I have a will to make my games more accessible to more modest PC configurations, so optimisation is a very important topic to me. My computer can still handle gamedev because of the "extra mile" my friend invested into the CPU at the time.
To be honest, when I am downloading the one map demo of an indie game that in itself weighs 12+ GB, I internally suffer. One, because even if my download speed is good, I think that there are still many many gamers that have a less powerful bandwidth. Two, because I know that, even in lower graphic settings, it will most likely have performance issues and few optimisations to offer. It's a general feeling I have and it may be exagerated, but I feel like most of those indie demos would really deserve more optimisations.
This is golden information. Keep these things in mind any time when doing any FP game that has any asynchronous loading
Good video! These concepts are crucial for any game developer not only Unity devs. Unity is "good" enough for bad games and if more people like you will teach others this low levels stuff. Then we all, as gamers will benefit from it as well as the Unity's reputation xD. Keep it up!
I've only really started programming with Unity off and on for about six months now, so what is said in the video isn't familiar with me (instead of a different language though, it's like a dialect). The stuff that I do understand though is wise and is chalk-full of great ideas.
While I can't enjoy this video now, I look forward to the day I can. Cheers, and best of luck in your own coding endeavors, both creator and viewer alike!
Golden video. Share more experience on loading/unloading regions of big world please
RUclips needs more videos like this. Thanks for your insight. My only minor objection would be the use of Probuilder... when used properly, it's a very useful tool and really helps cut development time with no performance loss... key word here is *properly* though. You did quickly address how to get around its main issue, which was nice. One would *never* want to use a Probuilder mesh in a released product... always always ALWAYS export without exception. The built-in exporter works fine but the FBX exporter package works too.
What would be nice to see more of is some detailed videos on specific concepts. I know it always varies from game to game but some good practical examples is indispensable for those who learn from example rather than from theory. For example, specifics on how to activate/deactivate interactive entities around the player character... that would be super useful to a lot of newcomers to RPG dev. It's easy to just say that this should be done, which so many dev videos state and which is such an obvious concept in and of itself that most already know that it should be done, but seeing specific implementations of the principle would really help out a lot of starting devs, and is something that is rarely given any concrete attention to.
I'm not sure what you mean. In Unity, deactivating is just "npcGameObject.SetActive(false)", there isn't really anything to it, besides a simple distance check and maybe an angle check using "Vector3.Angle()".
If it's a crowd system, there might be more to it, like pooling and randomizing their looks before re-spawing. Getting Spawn Points can be done using the NavMesh or using points, set by the level-designer, which run a simple sight of line check before spawning.
Crowd systems can be much more complicated, especially when you want them to be visible from far away. There are so many attemps, using GPU Instancing, Billboards, excessive LOD in Visuals & Code, the whole pathfinding, sharing paths, using Flow-Fields instead of A-Star. But I don't expect any indie dev to make a game in a densly populated city. Even AA and AAA have problems pulling this off. And when it's a sparsingly populated town, the content loading system should do most of the work. Everything on top of that is just for further optimization.
@@johnleorid Yeah, that's what I'm referring to... using SetActive is pretty obvious :) but the process by which you determine which ones should be enabled and which should be disabled is what I'm referring to. I know it seems simple enough when you've been doing this for awhile but there are a lot of newcomers who don't understand algorithms to do this logic and I think such explanations would be super helpful for them. Even in your response to me, it pretty much came down to theory and rough ideas, which is something such people get told a lot... "just do this and this general idea" without any specifics as to how to do those specifics, and many of the tutorials I've seen online that don't delve into code just stick with general theory that doesn't really help those people in particular. It's something that I've personally always wanted to make tutorials on, but... well... I suck at making tutorials :) and having even more noise on youtube won't help anyone. :)
Very informative video in a concise format, great! I'd also love a video or two about Coding for a Big Game. Keep it up!
Finally "advanced" tips. Thank you so much, those are really helpful!
This sounds like I'm in the advanced section of game making. Sounds very useful for folks at a high level in game creation. I'm heading back to the basics department.
That's why it is important to actually know what's the engine doing in the background and not just to approach this naively based on a few tutorials. To me the skill and magic in creating the breathtaking large scenes is in knowing where to do the compromises, what to do, what to fake
One of the best Unity videos I saw. Unfortinaly I had to learn some of those lessons the hard way, cause this topic isn't covered enough.
You made my day ... started to use an event system to pass paramaters from scene A to Scene B ... but giving a Unique ID its a way cleaner option!
I remember similar tips back in the glory days of Blender Game Engine. Lights were a big killer there, so you really had to switch them off when far enough/out of the room.
Ultimately, creating Nintendo 64 level of quality will never kill the fun anyway. Graphics are beautiful, but that's not where all the fun comes from at the end of the day.
"Writing code for a complex game" - yes please. Great video, would love to see more in-depth content from you.
This was a really great video. I’ve only now started to dabble in unity. I don’t want to make a huge open world, something more sizable, but I’m a junkie for optimization and figuring out how to make things better. Really enjoyed the points you brought here, I’ve spent most of last night googling about them and learning alternatives lol😊
Great stuff I’m helping my friend with his open world game and I have never made a large game before, glad to know there is nothing too complicated that I didn’t already know.
The video was pure gold! Please do video on "Coding Stuff".
I would love to see more videos like these as well as more in-depth content on the coding and planning side of things. Event System sounds good. I'd also maybe like to see some dedicated videos on the topics you discussed here that go more in-depth.
For Unity big project (from my experience) is appearing as an amount of Scenes and Prefabs you have plus all the resources like textures, meshes and materials. Each prefab is pain and scene is even more pain. In theory the solvation should come with use of assemblies definitions and Assets Bundles (via the Addressables feature) with witch you will control what should and what should not be loaded. But it is something to consider from the beginning of a project. And UE handles big projects better, but the approach to achieve it is the same. Modularity of code and modularity of content (check out UE Game Features thing).
Amazin video, thank you so much for working on this, it is so hard to find actual intermediate/advance topics about Unity.
Loved it!
Please make more such quality content if you get some time it is very helpful for newbies like me (learning unity currently and will join company soon) this helps alot to understand many situation and stuff.
Great video. Sadly the problem is that many clueless people go out, buy some assets, then slap it all into an environment calling it a "survival game" or whatever. Then when the game performs like crap, people who have no clue blame the engine. Engines are "tools" for EXPERIENCED developers, they are not "entry level" systems for the inexperienced people. I've worked on AAA games during my career where we wrote 100% of the code, and others when we used an existing engine. In ALL cases our code always outperformed the generic engine because our code was tailored and optimized at its core for our game. But the thing is, having the ability to write an understand your own code will GREATLY improve your ability to work with 3rd party engines like Unity and Unreal -- simply put, we know what happens at low levels, the inexperienced do not. Worst yet, they watch RUclips channels and assume the author has a clue, in almost all cases the author has never developed anything except a common cold/flu, they simply copy and re-release tutorials and the bad information gets propagated.
Bottom line: Engines are a double sided sword, great to have experienced developers (with games under their belt) save time, but terrible for those who will never take the time to actually learn how to develop and program without one.
It is hard to find in youtube videos about actual production/commercial-quality projects. There is a lot of tutorial for beginners but not so much content for solving "real world" problems like these.
Hoping to watch more videos like this one.
Thats some top tier video. Straight to the point.
I will pray youtube algorithms for you my friend.
Thanks a lot for great video
i go on about not checking every frame for things... I talk about the input system... I want to clarify that since the input system runs BEFORE or after render, you can hook into events that happen on button press instead of in the update function. This could really help with making sure things happen without taking over the render cycle. even better is coroutines. These don't run on the update thread. That means you can run code in them without affecting update.
3: you can make the initial modular pieces of the meshes with probuilder, then export those with the fbx export option. then, replace the probuilder mesh object with the exported version. since they'll be modular you don't have to do it every time you want to use that mesh again.
6: you say to look at the perspective of the player when placing and hiding objects in the scene... this could easily also be applied to ai/systems/input/searches and anything that could change over time. if the player would be considering pressing a to pick an item up before looking at it, don't check for if he's pressing a until they're looking at it
8: no automatic systems... that's a bit of a loaded statement... that's like saying not to make a factory where items can be converted into others using code... automatic isn't the problem... what is even considered automatic if any ai or item pickup system is not that?!
9: it's smart to think on the grid, but what's even smarter is pairing that with the correct events, timings and functions... if the player is not spamming a at every single frame why check every frame if they want to pick something up? wait until they do something to check if they can do it. (presses a button, enters a trigger, etc)
10: there's a max rigidbody count?! actually no there is not. no way to configure it, and i've spawned over 10,000 rigidbodys without taking a performance hit on my laptop with no gpu in the editor on a intel i5 cpu.
11 and 12: if the player's not seeing it happen, only update the ai's code. you don't need to be displaying animations that the player will not see. you don't need physical interactions and ai when a player doesn't even know they're happening. if you have to check every frame for what will happen in the case the player interacts, only check on input not every single frame if they can talk.
15: this goes without saying, you can pool assets. store a list of a type of mesh, their position, rotation and what their purpose is and have that configure itself when loaded... this way you don't need each object to be in the scene taking up all the resources even when you're not there... this could be worse but you can do it in a way that can really improve performance.
"Limited number of Rigidbodies" was badly worded - of course there isn't a real limit, I just worked on different building destruction games and managed to kill the performance thanks to the Physics engine every now and then. (I think the performance cost of one body has to do with the complexity of the map, the static colliders. Not 100% sure about that one, but it would make sense with how the broadphase works) ^^
Cool comment, thanks for sharing your thoughts :D
Definitely interested in learning more about coding systems! Great video mate
Very pog content, I actually took notes for the first time lol, the video about coding for complex games would be great!
Subbed. I don't even use Unity but this is informative.
I saved your video for future reference. Please make more videos on large-scale game development, these are hard to find.
Very well presented information and the Patreon bit at the end killed me haha
Very very informative video, I would love to see what you got more
This is an amazing video - thanks! Would be interesting to see you go into more details on some of the techniques you mention, like the events system. These optimization videos are great 👍
Lol the patreon list at the end killed me hahaha, good video man, keep them coming.
Hey, loved this video. Thank you so much for making it! I'm super interested to hear about how you do scene management and your strategy for breaking objects into different scenes. Pretty much everything on screen starting at 3:20 Looking forward to more videos!
So I started building a scene management system and I still have so many questions about what you have on screen here. What does the "Free" indicate in the hierarchy view? Another clip seems to suggest it's some sort of locking for VCS? Is there a reason you don't remove the scenes from the hierarchy when unloading them? How did you go about making preview images for scenes? What does the Switch/Add tab do in the Load/Unload window? I assume Add New makes a new data structure to hold a multi-scene composition, but is that assumption true? What are the scenes titled "Notes_" used for? As in, what is in them?
Sorry if that's a bit much. Thank you again for this video; it's a goldmine!
Free, Editing, Locked & Modified are the states of a scene, used for merge-conflict-free collaboration. States are written to a custom server and I am using git hooks to know when a user has pulled or pushed. So based on timestamps I can prevent someone from acquiring a scene that wasn't pulled and also preventing unlocking a scene that wasn't pushed.
It's not perfect but with only one branch this solved all our issues.
Preview images.. I just used the scene camera, writing to a render texture, which I then convert to a standard texture and this into a byte array if I remember correctly. When opening the window for the first time after recompile, I convert the (serialized) byte array back to the textures.
Keeping scenes in the Hierarchy has the sole purpose of being able to right-click and load them without the editor tool. Just a backup/alternative. ^^
The switch/add tab let's me jump to the main menu, debug/test scenes and it let's me quickly add the lighting and player scene.
With those two scenes I have correct lighting and everything I need to play the game in any scene I want (player & UI are in the player scene. Despite not having any direct references, it's convenient to have those in the same scene)
The ending by listing your pateron error codes has me dead in my chair. LOL
Very well done video! Thank you for the tips!
Some good tips in here. Correct me if I'm wrong, but some of these tips are specifically only for large open world games running on PCs.Tiled rendering GPUs like those on phones can't handle GPU instancing to my knowledge and baked lighting is almost essential given how much of a negative impact real time lighting can make. Granted, mostly people don't make big games, open world or otherwise, for mobile processors as they're not typically seen as a 'gaming' system, but the Nintendo Switch and Meta Quest/Quest 2 have a lot of people trying to find the best ways to make big games on mobile processors . Those need much more vigilant and extreme forms of optimization. I'd love to see a video covering some of those processes and some best practices videos for coding/memory optimization.
This is absolutely true, real time lighting is really only for desktops/consoles. Mobile games have different restrictions.
Good video, great points. For my first game I decided to go as big and ambitious as possible. Five years later and I've learned soo much but... still no game lol. I still feel like its just within reach and Unity has come such a long way. Anyways, I find that packaging game areas and sub areas into prefabs and instantiating them at runtime OnCollisionEnter has been the fastest way to build massive levels that run great. AI and Rigidbodies are another issue though. I also decided to include physical objects that can be moved around and put on vehicles, etc. Interesting problems to solve for sure.
Great explanation and I learned a lot from this video. Would love to see more content, e.g. the event system you mentioned
I have very little experience with game development, but I do have some experience with other things such as web programming, and always have had an interest in complex systems and understanding game performance.
This was a very interesting video even though I don't really plan to make any sort of big game. It is very cool to learn that a lot of techniques are quite manual and rely on the developer to manually write them for the game. This is also reassuring and great to hear in case I do make my own games or even content for other games like VRChat which use Unity.
I always have wanted to dig through a performance profiler of many of the games I play to find possible performance improvements. Great video!
I'm using UE5, but some of these info's here were pretty amazing. Thank you
Hey whats that at 1:12 with the colored project folders? looks kinda neat
An asset, rainbow folders 2
assetstore.unity.com/packages/tools/utilities/rainbow-folders-2-143526
Looks awesome
Thanks
Very useful information! You could also make a video on how to create better systems using encapsulation and depending on an event system rather than communicating back and forth between components.
Working on it right now :D
Last two weeks I wrote the code I will share, because I can't talk about an event system and then tell you to go find one. Now I'm testing the system with a small prototype to see if everything is cool to write, the custom syntax and if it works as intended. Next will be documentation and then the video text, voice recordings and cutting. xD
So ... maybe in a few weeks? You can subscribe and ring the bell to get a notification when I upload it. ^^
@@johnleorid Looking forward to that
Thank you for the video! Would absolutely love to see more vids from you
This is gold! Please keep doing these kind of REX, it's priceless.
Did you do a video on the coding part at the end?
Was collecting footage, writing code, doing a lot of research and working on Games (also for the video) in the last weeks and started actually working on the video (in the videocutting software) within the last week.
You can ring the bell to get a notification when it's ready and uploaded. ^^
REX? ^^
@@johnleorid my bad, experience feedback basically. I thought it was an international term (I'm french).
@@johnleorid notification activated!
@@sogekiin ah thanks for the follow-up :)
Very interesting video. I'm not into unity and I surely never will, but I think that the overall concepts you've outlined here are also applicable to other engines like Unreal. Thank you!
Great content. I'm tired of videos on just small scale games.
I want to know about big games! The potential of the engine! The limitations! More please!
Very useful content. Thank you and your patrons :)
BRO! The animation you showed on 14:39 on "Unified Communication System" through the Event System is really interesting. I'm really struggling with writing code that's extendable and maintainable throughout all my systems. Even in small mobile games, it can get pretty complex. Would love to watch a video on "Writing Code for A Complex Game" that you mentioned.
Had to do a lot of research, also I wrote a event system myself which I want to share with the release of the event system video and of course, working on Games.
But I am actively working on it and I hope to release it soon. :)
It's way more work than I thought it would be. As always. xD
@@johnleorid Awesome dude! Can't wait! I have you on my notification bell. Appreciate the content you're doing for us in the game dev community. Hope you make it big man!
9:30 a solution is to not iterate over it each frame
use triggers, store items you're close to in a list when you enter a their trigger, remove them when you exit the trigger
if it's related to a button press, you do not need to check every single frame
while inside the trigger, use the input system to get an event, and do the item pickup code in that event
this way you don't hold up the frame buffer when doing input checks.
Hey there! I rarely comment but I think you deserve one ;) Very good and interesting videos. What I love about it is , despite beeing about Unity, most of the advices works for all game engine. I'm trying to learn Godot , and depite it beeing a very good engine, it's also one that needs the devs to optimize their games a lot, especially if you are working on 3d games. And I knew some of the stuffs you talked about, but other were really helpful. Liked your videos and I do believe you really deserve it! Nice work!
Edit: Also, would totally love a detailed video about optimizing scripts :P
Thanks a lot for your comment :D
I'm looking forward to a Code Optimization video, but first I want to share the event system, as it's a very cool pattern (when used correctly). ^^
Great advice! I'd love to get a more in-depth discussion about a central communication hub as suggested in your video.
Just a heads up for the baking light segment, you can always change the Lightmap Size, compression, and a lot more in the Lighting Setting window.
Yea, but seems like the new way is to use probe volumes, they are different than the old light probes in many ways and can be used in bigger levels. I still wouldn't use them everywhere in an open world map and they have quite some limitations (e.g. daytime change only works with blending).
This is one of the reasons that many games, especially old 3d games, use a tile-based rendering system. This allows the engine to load/unload chunks of the terrain as needed. Look at the original Ultima: Underworld. When you look down, sometimes you can see that the terrain behind you is missing. If you walk back a few steps, it reappears. This is because it only renders what you can see if you look straight ahead.
I would love to see a detailed explanation about coding a "Big Game" and great coding layouts or structures to follow tbh
First-time visitor and I love your intro.
Thanks for the video!
Very useful advises. The only problem for me is that I struggle before all of these problems start to appear in my project.
I end up far before - when trying to manage code in a big project. I can program any mechanic alone. But when it comes all together I just got overwhelmed.
I watched and read a lot about architecture approaches, patterns and other stuff. But in really it is almost impossible to separate systems to make it clean.
And when you try to separate them by some kind of events system - you only make it worse. Because they now look like isolated but in fact they are still connected but in more complex and hidden way. And now it's harder to debug and maintain.
So yeah. I would love to hear about managing code in a big games
It's a way of thinking, I'll try to cover it in the video but it will need more than one to show proper examples and applications of it in various situations.
At the end of the day, architecture is all about connections, the less you have, the better.
Stay tuned because I think this is exactly what my next video(s) will be about. ^^
Will be interesting to see how Event System based coding works in your games. An explanation video or a tutorial will be very helpful
@@mrteco4236 Like in 14:44. One Event System to manage all game components
@@mrteco4236 Yes. I use managers in my games too. I am interested in the way he visualises the event system in the video
Working on it ^^
Really amazing video, I saved this to rewatch now and then. In my personal opinion, the lightmapper is soooooo time consuming. I've tried so much times to use it, and kinda get to know how to make it work, but honestly it's waay more easier to simply use realtime lighting, and it looks pretty similar. I guess it can be used only in level based games, like portal for example
Bloody brilliant content, thanks for uploading and looking forward to more insights in your future videos
Subscribed for this video, well done!❤
Awesome video with fantastic information. Thank you so much for making this ❤️
i got a question what hardware spec would you recommend for me to use
You deserve all the subs,
Thank you
Great video John!
Nice, you made some real good points. KISS being one of them.
Great video! Almost all of the tips are sort of a must have in any more or less normal project. Unless you are stamping trash mobile games every week - all of these tips are really useful.