Compiled pdx much larger than expected?

I wonder if there is an option to use a simple and small 1 bit graphic file format instead of the huge 8/24/32 bit PNG? For example, I build my game, the .pdz file is about 60 KB, then I add a card.png, a pressed one, some introFrames, and launchImages, then finally the compiled project grows up to 10 MB, because a single .png image file is about half megabyte, instead of the 12 KB of uncompressed 1 bit image data.

It sounds like you have some supporting files being packaged into the pdx. This is a common beginner problem - it got me too.

Please see https://sdk.play.date/1.9.0/Inside%20Playdate.html#_structuring_your_project

Any contents of the Source folder will be compiled (PNG, WAV become Playdate formats) and included in your .pdx, and any files that can't be compiled are simply included as is (so a Photoshop PSD file comes along for the ride).

The easiest way to figure this out is to look at the contents of your .pdx and look for any files that shouldn't be there.

You shouldn't be adding files to your pdx manually, everything should go through the compiler.

3 Likes

Thanks, you're right. As this thread doesn't seems to be useful for others, I consider deleting it...

1 Like

Great!

I think this thread is worth keeping because this is a common problem that trips many people up. Over the years the Developer Preview has been active I have lost count of the number of times! :slight_smile:

Maybe the docs could be clearer on this?

I'll rename the thread to better describe the problem that was solved.

2 Likes

I saw this thread and thought I'd check out how large my pdx file is looking for my game. It ended up being way bigger than expected (17MB), but there didn't seem to be any strange source files in the package. Then I realized that there was another copy of the pdx file from the last build in the package, and that pdx file contained another earlier compile, and so on ...
It turns out because I was compiling directly into my source directory, I was making my pdx file exponentially larger every time I compiled. No wonder each compile took longer than the last one! :melting_face:

1 Like

I've also done that! :laughing:

1 Like

A warning would be helpful in such cases (unknown or unused files in the source folder)

It's tricky because the game might bundle "unknown" files.

For example i bundle a bunch of JSON files that are accessed by a programmatically generated name rather than a hard-coded name.

But iirc there's already a related issue, or related compiler improvements, relevant to this @Dave?

1 Like

I've been thinking about adding some kind of optional build instructions file that lets you tell the compiler to ignore specific files or folders, and we could add an "ignore all unknown sources" flag too. I haven't done any work on that yet, so no telling when or if it'll happen. It's also something that you would opt in to, so if you know about that you probably also know how to separate your source and build folders. :stuck_out_tongue_winking_eye:

But having the compiler simply mention "hey, I'm copying over this file because I don't know what else to do with it" seems like a good idea. I'll file that!

4 Likes