Hey, great that you're getting started coding and the Playdate is a good place to be at the beginning. Lua is a relatively easy language to learn, Panic is an active and responsive company, and making games is just super interesting.
I would explore the examples folder in the SDK to start. Do not move the SDK from its default location, as some code expects certain file paths to be in place.
To run an example:
- open VS Code
- From the File menu: Open Folder
- Navigate to the SDK
- Find the folder within the SDK named "Examples" and within that "Single File Examples"
- open it
- You'll see a lot of files in this folder, do not be discouraged
- You'll see a lot of "error squiggles" warning you about the code, don't be discouraged
- to address this, there is a 'hidden' folder in this folder called .nova
- this won't be any use to you in vs code, but it will also not do much to remove it
- what you need is this folder, which is something i use in all my projects
- it tells VS Code that you're working on a Playdate game
- this should be in exactly the same folder as the .nova folder
.vscode.zip (2.4 KB)
- Restart VS Code, the warnings should be gone
- Open "main.lua"
- main.lua is the beating heart of any Playdate program (that's not entirely in C)
- don't start coding in C right now, but if you like coding do it some day
- "Uncomment" a single line, the Balls game
- remove the two dashes ("--") from the beginning of line 7
- Save the file in this new state
- You're already coding! Kind of.
- Open the terminal and make the game
- Press control and ` (the little tick mark next to "1") at the same time
- type in "pdc . balls" exactly like that into the terminal, press return (enter)
- okay nowww you're coding
- You should see this in the terminal
Unrecognized file types are copied by default. Use the -k or --skip-unknown flag to skip these files instead.
- Open Finder and navigate to the Single File Examples folder
- You should see a new tenant of this directory, "balls.pdx"
- double click it
You should see the simulator open and run your game. My suggestion would be to poke around with this method, changing which game you uncomment. Make sure to re-comment games when switching, and only keep one uncommented at a time to avoid errors.
Change values, rename things, break it and maybe try to figure out why... All methods of getting a taste for coding. But nothing beats opening a blank file, starting with a new main.lua, and just trying things out.
As an aside, there are some weird issues that come up in game development uniquley that you should keep in mind. Games are constantly updating, and constantly drawing. The Playdate does this usually between 30 and 60 times per second. You can see this visually by placing a print statement inside the main update function of a Playdate program. This will output whatever you're printing in the "console" over and over and over. This constant updating can make it a challenge to run lines of code just once, rather than 30+ times per second.
If that sounds like gibberish to you, you may want to take some time familiarizing yourself with programming fundamentals.
I would suggest trying to write and run some programs in Lua that are not tied to the playdate. Try just writing simple addition statements and try to print the outcome. It's cliche for a reason to advise newbies to write a "hello world" program. It teaches you a lot about how a particular language works.
Sorry for so much advice along with a sideways answer to your question, but I do hope you stick with it and I hope I relieved some of the stress of starting out.