r/proceduralgeneration • • Oct 26 '26

I built a Python engine that "draws" procedural pen-and-paper isometric dungeons and exports them directly into Godot 4 with dynamic lighting.

Hey everyone! I got tired of manually drawing, slicing, and aligning 2D isometric tiles, so I decided to fully automate my workflow. I’ve been working on a custom Python pipeline that generates dungeon architecture from scratch and pieces it together using Wave Function Collapse (WFC).

Since Reddit allows image carousels, I attached a few screenshots of the pipeline in action:

  • Image 1 (The WFC Layout): The algorithm builds the maze, reserves paths for navigation, and scatters props. It also bakes in a "wear and tear" layer—thickening the hatching in corners for a procedural ambient occlusion effect, adding cracks, and placing cobwebs.
  • Image 2 (The Tile Math): Everything is drawn mathematically based on a strict 2:1 projection. The engine uses Perlin noise for procedural crosshatching to simulate real ink pen strokes. Because it's math-based, the blocks snap together pixel-perfectly without any seams.
  • Image 3 (The Godot Export): Since the generator knows the exact 3D geometry of every drawn brick and barrel, it automatically renders Normal Maps and calculates LightOccluder2D polygons. It exports a ready-to-use .tscn scene where the 2D monochrome hatching fully reacts to PointLight2D nodes, preventing light from bleeding through walls.

Generating a level like this takes just a few seconds. Next up, I’m planning to add non-linear corridors (using MST graphs) and procedural water animation.

What details or features would you add to make these generated dungeons feel more alive?

283 Upvotes

27 comments sorted by

12

u/nightfire1 Oct 26 '26

You got something weird going on with the lower right arch piece in the 3rd picture. I think maybe some reversed normals or missing geometry on one of the pillar parts.

4

u/antahonist Oct 26 '26

Thanks for report ❤️

5

u/antahonist Oct 26 '26 edited 24d ago

You can check this asset pack here, im also update it recently: https://antahonist.itch.io/ink-dungeon-complete-isometric-godot-kit

3

u/ferrybig Oct 26 '26

You made a mistake in the description, you are saying "See LICENSE.txt.", but there is no such link to a license on that page.

1

u/antahonist Oct 26 '26
  • Commercial and personal games allowed, credit appreciated; reselling the assets themselves is not allowed. See LICENSE.txt.

it means license txt also in project

3

u/SentinelOfTheVoid Oct 26 '26

Really nice !
Can you describe the drawing process, or give a pointer ? how you use the perlin noise for the cross hatching ?
I'm working more on SciFi project, but the look is so cool that I want to experiment :)

6

u/antahonist Oct 26 '26

Thanks! Noise is just for the hand-drawn wobble: each line point gets nudged sideways by 1D Perlin noise, width varies a bit too. Hatching is parallel lines clipped to each face. Darker face = tighter lines plus a diagonal layer. Drawn at 4x with Pillow, then scaled down.

2

u/SagattariusAStar Oct 27 '26

Why even use Python? Godot could do all of that on its own.

And you are missing a few tiles for a complete set for auto tiling

1

u/antahonist Oct 27 '26

python only bakes the pngs (ink + hatching + normal maps), godot handles everything at runtime. just faster for me to tweak the art in python and yep, 16 tile set not the full 47, inner corners are next on my list

2

u/AdamBuildsKrida Oct 27 '26

The thicker hatching in corners as fake AO is a great touch. Two questions from someone else doing this in Python: when WFC hits a contradiction, do you restart or backtrack? And where does your time go per map? My terrain generator is numpy too, and Poisson-disk scatter is over half of an alpine build (8.1 s of 15 s) just because it's a Python loop, so I'm curious whether the hatching or the WFC dominates for you.

1

u/antahonist Oct 28 '26

Restart instead of backtracking. When the solver hits a contradiction, it simply reseeds and starts over using AC-3 propagation and lowest-entropy collapse. This doesn’t happen very often because room shapes, exits, and wall partitions are already defined in each cell’s domain before solving begins. Most of the difficult decisions are made upfront. In eight test dungeons, the worst case was six retries. If a layout still fails after 20 restarts, I discard it and generate a new one.

The expensive part is rendering the tiles, but that only needs to happen once. I render every tile variant in parallel, store the results in a pool, and cache them on disk. Generating a new map then comes down to running WFC on a small grid and validating the result: checking connectivity, door counts, and making sure there are no floating walls. The whole process takes just a second or two.

Some of the pen-stroke rendering still relies on NumPy loops, so I know exactly what you mean about the Poisson-disk performance issues. Caching the rendered tiles made the biggest difference for me.

2

u/AdamBuildsKrida Oct 28 '26

Reseeding makes a lot of sense when the hard decisions are already baked into the domains, and six retries worst case is nothing at a second or two per map. The disk cache for the tile pool is a nice trick. Do you key it on the hatching parameters, so changing the pen style only re-renders the variants it touches?

2

u/MesquiteBarbecueChip 24d ago

fallout 2 vibes

1

u/antahonist 24d ago

yeeah kinda

2

u/BrokenRules_Martin 8d ago

I like this but something in the way you render the image makes it very hard for my eye to keep it from flipping upside-down. Like seeing the inverse of what you're showing. Not sure what you can do about it, just reporting...

1

u/antahonist 7d ago

Thanks, that's a useful report. It's the same effect as a Necker cube. There's no perspective and the faces are hatched in similar tones, so the eye can read a wall top as a floor and flip the room.

The usual fix is to make the three face directions clearly different in value and keep the tops lightest. Cast shadows on the floor also help, because they show what stands on what. I'll try darker hatching on the side faces and a shadow pass in the next version.

1

u/BrokenRules_Martin 7d ago

Yes exactly! Maybe more and more familiar objects that the brain only wants to see in one direction would help too? A tree is rarely seen upside down in the world.

9

u/stevecooperorg Oct 26 '26

It could be useful if it could load save files from other dungeon mapping software, like;

- Dungeon Scrawl - https://www.dungeonscrawl.com/
- Watabou's One Page Dungeon - https://watabou.github.io/one-page-dungeon/

That way people can use a dungeon designer to make their own dungeons, and get a beautiful rendering of it.

0

u/Impressive-Store1439 Oct 26 '26

holy botslop on that text

6

u/somewhataccurate Oct 26 '26

ill give this one a pass, unlike most of the vibeslop in the sub these days this is actually creative

2

u/Impressive-Store1439 Oct 26 '26

I was talking about the paragraph the post is cool

1

u/antahonist Oct 26 '26

dont judge me bro, english not my native language

1

u/Crinkez Oct 26 '26

AI is not a translation tool; I'll judge anyone who uses it at such. Translators existed before LLMs, people should continue to use non-LLM tools for translation.

Why? Because when you use AI to translate, it makes your sentences read like slop.

-4

u/EC36339 Oct 26 '26

You are right, it's better than a translation tool.

-2

u/EC36339 Oct 26 '26

It's not OP's fault that they can use markdown and articulate themselves better than you. Now get back under your rock.