I've run into a major problem with the C2 version of loot pursuit � it takes up too much memory. After my iPhone 4S runs out of memory, the frame rate utterly plummets to about 2-3 frames per second. I've confirmed that it's a memory problem because deleting animations and textures is enough to fix it and send the fps back to 60. It's also only happening on my iPhone 4S, which has 512 MB of RAM, and doesn't happen on my iPad, which has one gigabyte of RAM. It's also crashing cocoonjs.
The game doesn't even have anywhere near the amount of animations and graphics that it's going to have, and I haven't even started on sound effects and music yet. This isn't a matter of not taking in cosiderations of designing for mobile - it's a matter of keeping the entire entire game in memory at once when only a part of it is needed.
I know webGL has memory management, but that's useless for mobile because they don't support it yet. Also, isn't that only for VRAM? Doesn't everything still need to be in RAM?
My question is, will there ever be some way of managing memory better, or is this something html5 simply doesn't have the capability to do? Will cocoonjs's eventual implementation of memory management fix this problem (as mentioned, it's currently crashing cocoonjs)? This is an essential feature for larger games like mine. Because if there isn't some way for this to be implemented there's no way larger games like loot pursuit can be delivered on mobile, even though aside from using too much memory it runs fine. It might even be a problem for desktop games as well, that's a lot of memory use! :(
I never knew you were trying to bring Loot Pursuit to mobile - good luck!
RAM use is typically small compared to VRAM use. In the browser, if it supports WebGL, we manage memory layout-by-layout ourselves. If it doesn't, it's up to the browser to manage it - and if Safari isn't doing a good job you need to ask Apple to fix it, since there's not much else we can do... As for CocoonJS, we have supported memory management in our code for a long time now, ludei just need to add some functions and our engine will detect it and automatically start using it. However Ludei haven't made any progress on this for a while, despite its absolutely crucial importance - the largest games are often the best, and not having memory management rules out the largest and best games. So please ask Ludei to hurry up!
Do you think can you manage creating and destroying objects while is on-screen?
I don't know it may work using Array to memorize every objects each layout in C2 editor, then destroy everything are not on screen in runtime.
Ashley - Thanks for the info, I'll definitely mention it to ludei. What about audio, though? I imagine that could use a lot of memory. Does c2 unload audio, and if so, what causes it to do so, and how does it know what to unload? Or is that up to the browser makers/ludei as well?
I remember at one point, perhaps in a blog or update log, you mentioned the possibility of writing a blog detailing exactly how the memory management works - I would definitely like to know all the details if you're still thinking about writing about it, and I think it would be quite useful to others making large games as well.
— - thanks!
Joannesalfa - I'm already basically doing that. I'm not keeping instances of all objects in the project in a layout at the same time, it's a problem with the way browsers manage memory ? they currently try to store everything in memory at once even though they don't need to.
Is it possible to get a VRAM expression for Construct 2 like in Classic?
ludei Ashley My current game uses a lot of different images (not animated) that, for simplicity of logic, are stored within one object as animations frames and referenced by an array. I should be able to load the images by URL and save RAM (dumping the old images would do this, I assume).
The fact that ajax still isn't working in cocoon means I can't load by URL. I believe ajax is needed to do this. Either way, load by URL and file imports are not working in cocoon.
Please could you put this up high on your current to do list? I am starting to experience RAM issues and have plans to significantly expand the game further. In fact, it's expanding the game with in-app purchases that will allow me to monetise my app!
Develop games in your browser. Powerful, performant & highly capable.
Last I heard, wasn't CocoonJS also experienting with WebGL support? If that's successful, would C2's memory management already be used?
<img src="smileys/smiley1.gif" border="0" align="middle" />
You can see memory warning in the xcode as well when you build the app and you are connected to the device.
We had different problems with the last game Turmoil Deluxe. The only fix was to redraw the art smaller etc. sound is a nightmare i can tell you that.
I think thats possible with JSON and a extension from CocoonJs
And other solution would be to write files into temp or documents folder of the device and load it
I've been in touch with Ludei since this post. They say they're working on memory management features now. Good news and hopefully this will fix large projects!
Great to hear! :)
Really keen for this. Basically stripped my app down to barebones to remove 'Memory Limit warning'.
The memory log option in CocoonJS is awesome for identifying issues with sprites.
How is memory management issues going?
On my iPad 3 I sometimes get a "pause" when I have look in the console there is a "received memory warning" message.
Is there anything we can do in the meantime? Can we dump textures out of memory manually?
What else can we optimise to reduce memory footprint. I have already attempted to get all textures be smaller than 512x512 I am at a loss as to what else I can do.
Ludei is incorporating webGL, which has layout by layout loading, into cocoonJS and has said they will be releasing a new version with it soon.
I guess Ludei has not managed memory use issues and layout-by-layout loading yet, am I right?