Hi all,
I think I'm almost finish with my first game demo but I have no device to test on and I still have a few outstanding bugs. I came up with the idea for this game while reading through the Playdate SDK documentation, the playdate.graphics.kDrawModeInverted drawmode made me think I can easily create a game where the main mechanic would be inverting the world. Hence the name of my game.
Firstly, if anyone could test this on an actual device and let me know what kind of fps they are getting that would be great. I’m inverting the whole map which I know is not great but my invert with a certain area function had a few small bugs so I reverted.
When I first came up with the idea, I thought I’d develop it for pico-8 first. I was a bit scared of the Playdate SDK so starting in something I’ve dabbled around in before felt the safest. Also, the fact that pico-8 is so limited, I thought if it ran on that system, it would definitely run on a device. I thought porting it over from pico-8 would be quite simple but this was not the case. Here is the pico-8 version if anybody wants to check it out or compare it to the Playdate build:
https://www.lexaloffle.com/bbs/?pid=117660
For porting it across I used the tiled example from the Playdate SDK as my starting point. This helped me get something that looked like the game up and running relatively easily. The issue was that I didn’t really understand the code and this slowed me down quite a bit. My character jump and movement speeds never seemed right; the scroll speed would speed up when the character jumped. It felt like the collision detection with the ground was slowing down the game. Finally, when it came to inverting the world. I felt like redrawing the tiles and re-creating the collision was too intensive (although it didn’t actually run that badly in the simulator) I’ve now just thought storing both versions of the maps and collisions would have been a much better approach. Doh!
Anyhow not liking my tiled version and not really understanding the code. I went with the nuclear option of starting over and trying to port my code line by line. The code has ended up looking very similar to the pico-8 version and I even went as far as converting the pico-8 specific code like mget, mset, fget, btn, etc. I might even start a repo for pico-8 to Playdate if I have the time.
I feel like I’ve waffled on a bit too much there so I’ll go onto remaining issues. I have slightly bouncy collision detection as I was having issues with the back of the character sprite firing a false death collision. This one I can live with.
Then I have an issue where the character block doesn’t fall through gaps that are one block wide.
Finally, my biggest issue at the moment is that the character is hiding under tiles that I consider see through. I’ve tried setting the zIndex of the character. I also tried drawing the see-through tiles as sprites and this worked until you inverted the scene and then went back to hiding the main sprite. I’ve seen the setBackgroundDrawingCallback in the documentation. Does anyone know how to use these with a tilemap? I’m using tilemap:draw to draw the tiles then getTileAtPosition and setTileAtPosition to invert them.
Here is the zipped pdx folder. I’m not totally sure how to do a release. I’m just using the playdate-vscode-template from github.
invert-world-pico.pdx.zip (11.1 MB)
This zip is now the version where I switch between two maps instead of using setTileAtPosition.
I do have a particle system but I’ll add that back in once I see how it performs on device. I’ll also add more to this post as I go along.
update 25/10/2022
I've added a new build to the comments in this page with particles. Also the project will live on itch.io at this link.