Needing Help Getting Started

Needing Help Getting Started

Im Using SDK on a Mac and need help getting started. Ive downloaded the the full folder with everything in it (And the tools needed) and that all looks fine. Ive also downloaded Visual Studio Code because I saw that was suggested for future use. Now I'm really confused as to where to go next. I keep seeing people saying you need to open a certain file from the SDK folder in Visual Studio Code but I'm really confused as to what file and where I can find that file. Do I drag the whole SDK folder into Visual Studio Code? Or what can I do to begin? I have NO experience with any coding and really jus want to start trying things out and learning. I would love either a tutorial or some links to tutorials.
Thank you so much!! General tips or resources are also welcome :slight_smile:

1 Like

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.
Copying balls.pdx/main.pdz
  • 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.

2 Likes

For a start in coding in general, I've heard good things about Swift Playgrounds, FWIW.

For Lua/Playdate more specifically, Panic's own Nova code editor has some nice PD integration, and a 30-day free trial. There'a a Nova extension that handles building/running your game for you.

I support Nova and think it's cool, but for a new programmer I think dealing with what to do after a free trial would leave them starting over learning in a new IDE. And I find switching IDEs to be painful. My two cents is go as simple as you possibly can to write and compile code to start.

dealing with Xcode or Nova or other IDEs made for seasoned programmers can be overwhelming. VS Code is not much better, given that it's a hodge-podge of extensions, plugins, innumerable settings, etc. but at least it's free and universal.

I think the true best way to start is in a simple text editor, like notepad or something, without any error detection or syntax highlighting, and compiling using the terminal. The tools in an IDE can even obscure important aspects which a programmer should be aware of, such as using a "Build" button rather than understanding how compiling works.

I dont mean to sound negative. I think it's an important discussion in our programming community. How should someone get started? It's worth debating pros and cons of different approaches. It's a rather complex thing, to code these days