As I have been working on both Windows and Linux for my game dev, I have come across something strange that I am not sure if it's a bug or something I am doing wrong.
When I compile/build the same code between two OS, I get different resulting sizes.
For example, my game reSnake (itch.io link, github link) when built on Linux using pdc results in a .pdx file size of 117.6 KB and when built in Windows, it is 168.6 KB. The pdc command that I use to build on both OS is:
Looking at the main.pdz, both are around 98 KB. This makes me think that the compiler combines all of the .lua files (via the use of imports) into a single main.pdz file on both OS's, but for some reason the Windows compiler does not remove potentially redundant files.
I tested this theory by compiling the Windows build and manually removing the extra files so that it resembles the Linux build. The game runs perfectly well in the simulator.
In summary, the main.lua and util.lua files are the only files that I have in the root of the source folder. Everything else is dispersed across game and screens folders. I'm not showing screenshot and images folders because I don't think they are relevant and they only contain .png files.
If you want to look yourself, you can see this same structure in the main branch of the Github page.
As a small experiment, I did try to flatten my project structure to put everything in the two folders to the source folder and after building it DID WORK as expected .
Yep, there are some problems around the import statement.
To be most safe, it is best to keep all lua files in a single folder.
I myself opted to implement my own version of the import statement, but you have to know what the pitfalls are when going that route