I need to discuss about something.
The game I have been making feature graphics in the retro era. The images are small and the the game's native resolution is only 480 x 320 and majority of the images are even less than 64 x 64. I have been watching those memory numbers down below from the beginning. Right now, it is only:
Approx download: 92.2 mb memory use: 72.9 mb
Recently I have seen this error where the loading percentage sometimes turn red in the beginning. I looked around the forums and I see that it is related to having way too many images in the game. Each Sprite object in my game got something like this sprite sheet: (but fewer images)
While claimed that it loaded 10000 frames and encountered the same issue, however I've discovered something else, in my game I've also tried previewing a layout which only have 1 Sprite that has only 1 frame and nothing else, the error also occurred multiple times.
Previewing the game in Chrome and launching up the debugger, I see this:
I checked :
[quote:11274wk0]Construct 2 only loads the images for the current layout. This avoids loading the entire project in memory which would be slow and consume a great deal of memory. When starting a layout, all images for the objects placed in the Layout View are pre-loaded. This includes all frames in all animations of any Sprite objects. (In other words, Sprites are either fully loaded in to memory, or not at all - they are never part-loaded.) When the layout ends, all images that are loaded but not used on the next layout are released from memory.
I don't understand. I thought Construct 2 only loads the images for the current layout. But here, all these output from the console show that the engine failed to load images that are not in the layout I am trying to preview, which has only 1 Sprite with 1 frame of size 128 x 128. The event sheet in this layout also does not create any other Sprite or stuff from other layouts. It only wait for 5 seconds before proceeding to another layout. So... why and how do these images come from? Is it because of the preview mode so all these images are here?
I have been testing around and here is what I got so far:
On Chrome, Usually, this loading percentage turn red at around 1-2%. If it did not turn red around at that time, mostly it will be able to load up to 100% and the game will play without any problem. Sometimes it occurs. Sometimes it does not. But apparently, as more and more images are added, it becomes a lot more frequent.
For Preview Node Webkit, when it starts up, it goes 1-2%, it could turn red at this time. If it does not, it load its way up and the game can be played.
I have also tried exported Node Webkits. After hitting the .exe, the loading percentage jumps up to 27% initially and made it ways to 100% and the game runs just fine. I've tried this multiple time, and it never fail to load even once yet. But this does not mean the problem could not occur on exported Node Webkits in the future. In fact, obviously Node Webkits are basically Chromium, just like Chrome. So I expect it to pretty much behave just like Chrome, but right now it does not - it can play the game without any loading red percentage .....for now, it seems.
So here's the thing, Ashley. Could you please confirm the following:
1. For exported Node Webkit (which problem never occurred yet), can I take it for granted as a workaround that I should be able to avoid this dreadful error with it, yes or no? Please give us an insight. While we have quite a number of animation frames, each of our layout never contain more than 500 animated images. (In fact, most of the time, it is only 100-200 images) Also, recall Approx download: 92.2 mb memory use: 72.9 mb
2. Programming-wise, I believe C2 clear up unused textures. I've tested it and it worked. But about the error I am facing here. It's as if during the preview, C2 has to allocate all of the resources for all images in one go for some reason. Could you please confirm this? Or is this some sort of loading implementation in favor of previewing sake? Or is there really some invisible global limit to the total number of images regardless of their sizes for the whole project? (again, recall Approx download: 92.2 mb memory use: 72.9 mb )
If the answers for questions are "yes, I can take exported Node Webkit for granted as a workaround, as each layout pretty much contains only 100-200 images and C2 can allocate and deallocate all the resources without any trouble. It is likely that preview contains some bugs", then I would be happy to use exported Node Webkit to "preview" my game instead.
However, if there is really some invisible global limit, then... this could spell doom to my project that I've been working for 1.5 years...
So Ashley, please confirm.