I'm currently discovering the PlayDate, its capabilities, its SDK and a long lost love for 1-bit B&W graphics that have been there since I started programming on certain handheld monochrome devices. It sure is interesting to get a higher density and resolution screen this time.
Among the small projects that I keep around to give a test on a platform and/or to see how it'd look on it, there is a small "sketch" I did years ago in Pico-8: Sphere.
That's basically not much more than an animation playing in realtime, but it was a fun experiment in going back to C and squeeze the most out of the small little device and its tiny CPU. Under the engine, it's containing a good chunk of a viable 3D renderer written from scratch for absolutely no reason other than wanting to reinvent to wheel.
I think the hardest part was getting the projection matrix correct and remembering that an OpenGL-ish rendering system expects the Z coordinate (the one facing the camera) to be negative for a vertex to fall into the frustum. A mistake I also did in the original sketch!
If you're interested, the sketch is open source, so you can pry it up, tweak it and run your own version of it. I left some comments to give insights on the code and how it could be improved. For reference, I built it against the SDK v1.9.1.
I don't know if I'll continue working on this small project, it was mostly a warm up, I'll see in the near future if I can port or redo some older projects. I'm sorry, it's not really a game or anything interactive, I didn't find a more suitable forum category, there won't be many projects like those, or at least I'll gather them to avoid polluting the forum.
I'm attaching two zip files, one containing the binary/folder to run on the physical device, one for the simulator. Have a nice day!
NOTE: this sketch contains quite a lot of moiré artifacts, so the GIF itself is under a spoiler tag.
Inspired by one visual effect coming from Super Castlevania IV, I wanted to see if I could reproduce a similar effect on the PlayDate and keep it running smootly.
Looks like it works! By using a few tricks here and there, I could progressively optimize it under the frame time.
The principle of the effect is simple : imagine scaling a single bitmap horizontally line-per-line, following a sine curve with the apex at the center of the screen. Applied on a regular gris, it would look like this
The rest of the trick was to read a source bitmap, extract the proper bits and blit them to the frame buffer while keeping it fast enough. To optimize the process, instead of keeping floating points all the way down, I resorted to a subset of fixed-point operations so I could squeeze even more cycles out of the machine by avoiding expensive trips between FP and integer registers. Some of the operations like
fmod are relatively heavy, hence me using
truncf often because it maps directly to a CPU instruction, hehe.
As with the previous sketch, the project is open source and you're free to look around and
get inspired steal bits out of it! I'll link here to two pdx files, one for the simulator and one for the device. It should run smoothly enough (but I'm not sure about the last-moment tweaks I did, oopsie)
barrel_DEVICE.pdx.zip (12.4 KB)
barrel_SIMULATOR.pdx.zip (12.8 KB)