Download

Jigsaw puzzle help

I would very much like to make a game that is a jigsaw puzzle in which I can use a blueprint to automatically chop up an image into various piece counts and then randomly position and orient the pieces across a table/surface. As for solving the puzzle I would like to be able to make sure that each piece can snap/merge to it’s corresponding edge on other pieces and become a moveable unit. I don’t want to rely on snapping to grid positions as I enjoy the puzzles in which the pieces are free floating until the puzzle is solved. I have seen many great implementations of jigsaw puzzle games out there with all of the options I want (and more) so I know it’s possible… I just don’t know where to start this in UE4. I had some ideas on how some of these scenarios could work logic-wise but not sure how to implement them or automate them and don’t want to re-invent the wheel. I searched for a while looking for tutorials on creating a puzzle game and then more specifically for specific elements/scripts I though might be useful for implementing my logic ideas but I couldn’t really make progress.

Here are some ideas I had:

-Using SubUV to chop up an image for the material. (But then how to apply each chunk to the appropriate puzzle pieces?)
-Using material masks/alpha to chop out the puzzle shapes from the square UV chunks (But then how to make sure that the edges/shapes correspond to their alternate edge on the adjacent piece)
-Using joints or sockets to create snapping points for the edges to snap/constrain to when placing them. (But how to automate creating said sockets on each edge and uniquely identifying which edges should snap to which others?)

I had some other thoughts but I’ll post this for now and see if anyone feels helpful. Any advice or thoughts on blueprint scripting would be greatly appreciated.

Have a look here, might be a start:

Oh nice. :slight_smile: Thanks I’ll give that a look.

Ok that looks like it should work to cut the image into pieces. :slight_smile: That’s one step down I guess once I test it. Now I have to sort out those other problems. Getting jigsaw shapes, IDing which edges snap to which other edges and so forth.