Product Chat / Deleting and Loading Assets via LUA

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 2nd Dec 2019 18:57 Edited at: 2nd Dec 2019 18:59
Hi all,

I've been working pretty hard on 3 separate projects and I was curious about optimization and keeping the memory cap down.

Would it be a good idea to use the delete image and delete audio LUA commands before loading the images and audio? Does it ever stack? Is deleting and loading good practice on the start of levels? Does this at all affect performance or help prevent the memory from getting capped?
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Dec 2019 00:16
Quote: "Would it be a good idea to use the delete image and delete audio LUA commands before loading the images and audio?"

as long as you're checking they actually exist first sure, might get some errors if not.
Quote: "Does this at all affect performance"

not really in a positive way, it's possible you could get slow down if you were near the memory cap but not quite reaching an error state... but it's likely to cause slightly longer load times if you have to load large files and if you are doing this repeatedly then it is generally better to keep them
Quote: "or help prevent the memory from getting capped?"

during the level yes it can help... it's generally a bad idea to repeatedly load and delete a resource that is used frequently (for instance a map or inventory is probably ok to keep the bulk of as you are likely to want to keep reusing the backgrounds etc, to reduce space you can delete the smaller items that will change more often - as items get used during the game etc) but if you had an image at the start of the level that you no longer need for the rest of the level it's generally a good idea to delete it (e.g. the instructions for how to play when first entering the game or an intro sequence).

i'm pretty sure GG loads all sound at the start of the level so i'm assuming you're talking about global sounds here? anyway the same logic can be used for sounds - repeated (e.g. gun shots) = keep, low usage (e.g. intro dialogue) = delete

remember GG should already clear up anything between levels so this is only necessary if you are reaching a memory cap during your level.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 4th Dec 2019 20:21 Edited at: 4th Dec 2019 20:21
Thanks smallg, this is really helpful knowledge for anyone trying to make a multilevel standalone. With optimizing each map.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-10-07 00:30:16
Your offset time is: 2024-10-07 00:30:16