Documenting this process in as much detail as I did has been revealing. There were holes in my knowledge: things that I knew how to do without a full understanding of how they actually worked. Trying to explain every line of code forced me to reach for that deeper understanding.
Despite this, some of my decisions were still questionable and I would do certain things differently now. On the other hand, I was pleased at how other aspects came out and there are ways that I have implemented things in this that I definitely want to pull into my adventure game engine.
To create the puzzle images, I want to be able to take a Photoshop document, slice it up using the selection tools, then export those sliced-up layers. I also want to use a script to automatically generate the final, correct locations for all of the pieces and write them to a JSON file that will work on all devices.
I was recently playing The Black Mirror and one of the earlier challenges is a jigsaw puzzle where you have to reconstruct a torn up photograph.
The player clicks on a piece to activate it, then they can move it around using the mouse or right-click on it to rotate it to one of four preset rotations. They click again to release it. When a piece has the correct rotation and is near the correct position, it snaps into place, which works as visual feedback that it has been placed correctly.
It was an enjoyable break from the exploring and it got me thinking about how I might add it as an optional mini-game type in my adventure game engine.