Lathe Hero launches on itch!


With Hope Lost nearing the end of development, I figured it was high time for a little distraction.

Lathing, or 'a story about triangles'

In the #game-ideas channel of the playdate discord, someone had written down "Lathe simulator: crank to turn (wind-up or continuous cranking as options), D-pad to position the blade." My mind immediately turned to the way they rendered large '3d' shapes in Yoshi's Island that I'd seen an analysis of some time prior (I tried finding the video again but couldn't, let me know if you can find the one I'm looking for!)

One of Yoshi's Island's triangle textures, and the boss character that uses it

Anyway the way it works is they have a triangle-shaped texture in the game, where every row is one pixel wider than the next. They sample individual rows based on how wide their shape is at any given height, and just draw that. This creates sharp, efficient, and convincing '3d' visuals for any shape that has a continually vertical geometry *, because rather than scaling up sprites, each line is effectively pixel-perfect.

* Maybe weirdly worded, but basically 'outlines only go down along the sides once', or, 'any horizontal cross-section is a continuous line of pixels', if either of those make more sense

As you might imagine, anything that's been lathed also has a continually vertical geometry, so the connection was obvious to me. The one downside was that obviously for the SNES they could use this magical thing called color, which is unavailable to the poor playdate. So rather than my triangle being one pixel for every width, it's 4 pixels - which allows for a 4x4 bayer dither pattern for shading. Using the proper offsets for every line being drawn then gives the shading effect you can see in the gifs.

Initially I'd oriented the block horizontally, as a natural extension of the crank's rotation - however, this turned out to be terrible for performance: drawing vertical lines of an image 100 times is very inefficient compared to drawing those same lines horizontally because framebuffer data is already aligned horizontally, which makes for easier copy-paste of data. So horizontal lathing it is.

Making a game

At this point I had a little demo where you could create shapes, and save and load what you had created. Soon came the suggestions to add objects to reproduce. The first horizontally symmetric shape that came to mind was Rubin's Vase - a shape that, in isolation, either looks like a vase or two faces in profile looking at each-other. Entering width values for each pixel became annoying 10 lines in so I made a little tool that could take image data, and poop out a json file with a nice little array of widths per row that I could then easily import into the game. A couple more shapes later and I had enough for an initial version of the game.

Scoring creations against these shapes however is a whole different problem. Players can technically create the required shape anywhere along the given block of wood, so I had to check every possible position for the assignment to compare with the player's result. The actual line-by-line scoring went through a couple of revisions; starting with pure linear grading (50% accurate means score of 50% - not great to give a 50% score for basically being 100% off lol), but ended up with needing to be at least 75% accurate for a score of 1%, and score then smoothsteps up to 100% for 100% accurate, with height accuracy accounting for 5% of your final score.

Finishing a game

At this point I'd noticed there was a gamejam going for a few more days: The Go Long! Playdate Jam: The 2nd One. Even though the game had started as a little tech demo, with the objectives it had turned more into an actual game, and this jam gave me the incentive to apply some polish and actually publish it. Even though it wasn't made specifically for this jam, I figured it still counts as long as it was made within the requirements of the jam. Quick rundown of this layer of polish:

Screens: I already had a fitting title screen, but the assignments screen was a fairly static list of names and a render of the required result. I changed this to a cozy little cabinet view with a to-do list of all the assignments, and a prize sticker for your high-score for the selected assignment. I also kept track of your best performances for each assignment, allowing you to show off your skills here. The general game UI was a vertical list of controls, which I changed to a more playful display. Lastly, in the score overview, rather than showing the per-line score at the top, it's now placed by the comparison line, along with a little dpad indicator telling players they can move this line up and down. The analysis screen can use a bit more love, but nothing useful came to mind so far.

Old vs new interface

Audiovisual: I'd already added some basic sounds for button presses etc. I went with a wood knock-y sound for changing selections, and a 'open door' for changing screens, tying it all together a little. The lathe got a dynamic whirring sound, which goes louder and higher the faster you spin your lathe (this does nothing for gameplay, lathe just needs to be spinning - but it's a fun little effect). Cutting the wood also got a visual boost by dropping shaved wood particles of various shapes.

Look at em go!

Finally, I quickly set up an itch page with the necessary assets, and managed to finish it all one hour before the deadline. Safe!

Future...ing? a game

One major feature I wanted to add was time attack - asking the question, how well can you lathe under a strict time limit? While I couldn't finish that within the limits of the gamejam, I still intend on finishing it as it adds a fun layer of tension. I'd also like to add some more assignments (do pass on any ideas you might have!) to give the game a bit more body.  And if you've got any thoughts on what this game still needs, I'm all ears! But for now, I'm happy with the result for this playjam, and I can get back to finishing the last stretches of Hope Lost development...

Files

LatheHero.pdx.zip 441 kB
8 days ago

Get Lathe Hero

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.