I need to clarify some points about optimization and performance and about how Gdevelop works; maybe this will help me and others who have the same doubts.
I am building a game (it will be a large game) whose images so far (later I will incorporate more complex ones for the interface) made pixelated (64x64). No large image, there is practically no particle system so far except limited to certain specific ones. There are many objects, many animations which include many frames. Some animations (few but there are) exceed 50 frames. So far it only has one scene which is where I’m building and then having the structure to do the rest. Although the folders are organized; when viewing the preview with developer tools, I see many errors mainly due to not finding images that, according to what I saw, are images that are not used in the game (deleted or unnused). It has practically no sounds and they are in mp3 to take up less space.
These last days I have been trying to optimize the resources, grouping the events, trying to change some events (for example “for each object”, which consumes a lot of resources) for others that are functional.
The most important part… when I start a preview, it stays loading in a static image for about 1 minute. After this, the Gdevelop loading screen appears with the progress bar. This last instance takes about 10 seconds to load.
My intention is to publish for mobile, which requires a deeper optimization given the lower average capacity of mobile phones to process games. When installing an APK on mobile (android), pressing play takes me directly to the loading screen with the progress bar and it takes about 1 minute and 24 seconds to start the game. FPS on mobile is between 60 and 40, most of the time around 50; I consider this a poor performance and that is why I must continue evaluating how to optimize it. On PC it stays at 60 FPS.
I’ve been reading many queries on the forum about these issues but I can’t figure out if this situation is to be expected or if I’m doing something wrong. I know that there are no magic recipes, I know that i have to look carefully at each event to find what are consuming the most.
On the other hand, I don’t know if the memory consumption is excessive or not. When Gdevelop is opened without the preview, the values are these:
When I press for preview I get these memory consumption values:
It should be noted that as I make successive previews, the ram consumption increases (can reach around 1200 MB consumed).
My intention is to incorporate some animated sequences with high graphic quality, but if this takes so long to load I don’t want to imagine if I incorporate these animated sequences.
Are these normal situations or is there something wrong? Why is there a loading time before the original Gdevelop loading screen in the preview that takes around 1 minute? Why does it take so long to open the APK on mobile? Does this time depend on the amount of resources in the game (objects, sprites, sounds, animations, etc.) or is it related to some inconsistency in some events that makes the load take longer? Is there a way to decrease this initial load time?
Hi! I have no answer but I’m interested in this questions :
It’s the same for me. I haven’t found why. This thread is about this issue, with no real solution so far :
hehe I also found that, but not sure if I should modify all my game based on this. I have a lot (I mean… a lot) of RandomInRange in my game. Removing these events would greatly affect gameplay. I would like to know if I should re-edit something, even if it takes time, but knowing that it will solve my problems.
Can you remove unused/deleted resources then to see if that helps? (it certainly can’t hurt). Open the Resources tab (from the project manager), then right-click on any item and choose the appropriate option for removing unused resources and resources with invalid paths.
I don’t have many objects that I don’t use. Still, I’ve tried removing all objects that are not used in the scene, but there is no significant change in load time. There are many sprites inside the computer folders that I don’t use because they were modified and/or because I used as a base and modified them (copies of the previous ones remained). Removing all these extra sprites would take too much time and I don’t know if this would actually fix these issues (I have the option set to export only the resources that are used in the game).
EDIT: Now I understood what you meant haha . I did it that way (removing all unused resources and paths) and the initial time (before the original loading screen) was reduced from about 50-60 seconds to 30-34 seconds. Sprite loading errors were no longer listed. It’s a good approach
What is the size of your images and how many are you loading exactly? If you have a slow hard drive, that may be the bottleneck: GDevelop loads all of the images in memory at the loading screen, so if your images take a lot of megabytes and your storage is slow, loading them all may take some time.
Make sure to compress your images, not to use an image resolution too big (anything higher than 500x500 is commonly seen as already excessive), not to use a high color depth…
I don’t know if you guys can do a test on Linux to see the difference. Because, I myself realize that on Windows it takes forever to start the game. And my machine is even good! I5 + RTX2060(12GB) + 8GB RAM and SSD.
See the difference between Linux (First) and Windows (Second) on the same machine!
My images are all made with Piskel; 99.9% are 64x64. The ones that aren’t aren’t very big either. Is there a way to count all the images in the resources other than manually? haha. In the computer folder there are more than 21,000 files … about that, the used ones must be half or maybe less because many are unused sprites (they are folders and base copies to make other sprites). The total occupied is around 64 MB (I think is the half of that what the game actually uses).
Is it possible to compress all the images without having to remount the objects?
Each image weighs just under 1KB.
I have enough RAM, processor and hard drive, that would not be the problem. Besides, I should be able to get the game to run smoothly on an average phone. With the removal of unused resources and paths, I was able to take around 48-50 seconds to start the game on an average cell phone (it used to take me 1 minute and 24 seconds), and the average FPS improved. Note that there are still a lot of images to be done and my idea is to incorporate higher quality images for the interface.
That is quite odd
When pressing preview, you should get such an out put in the developer console of the IDE (Ctrl-Shift-I):
Could you screenshot it? It would be interesting to see if one of those export steps in particular is the bottleneck
EDIT: As you said, there seems to be a bottleneck when exporting the resources (30040 ms ). Also, I see that there is an error loading two resources:
Error: “You entered a number, but text (in quotes) was expected.” in: “0” (string)
Hi Points, some advice I’ve read somewhere on the forum that helped me is if you have a lot of images in your scene, then switch to the events tab before clicking preview.
Thank you all for the answers.
So is it expected to take that long or is there some error delaying the resource load?
I haven’t noticed a significant difference with that (when the resource panel or developer tools are open it takes a bit longer).
Anyway, my problem is not to wait for the preview, but to know if I should put a limit to incorporate more things into the game or if there is some error that is affecting the resource load and it has a solution.
How many scenes do you have? I have more than 50, and the number of scenes definitely causes it to take forever to load. I’m looking into a way that I can dynamically load rather than loading it all at once.
When you click preview the game is exported for html5 locally in a temp folder, and all the resources goes with the export, so if you have heavy or tons of files the export take longer to load.
Scene have no impact. There are loaded only when you call them.
Few scenes, but it does not depend on the number of scenes but on the amount of resources. I guess the only way to achieve resource loading on demand would be through programming language.
I am currently having trouble loading resources into what I have exported as an Android APK, both what I had previously exported and what is currently exported. There is a progressive decrease in the speed of loading resources (previously the loading speed was linear). This is for android APK only.
Resources as in number of objects, or number of sprites?
I cleared up a ton of coding errors too and this seemed to reduce load times by about 25%.
Resources implies everything in the game, each image of each animation, each sound (which can be loaded on demand), videos, programming (it does not take up much resources in terms of loading time but it does take up resources during the game).
Keep in mind that there are resources (sprites and others) that remain in the game even if you delete them. In that case you must go to the section where it says “Resources” in Gdevelop and delete the unused resources (there is an option that deletes all the unused resources in the game). If they are not deleted in this way, they are exported along with what is used, making the initial load slower.