All Languages In Memory Adding Up

More
9 years 1 month ago #1093 by JAC
Hey Frank,

Our mobile game runs tight on memory on low end devices, and we noticed close to 5 MB of memory is going to localization strings. Lot of strings, many long ones. ~1 MB would be fine, 5 MB is significant.

It appears that I2 Localization always keeps all translations of all terms in memory, and we have 7 different languages supported, so most of that is going to languages that we won't ever use for that user (unless they want to change languages).

Is there any way we can avoid retaining references to strings for languages other than the one currently in use, or is that possible to fix?

I understand you can have multiple language prefabs for different parts of your game, but this would be a lot harder to cleanly split for us. Lots of things intrinsically get used at somewhat random times. It's a complex game with a contextual tutorial. We're never using inactive languages, though. For us, those would be harmless to have unavailable without reloading them.

Since I2 seems to store the strings in mostly serializable form, I'm not sure if this would be something you could easily support. If not I'll probably have to rewrite some things to avoid retaining them myself, so any pointers are helpful.

Thanks for all your help!

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #1095 by Frank
Hi,
Yes, in the current version all languages are loaded, as most of the time all translations just add a few Kb.

I have been working intermittently in version 3 of the plugin, which main focus is in fixing that by allowing loading/unloading multiple spreadsheets and having more control over what's loaded and in which format (compressed, plain, unloaded, etc) But it has been a full redo of the plugin so it has taken quite some time!

Nonetheless, there are things that I have used to keep memory down in the current version.

One alternative its to duplicate the I2Languages.prefab (one for each language). then at runtime, whenever the language is changed, instantiate the correct prefab into the scene and set DontDestroyOnLoad. That will only keep in memory what's currently used.

Alternatively, you can save each language to a csv file, and then use the Import_CSV(filename) based on the user selection.

The I2Languages.prefab should be kept with all languages but only a handful of terms (basically, the ones you need in the main menu to allow changing the language without having to do a full delete/instantiated prefabs.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

Time to create page: 0.139 seconds
Template by JoomlaShine