Saturday, February 10, 2018

assets - How can i load a level in my gameengine wich is larger than 2GB? C#


i were asking myself how could i load a large Level? My gameengine is written in C# and is rendering with Direct3D11. I just have my class called "Scenery" and the class is able to store all objects in a level (sceneryObject) with their components and features. My engine loads the serialized scenery, but i know that the maximal size of a .net object is 2gb. So how could my Scenery class load bigger levels? The .Scenery class contains a List with all the objects, and the Assets are included within the sceneryClass. Do you thinkthe Scenery class should not include the Assets, and they should be stored extern?


Maybe somebody have a suggestion :)


Best Regards and thanks in advance!



Answer



Break the level into smaller chunks and load those instead.


This will give you a number of extra benefits, decreasing overall memory usage and enabling you to stream levels in and out to decrease perceived load times.


A basic approach to subdividing a level is to do it based on a fixed-size grid, where each chunk is a grid cell. To start with, you could just do the chunking piece: break everything up into chunks however you need to (including splitting your source map assets, if necessary) and load them all, assuming you have the memory. Once that works, worry about figuring out how to load only the parts that are immediately needed and stream the rest in and out.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...