Add a board to a Widget Blueprint
- Open your Widget Blueprint's Designer. Find Jigsaw Puzzle → Jigsaw Puzzle Board in the palette and add it to a panel with enough space for the board and tray.
- Assign Puzzle Definition in Details. Add your HUD to the viewport using your game's usual flow. The board starts that definition at runtime.
- For a puzzle picker, call Start Puzzle on the board widget with the chosen definition and optional seed override. A seed override of -1 uses the definition's seed.
- Get the board's Session. Bind its On Changed, On Piece Placed and On Completed events to update your own HUD, effects or progression.
Working Blueprint recipe
- Name the board widget PuzzleBoard and keep Is Variable enabled. In the widget's Event Graph, connect Event Construct → Start Puzzle. Use PuzzleBoard as Target, assign your definition, and leave Shuffle Seed at -1 to use the definition's seed. Start Puzzle creates a new session; call it when starting or replacing a puzzle.
- From your game's startup flow, connect Begin Play → Create Widget → Add to Viewport. Select your Widget Blueprint as the class, provide the local Player Controller as Owning Player, and retain the returned widget in a variable such as PuzzleUI.
- For mouse interaction, set the controller's input mode to Game and UI and enable Show Mouse Cursor. A separate actor used to receive keyboard events also needs Auto Receive Input = Player 0; place one instance in the level.
- Create public functions in your Widget Blueprint for assistance: PuzzleBoard → Session → Use Hint and PuzzleBoard → Session → Undo. Call these functions from your own buttons or game inputs. Read Session only after the board has started successfully.
- For persistence, call Session → Save Progress and Session → Load Progress with the same Slot Name and User Index. Test by saving, making another move, then loading. The definition and layout must remain compatible. Loading clears undo history; undo does not refund hints.
Reference wiring
Your HUD → Jigsaw Puzzle Board → Start Puzzle(Definition, Seed) → Session. Session.On Changed → Get Correct Piece Count / Moves / Elapsed Seconds → your labels. Session.On Completed → your win flow.
| Parameter | Default or example | Effect and use |
|---|---|---|
| Start Puzzle | Definition, Shuffle Seed → bool | Creates a new session. Returns false for a missing definition or invalid grid. |
| Set Session | Session reference | Attach an existing shared session instead of starting over. Choose one owner to advance its timer. |
| Use Hint / Undo | Session calls → bool | Report the return value in your UI. Undo restores the previous piece layout and move count; it does not refund a used hint. |
| Save Progress / Load Progress | Slot Name, User Index → bool | Use a stable slot for each artwork/layout. Check failure instead of assuming a save exists. |
| On Piece Placed | Piece Id, Correct | Interlocking Correct means snapped. Swap/sliding reports whether the activated piece is now correct. |
| Advance Session Time | Board widget option; enabled by default | Only one visual owner should advance a shared session. The example disables the 2D timer when the 3D actor owns it. |
2D controls
Drag a piece with the left mouse button or touch. R / right click rotates when enabled. Mouse wheel zooms; middle-button drag pans. H uses a hint, Ctrl+Z undoes and Space pauses while the board has keyboard focus. Escape cancels a current drag. Touch dragging is implemented; mobile device builds and gesture testing are not part of the current validation.
The supplied JigsawGalleryWidget is an optional complete interface. The lower-level widget and session can be used without it. This release does not include a custom visual graph editor or a Blueprint code-generation system.