This is a basic beginners tutorial for those that need help compiling Lua projects for Playdate on Windows. Essentially all you need to do is run the Playdate SDK file "pdc.exe" on your game folder that contains your "main.lua" file. However, this will not work correctly if you don't set up your System Environment Variables first. Here is a step by step guide on how to do it on Windows:
1. Hopefully you have already installed the Playdate SDK. By default, the install path is "C:\Users\username\Documents\PlaydateSDK". Navigate to the folder in your Windows Explorer, and copy the path.
2. Press the Windows key and type "path" to find the "Edit the system variables" option.
3. Click "Environment Variables" in the bottom right.
4. Click "New" under the System Variables section.
5. Set the "Variable name" to PLAYDATE_SDK_PATH and set the "Variable value" to your Playdate SDK folder, which should be C:\Users\username\Documents\PlaydateSDK
6. I would also recommend adding the bin folder to your Path as well. This way you can run "pdc" from anywhere in the command prompt. Double click the "Path" item (highlighted blue) under the "System variables" section.
7. Click "New" and add the path to your Playdate SDK bin folder. By default it should be C:\Users\username\Documents\PlaydateSDK\bin
8. Now you should have your System Environment Variables set up. To test this, we can try running "pdc" from the command prompt. Launch the Command Prompt by pressing Windows Key and searching for "cmd"
9. Type "pdc" and press Enter in the command prompt. If you see something similar to the image, then you did it correctly!
10. Now that you can call PDC from anywhere, we just need to use it on one of our Lua projects. I am using the Drum Machine example from the Playdate SDK folder. Copy the path to the Source folder. One important thing to note is this MUST be the folder with the main.lua file in it!
11. In your Command Prompt, type "pdc" followed by the path to the folder containing "main.lua". You should also surround the path in quotation marks to prevent possible errors with the path name. The full command should look something like this:
pdc "C:\Users\username\Documents\PlaydateSDK\Examples\DrumMachine\Source"
12. If things were successful, you should see a "Source.pdx" folder in the DrumMachine folder. This is the final PDX folder than you can use on your Playdate! Feel free to rename the folder to "DrumMachine.pdx" or anything besides "Source.pdx".
13. You can either drag it directly into the Playdate Simulator, or use File -> Open to point it to the pdx folder.
Congratulations! You can now compile the Playdate Lua example projects or start working on your own Lua projects! When working on your own projects, it might get annoying to go to the command prompt, paste the text, rename the folder, and drag it to the simulator. I can write another tutorial for creating a BAT file that can automate this whole process. Hopefully this tutorial was helpful!