Automating Inputs Question

,

Automated Testing

I have been programming a playdate game for a long time.

We are quickly approaching a point where testing the game manually will become very time consuming. It already is to some degree. I am looking for a way to automate inputs.

I've searched far and wide and have only found (what I consider to be) janky solutions like a generic third-party input recorder that just plays back inputs on my machine. This approach is like manually holding a motor on a boat. I want it attached and built-in.

The other solution I've found is writing a wrapper around the PD input system but that seems cumbersome and like it could easily lead to issues.

I have had success with recording inputs via in-game code, but when I go to try to play them back I find myself in a snakes den.

Please, please, please

Does anyone (@dave :eyes:) know how I might approach automated button playback? This video is a good example of the kind of testing I want to accomplish.

I think the best way to automate inputs is to use the serial api like btn and other commands. You would need to create your own wrapper around it though because I don't think there is any TAS like app yet. I think an easier way to debug your game though would be to just temporarily build it so you spawn with items or whatever already or you could make custom commands using msg to spawn in items (like minecraft commands ig.)

1 Like

Thank you for the reply. I will look into the first suggestion. Seems a wrapper is the way - I just don't look forward to coding it all in and then coding it all back out for release build. Doable though.

I have something akin to the latter suggestion in that I can generally travel wherever I want to go and edit areas to create situations which I'm testing. Maybe I should just continue to improve these features instead.

I believe this may be a 'draw the rest of the f***ing owl' situation where I need to just buckle down and manually test to finish the game sooner than debugging a whole auto-testing build.

Thank you again.

coding it all in and then coding it all back out for release build. Doable though.

it wouldn't run on your Playdate. It would send the inputs directly to the console over USB serial. See: playdate-reverse-engineering/usb/usb.md at main · cranksters/playdate-reverse-engineering · GitHub

You can use the btn command to simulate button presses (this is what Playdate Mirror uses internally)

1 Like

Oh, thank you for the link and more explanation. I now actually understand what you're suggesting. At a glance, I do think this may be the solution I run with.

It's less about items and rooms and more about solutions to puzzles, which can be tedious to carry out manually.

Thank you so much, I did not know anything about the serial USB code.

on macOS, you can use the Event Recorder (Window > Event Recorder) to record and play back user input.

2 Likes