Insane Huge Terrain 10,000 square km - Godot engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] this is a 10,000 square kilm terrain this area nearly match the size of the Lebanon a country in Middle East maybe you watch one of my last demo which I described that I made a train three times bigger than the map of the GTA V but this map is 125 times bigger the map of the GTA 5 and right now it is running on go. engine all of this because MRA does not limited by your RAM memory anymore but let's see how this is [Music] possible so let's see what we had before this train update the way this train worked before was like this at loow time train will put the height map and everything related to the train into the RAM memory after that two thread start to work in a loop one of them is physics update thread which is responsible to creating physics Collision shape for our train at the same time another thread start to create train mesh with LOD system also this thread reduce the size of the height map for region far from the train and basically it optimize a lot the GPU memory if you want more information about how this system work I recommend to watch my train progress playlist I also put some other useful resources in the video description so up to this point we did a great job and as much as our RAM memory allows we can create terrain I could say with the current computer in the market we could create a 16 km by 16 kilm Train by this method which is also a big train and it is bigger than many open world games but I want to go beyond this and create some something even bigger so the only way to do that is to load and unload heightmap data from hard disk and that is a little bit difficult you know why because look at this we have some data and we feed this data into two thread and as long as you have two separate thread and they just read the data there will be no problem here the thread which update the mesh and the thread which update the physics are completely separate so everything is okay but now we want to create another thread which load or unload the height map data or in another word it right into our data and this can cause a lot of problem so we should make a lot of synchronization between these thread so everything can work so here I decided to do one thing you know we launch all of this thread in another safe thread which is the main thread which Run the game Loop what I did is this at first I calculate which train region should be unload or load and I made this calculation in that safe thread before launching any of the other threads after that I launch all of the other threads so here every other thread is agree which region is going to be destroyed so no one is going to use that region data that was the main thing but there are a lot of other technical thing also to this and even after making this Agreement System almost everything in train collapsed there was a lot of crashes a lot of glitches brush and sculpt system does not work layer system was not working but after hours and hours of work I put everything back together and you know when you are working with thread and there is somewhere a memory corruption unfortunately there is no good way to get a good error the best way to solve that is to read your code and make all of the logic inside your head and then maybe you guess what is happening so let's take a look at the newer version of the the MTR plugin first go to the GitHub and download the latest MTR plugin you find in the release section and please note at the time of the recording this video this can still be unstable but if you watch this in future I don't know okay after downloading that put the entering plugin inside your add-on folder and activate that also maybe the first time you run go do with this plugin go do make crash just run the go do another time now create an enter Noe so first thing you need to set is your region size you can set that here the unit of region is in Grid unit I really suggest to watch my other video which I explained how these numbers work you can also check the Viki page on GitHub also if you click on the info button this will give you good information about region size and train size now in this train update we have another property in the train property panel which is the region limit this means up to how many train regions should be loaded at each time in memory by default the value is two but you can increase or decrease that now if I create the train you can see the region will be loaded and unloaded so what if you want to create a massive train like the train I made in that case there are a couple of things that you should pay attention to first of all it is much better to use double Precision go do in that case you should build go do for double Precision also so you should build M Train plugin for double Precision in case you go over 1 million unit far from the center in God do this could happen but in this map you can go up to 50 km far from the center this train is 100 kilm long in each Direction and if you go to the edge of this train you cannot see this effect but your physics system will be a lot more buggy like you can see I am stuck here and many other AR can happen to the train also for this demo I used a single Precision but for a serious work you should use double Precision another thing is that you should handle a lot of data currently in this 10,000 square kilm train the height map data size is 40 gab I also have one a Splat map for this train which is also 18 GB in total I have 58 GB of data only for train of course if I add some type of compression system to the train resource we can reduce this a lot but as I think no one want to create such a big word this is not my priority even if you want to create such a big word you should have a big group consist of many persons so as most of us don't want to create such a big board can this make a difference for a smaller board and yes of course for example this is a demo for alien planet which I created before in this demo with the previous version of MRA plug-in train needed around 1 GB of RAM memory for train but now it only consume 500 megabyte of RAM memory and this number won't change as your map size change even if you create a train double size of the alien planet as long as you keep the region limit and region size around the player same it will consume the same amount of the ram maybe the Ram size will increase a little bit because train need to store some internal thing even for places which train does not exist let me show you the graph for RAM usage and vram usage for Alan planet in the previous version of MTR plugin as you can see the RAM usage is always stay as same but vram usage change because we stream resized height map texture into each region depend on how far they are from the camera and this is the graph with the current version of MTR plugin for alien planet you can see the RAM memory usage is decreased also we can see the RAM memory usage will change during the run time and that is because we are loading and unloading train resources from hard disk for this 10,000 square kilm train the RAM memory usage is around 1.6 GB but this train is really really huge and I think this is okay another thing that is much better to do if you want to create a huge terrain is this you know if you put a lot of file inside your go do project go do editor can freeze a lot for example for creating this train I have 10,000 height map files and 10,000 Splat map files so in total I have 20,000 files so what I did to prevent God do Editor to freeze I move all of the data for train outside of the god do project and in the train directory section I put the pass of the outside directory folder and I had no more free in God do editor of course when I want to export my game I can put again the data directory inside the god do project and change the data directory path and finally thanks to all of my patreon if you have any question or suggestion let me know in the comment section have a good time until the next video bye
Info
Channel: mohsen zare
Views: 7,191
Rating: undefined out of 5
Keywords: godot tutorial, terrain, open world, godot 4.2, godot 4.1, godot engine
Id: nFzaRfreD_o
Channel Id: undefined
Length: 9min 18sec (558 seconds)
Published: Sat Dec 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.