Game Development Community

Game crashes when it reaches 1.8GB of memory usage

by Jeremy Dains · in Torque X 2D · 01/26/2011 (3:02 pm) · 14 replies

We are currently developing a game for the PC that is using the Torque X 2D engine. Currently, we have well over 1000 sprite sheets, over 100 environment tiles, and a plethora of interactable 2D images. Each sprite sheet is roughly 2000X2000 in size, and none of our images go over that limit. Each image is a PNG file format, on average about 1.5MB's. We have every image DXT compressed, and the XNB files are around 4MB's. We are having issues that include the game crashing after 1.8GB's of memory consumption.

Each of our images is very good quality, and we don't want to compress them anymore for fear of image quality degrading.

Is there any way to increase the memory limit for Torque? Or possibly decrease the XNB files sizes? Or possibly dynamically loading and unloading images?

About the author

Recent Threads

  • Instancing Error
  • 2D Melee

  • #1
    01/26/2011 (3:24 pm)
    If you have access to the CEV4 version of the engine then you can have much better control over loading/unloading of resources.
    #2
    01/26/2011 (3:36 pm)
    Duncan,

    Thank you for the reply.

    I currently don't have access to that engine. I'm not exactly sure where to locate it. I searched the site and unortunately was unlucky with finding any link to that engine.

    I'm assuming you're speaking of Pinos engine? We have already attempted to contact him through email but he did not respond.

    How can I get access to that version?

    -Jeremy Dains
    #3
    01/26/2011 (3:42 pm)
    What's occurring after 1.8GB usage ? resources appearing as whited out blocks ? or lag ? if its lag have a looky here

    www.garagegames.com/community/forums/viewthread/122957/1#comment-796039

    If its memory related -
    I've had similar issues tho more in terms of running over the 150MB limit. You'd be surprised how much you can save in terms of file size using something like RIOT for free - http://luci.criosweb.ro/riot/ for compressing your PNG's or if u got the money - Fireworks/Photoshop PNG compression

    For comparisons look here

    www.13hours.net/samp/compression_tests/

    I halved my file sizes from 1.5MB down to 76kb

    Hope this is of some help.
    #4
    01/26/2011 (3:50 pm)
    Hoddie,

    Thank you for the reply.

    Currently, animations on screen start to disappear once we get near that 1.8GB memory usage threshold, the game gets very laggy, until we get to the point where we get an "OutOfMemory" exception.

    We've actualy compressed our images as much as we can through photoshop, and if we do it anymore we start losing quality.

    I'm just not sure why the game crashes when the memory usage reaches 1.8GB's. Is there a built in limit that can be changed within Torque itself?

    -Jeremy Dains
    #5
    01/26/2011 (4:17 pm)
    It's probably crashing at that point because the max amount of memory allowed for a 32bit application is 2GB, and that is a OS/Hardware limitation the only way to allocate more to the game would be to compile a 64bit version of the application which, I believe, currently isn't possible with XNA.
    #6
    01/27/2011 (5:08 am)
    As Alex said, it is a 32-bit OS limitation. Your only option is getting access to the Torque X CEV and using the advanced content loading features. That is where you create content blocks that can be loaded/unloaded at will in order to free up memory.
    #7
    01/27/2011 (6:54 am)
    Also get a memory profiler and check for leaks. It could just be that your game is leaking memory and once you know what is leaking you can clean it up (incidentally the CEV4 fixes the leaks that are inherent in the original TX engine, so that is certainly a good start as well).

    Contact Pino on the forums for access to CEV4 (you'll need the source code version of TX)
    #8
    01/27/2011 (8:03 am)
    Thank you for the replys everybody. I've contacted Giuseppe for admission to the CEV project, I can only hope this provides a good turning point to our game.

    We actualy have no memory leaks currently simply because we have been running profilers to see what is going on. Unfortunately, our biggest issue is large file sizes and the need to better handle loading/unloading.

    Is there any documentation to the CEV4 TX engine by the way?

    -Jeremy Dains
    #9
    01/27/2011 (8:48 am)
    There is a little scattered around, but not huge amounts. If you want any pointers using the content loading/unloading then just let me know. Matt (Chu's Dynasty) has also used it in his games - and you may well want his materials ripper as well to rip unused materials from levels.

    Anyway, get yr game working with CEV4 first and then see about optimizing resource usage.
    #10
    01/27/2011 (9:13 am)
    I can also assist you with a content loader. I have a complete level loading system built for my current project, Kobold's Quest, that uses the advanced content loader to 1) Forcibly pre-load certain assets upon startup, 2) Asynchronously load common assets in the background during the titlescreen/character select screen, and 3) Load and unload level specific content blocks during level changing.

    Just e-mail me using the e-mail address in my profile when you are ready to tackle content management.
    #11
    01/27/2011 (9:28 am)
    That sounds great john! Glad to see people are finding it useful :-)
    #12
    01/27/2011 (11:05 am)
    I should probably document how I did it someplace as it covers the advanced content loader and the asynchronous scene loader in good depth. I e-mailed the stuff to Jeremy already, so I hope he understands it. My GameLoading class is kind of complex as it deals with using a custom GUI control to fade the screen out, unload the scene, start my loading.txscene to play my loading animation, load all my content blocks and asynchronously load the new level, then properly unload loading.txscene, switch over to the new scene, and finally use another custom GUI control to fade in to the new scene.

    I'll look into improving the ease of use of the whole system and putting it up someplace as properly changing levels is something people seem to have a lot of trouble with.
    #13
    01/28/2011 (8:48 am)
    John, that would be an awesome resource!
    #14
    01/28/2011 (10:26 am)
    Well, I've uploaded my files here:
    suckerfreegames.com/_tx/GameLoading.zip

    I've documented the source code, but I haven't had time to write up any normal documentation. It will have to remain like that for the time being. I'll look into adding it to the CEV project page and possibly the TDN later.