This is a (pretty broken, but mostly functional) organic-shaped jigsaw generator with custom border support

Overview

OrganicPuzzleJs

This is a (pretty broken, but mostly functional) organic-shaped jigsaw generator with custom border support. It relies on two linbraries from third parties, imagetracerjs and flatten (see respective files). Use online at https://proceduraljigsaw.github.io/OrganicPuzzleJs/

What is this

This tries to generate organic-shaped random jigsaws. I tried to emulate some puzzles I saw online, which I thought were generated using a cellular automata, and I arrived at this algorithm, which I have no idea why it works but produces cool looking piece shapes which I haven't seen before in other jigsaws.

The generation starts with a canvas, where seed cells are planted in a noisy rectangular grid. These cells start growing (conquering neighbor unoccupied sites) until the whole canvas is filled. Each expansion cycle each cell conquers all its available empty sites. The result of this behavior, if done properly, would be "cell" patches disposed in a Voronoi pattern. I accidentally (lol) found that if I break the algorithm so that instead of a true Voronoi pattern some buggy version of it appears, then the resulting puzzles are more varied and I like them better, so buggy Voronoi it is.

After the seed cells have established their initial colonies, they start eating and conquering eachother. There's an algorithm that makes the colonies grow with "dentrite" patterns. This algorithm relies on counting the numnber of same colored neighbors of a cell you want to eat, and the number of same colored neighbors of each neighbor of this neighnbor, with repetition. If the ratio between this two numbers exceeds 6.2, the cell is OK to eat. Why 6.2? No idea. I could give you an explanation of my though process and how I arrived at this, but it would be mostly nonsense and stuff pulled out of the lazy part of my brain. Does it work with this parameter set to other values? Try for yourself and see. Nothing should break...

This algorithm leads to quite a bit of spurious growth which I try to clean up, but sometimes it fails... please cut the puzzles first in some cheap material before committing to a design...

A vectorizing algorithm fits splines along the piece borders to generate a cuttable SVG.

You can grow the jigsaw manually until you're satisfied and download the result for lasercutting or whatever.

Use with caution!

PS. Nothing is uploaded anywhere, your SVG border stays in your computer!

How to use

  1. Adjust the desired generation parameters:

    • Columns and rows: in rectangular (default) jigsaw mode, these define the number of rows and columns for the piece grid
    • Grid size: regular square grid size for seeding. Seeds are planted in regular intervals every grid size cells, with some added randomness.
    • Initial grid possition noise: how much noise will be added to each seed position. Setting this parameter to 0 will place the seeds in a regular square grid.
    • Growth radius: cells will only expand up to this radius away from the seed cell. It should be set to at least 2x grid size.
    • Curve fitting threshold: higher value = the vectorizer uses more straight line segments. Lower value: less straight line segments, more jittery curves.
    • Magic number: just leave this at 6.2 ok?
    • Growth probability: each cell will grow with this probability each cycle.
    • Cell size: how a cell translates to the physical world. Each cell represents an area of size x size mm. Set to at least 2mm, better if 3 or more, so that choke points don't create too weak pieces.
    • Preview viewing scale: size of each cell in pixels for the colored preview thing.
    • Custom border scale factor: when using a custom border, this scale will be applied to the border SVG. The puzzle size will be border size x scale.
  2. Want to use a custom SVG border? Use the file picker and then press Load SVG customborder.

  3. Press Generate Jigsaw and wait

  4. Press Grow as many times as you want until you're satisfied

  5. Download SVG, check and cut.

Limitations

This is seriously broken. I don't know why it works, and the code quality is abysmal (except for the 2 third party libraries I use which are awesome). I only release it because I don't have time to improve it much more and it more often than not produces quite nice output.

Some parameters can be adjusted between growth cycles and won't break the generator, others will break. If you load a custom border and press generate button and don't like how the jigsaw is going, you have to reload the border again before pressing generate again, or else it will break.

It's slow and not optimized, so be patient with it and expect several seconds of processing time per growth step.

You might also like...

A (mostly) blank Ultra project

A (mostly) blank Ultra project

Aug 12, 2022

A pleasing darker theme made mostly with complementary purple and blue colors, occasionally with a touch of pink or red.

A pleasing darker theme made mostly with complementary purple and blue colors, occasionally with a touch of pink or red.

Nebula Float away in space with a beautiful blurple oriented color theme. DISCLAIMER: ⚠️ This theme is not as high contrast as other themes. A pleasin

Nov 23, 2022

A (Mostly) Complete Hackmud Guide

Hackmud Table of Contents About this Repository A Word of Caution Avoiding Spoilers Fixing Errors Contributing to the Repository Repository Requiremen

Sep 8, 2022

Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Nov 2, 2022

Functional-style Cloudflare Durable Objects with direct API calls from Cloudflare Workers and TypeScript support.

durable-apis Simplifies usage of Cloudflare Durable Objects, allowing a functional programming style or class style, lightweight object definitions, a

Jan 2, 2023

Obsidian text generator Plugin Text generator using GPT-3 (OpenAI)

Obsidian text generator Plugin Text generator using GPT-3 (OpenAI)

is a handy plugin for Obsidian that helps you generate text content using the powerful language model GP

Dec 29, 2022

Types generator will help user to create TS types from JSON. Just paste your single object JSON the Types generator will auto-generate the interfaces for you. You can give a name for the root object

Types generator will help user to create TS types from JSON. Just paste your single object JSON the Types generator will auto-generate the interfaces for you. You can give a name for the root object

Types generator Types generator is a utility tool that will help User to create TS Interfaces from JSON. All you have to do is paste your single objec

Dec 6, 2022
Owner
null
This extensions will prompt you to remove any other extensions that we found as being broken and unmaintained.

octarine vscode extension This extensions will prompt you to remove any other extensions that we found as being broken and unmaintained. We do expect

42picky 4 May 27, 2022
App for displaying geospatial data on queues on the Polish-Ukrainian border.

Live app embedded here. App helps coordinate volunteer work with refugees from Ukraine on Polish-Belarusian Border. Data comes from Grupa Granica – a

null 3 Mar 10, 2022
Map of reception points for refugees near Polish-Ukrainian border

ua-2022-map Map of reception points for refugees near Polish-Ukrainian border work in progress... Development We provide a docker-based dev environmen

OpenStreetMap Polska 39 Dec 7, 2022
❤️ A heart-shaped toggle switch component for React.

heart-switch A heart-shaped toggle switch component for React. Inspired by Tore Bernhoft's I heart toggle Dribbble shot. ?? Table of Contents ?? Getti

Anatoliy Gatt 413 Dec 15, 2022
Very tiny function that checks if an object/array/value is shaped like another, with TypeScript type refining.

@suchipi/has-shape Very tiny (~200B before minification/compression) function that checks if an object/array/value is shaped like another, with TypeSc

Lily Skye 7 Aug 13, 2022
Kuldeep 2 Jun 21, 2022
A collection of (mostly) technical things every software developer should know about

Join our community for professional Software Developers and get more control over your life and career! Every Programmer Should Know ?? A collection o

MTDV 66.6k Jan 4, 2023
Mostly adequate guide to FP (in javascript)

About this book This is a book on the functional paradigm in general. We'll use the world's most popular functional programming language: JavaScript.

null 22.3k Jan 3, 2023
A simple To-do list page, build with Webpack, HTML, CSS, and mostly JavaScript

This is a simple To-do list page, build with Webpack, HTML, CSS, and mostly JavaScript. You can add, remove, edit and complete tasks, then clear all completed.

Joaquín G. L. Z. 4 Mar 4, 2022
List of awesome people offering their time for free to have a "coffee chat" with others about different topics, mostly in a mentorship kind of way.

Coffee Chat List of awesome people offering their time for free to have a "coffee chat" with others about different topics, mostly in a mentorship kin

Frédéric Harper 91 Dec 12, 2022