Lua Memory Consumption Tips
As you develop it's always worth paying attention to your memory use. The Play.Date Simulator has a handy 'Show Lua Memory (Alt+M)' panel which shows you where Lua memory is going:
Looking at this today I learned two things!
1. WAV files are almost 1:1 between their file size, and when they are loaded into Lua memory on the device. This is why the Inside Play.Date SDK documentation clearly warns you about WAV files! That musicPlayer object is playing the Lone Fury title music - a 3.2MB file on disk. If you're using Audacity, you also want to export your WAV files as "IMA ADCPCM" which is the best, most compressed format the Play.Date supports according to the fine folks at the PlayDate Squad Discord server. Using IMA ADCPCM reduced that 3.2MB music file to 800kb. WAV files for music can also be streamed from the Play.Date filesystem using a fileplayer, rather than a sampleplayer which also saves memory.
2. Do NOT define Lua functions you are not going to use. I'm dragging in the lume.lua file in it's entirety but only using two functions from it! This also applies to test code as well. Considering removing it or commenting it out. For example I've just deleted the stateTest.lua file from LoneFury.
Get Lone Fury Arcade Shooter for play.date
Lone Fury Arcade Shooter for play.date
Bosconian Arcade PlayDate
More posts
- Lone Fury v1.1 Released!35 days ago
- Eco Friendly Fury37 days ago
- Lone Fury v010 Uploaded55 days ago
- Lone Fury v008 Uploaded64 days ago
- Lone Fury v007 Uploaded67 days ago
- Lone Fury v006 Uploaded68 days ago
- Lone Fury Github Repo75 days ago
- Lone Fury v005 Uploaded81 days ago
- Lone Fury v004 Uploaded87 days ago
Leave a comment
Log in with itch.io to leave a comment.