Determining memory footprint of games made in Pulp

Hey folks! Jonny from Fatnose Games here.

We're working on our follow-up to Along Came a Spider, and our game seems to be exceeding the 16MB limit imposed in the Simulator (and on device), preventing it from running. I'm wondering how I might go about determining which assets / code are the... bloatiest :melting_face:

Using the simulator I've been prodding at the lua console a little -- using collectgarbage("count") I've been able to determine the total memory footprint of the game currently (just over 16MB). But I've been unable to figure out how to print in any meaningful way what code / assets have been loaded at all, let alone how big they are.

First of all, I'm not sure where the loaded assets are being stored in the lua runtime -- I can see that there's a global playdate table, but for the most part all I can see are utility functions for various playdate systems, i.e. mostly the lua SDK functions. I've tried disassembling the main.pdz and data.pdz files to no avail.

What I do know though is that if I delete enough songs from the game, and then reload the PDX into the simulator, the game runs. So my assumption is that the game is loading all of the assets in somewhere, even if they're not immediately needed? I just need to figure out where, and once I do, I can determine which assets need trimming down.

Any advice would be really helpful!

Cheers,
Jonny

I wasn't aware of this size limit! I'm not sure how closely related it is but there's also a 10 second limit on initial load on device, and as far as I know Pulp games are loaded in their entirety into memory.

Anecdotally music, even though it's synthesised, can significantly increase the size. You might refactor your scripts to save some space - removing all comments and renaming events/variables (and tiles/rooms) could help without actually changing any behaviour.

Hey Scott, thanks for the reply! Seems like a not-oft discussed issue.

Definitely not hitting that load time issue thank goodness, but have verified with the sim (and on device) that we're just a smidge over 16MB.

I actually tested deleting all music from the game, and that only reduced the size by ~1MB, so we've got our work cut out! George is new to programming, so some of our scripts end up being a lot longer than they need to be (i.e. repeating code instead of loops), stuff like that.

Was hoping the simulator / lua runtime could do the heavy lifting for me, but I imagine I'll have to do some manual code archaeology instead :sob: tried to get Pulp Mill working to no avail.

Will keep hammering!

16MB?!?!?!?!?!?!??!?!?! Did you guys find colors in there somewhere? Is the soundtrack in FLAC files? Pulp raytracing?