Any tips for someone who doesn't typically code (designer)?

Hi everyone! I'm very new here, but have had my Playdate for several months. One of the main reasons I got one was to practice developing my own tiny games. But even after tinkering with Pulp + the sample game, I still feel intimidated by where to start.

By trade I've been doing UI/UX design for over a decade, and am very fluent in css/html etc. (entirely front-end skills). I'm hoping that experience will translate well to Pulp/Lua, but I'm struggling with where + how much to level up technically-speaking.

None of the game ideas I have are complex. I mainly want to make some prototypes that leverage the crank, so I can get a handle on programming + art/design pipelines. But it'd be nice to make some little interactive toys/experiences along the way.

Thanks for any help or pointers! Excited to be here :smile:

Hmmm well, where to start....

you've really just got to get in there and get your hands dirty so you can grasp what Pulp is doing. Pulp shows tiles on the screen and has some default behaviors for how the user's inputs affect them. It's designed for moving a character around the screen in what they call a "room" and them moving between them. If you don't want the dpad to move a little character around, you'll need to do some work (hide the character, build solid walls for them not to move etc) as it is the main system pulp is built around. The A button, B button, crank and accelerometer all do nothing by default, but the scripting portion of pulp lets you handle that.

Since you mentioned using the crank, I will explain it here.
In the Script tool in Pulp, you pick from "Sources" in the top right. Make sure you have the one called "player" selected. Take a look at the area of code it puts in the center of the screen. If it doesn't already have a method called "crank" add one. It should look like

on crank do
  // maybe some stuff here?
end

Lines that start with two slashes are "comments" meaning they are not a part of the code, but are for whomever is reading the code. (This is just the same as javascript which I assume you have some passing familiarity with due to your css/html experience.)

Any code you put between the on crank do and the end will be run each time the game notices the crank being used.
As a demo, put in something like this:

on crank do
  frame_tracker += 1
  if frame_tracker > 5 then
    frame_tracker = 1
  end
  tell 5,5 to
    frame frame_tracker
  end
end

Then head to the room tool. Click on the "World" layer. Click on the "new tile" button; it is towards the top right, looks like a plus and says "New tile" in the tooltip if you hover over it. Use the tool below that to draw a tile. Make sure the tile has at least five frames and the animation time is set to zero. Try to make each frame different enough to tell which one it is on at a glance. The tool in the middle of the screen is for putting tiles into room so they can actually be seen. Make sure you have the starting room selected and put your new tile in that room in the (5, 5) coordinates (to match what we did in the code.)

Now when you play the game, any use of the crank will progress that frame's animation by one frame. You'll notice that it doesn't matter which way you move it or anything like that because this code is super simple. If you're wondering what frame_tracker is, that is just a variable that I made up. As the coder, you do this often where you make up names of variables to store numbers (and sometimes a string of words) in, and as long as you don't use words that mean anything else in the language, you can name them whatever you want and each time the code using that name, the game will know it's the same one.

You should definitely read this document: Playdate Pulp. Read a few sentences and then go look at what it was talking about in the Pulp editor so you can better grasp what it is talking about. Once that all seems to make sense, you are going to want to make your own code and not just use this very simple example I gave. Read this document: Playdate PulpScript. Come up with quick ways to use each thing it talks about in there at least once so you know what tools you have.

I hope this helps some.

1 Like

Thank you, I think this will help me a lot, even with just seeing things react to small changes and build on that. I really appreciate you focusing on how to call the crank and this simple example. Gonna try loading it up and keep iterating until I understand it all better! :pray:

So, when I modded the base game sample with this, and sideloaded it onto my Playdate to test on the hardware, I got this error message when moving the crank:

?:-1: attempt to perform arithmetic on a nil value stack traceback:
  ?: in upvalue '?'
  ?: in function <?:3781>

This worked perfectly fine in the Pulp simulator, but on the hardware are there other basic things I should keep in mind that could easily lead to a crash like this? Not intending to get into the weeds w/ every error persay, but just curious how a function like this leads to a system crash. All part of the learning experience! :sweat_smile:

oof yeah, the simulator does have a few strange differences.
That error is saying that it needs to initialize a variable before you change it. Normally, Pulp initializes variables as a zero as you first use it, but I suppose not when you're using the += apparently?

try adding this to the load function in your game script: frame_tracker = 0
if you don't have a function name load in the game script, you can just add

on load do
  frame_tracker = 0
end

to the game script.