r/webdev • • Oct 31 '26

Showoff Saturday Procedural Almanac - A JavaScript library of procedural generation techniques with citations for every function

Post image

For week 2 of r/hacktoberfest I cataloged all the procedural generation techniques I could find online and put them into a library using vanilla JavaScript. Every technique in the library includes a citation and it has no dependencies. Works in the browser or Node.

The island in the GIF was generated using just the library.

GH repo: procedural-almanac

Demo: Random Island Generator

All stars on Github are appreciated!

267 Upvotes

32 comments sorted by

6

u/real_billmo Oct 31 '26

This is awesome. Well done.

4

u/kugelblitz010 Oct 31 '26

This is amazing and could see this having really cool applications! Is it limited to a generated world map or could this be applied to an indie platformer? Also are you doing anything to make sure that pixels stay a consistent size?

Again this is really really cool and thanks for sharing

2

u/BlaiseLabs Oct 31 '26

I built a game generator on top of this a couple weeks ago and it was able to produce many different genres and perspectives.

What I found to be the true limitation was my own game design skills.

1

u/21_Cladogram 27d ago

Why do people always worry about pixel sizes in 2023?

3

u/captain_obvious_here back-end Oct 31 '26

I wish I could have a few months off, just to play with that kind of stuff and make fun stuff based on it!

1

u/BlaiseLabs Oct 31 '26

What would you spend those few months doing, if you don't mind my asking.

3

u/captain_obvious_here back-end Oct 31 '26

I would finish a game I started coding years ago, that I spend a few hours on here and there but can't manage to finish and polish.

It's basically a survival idle RPG. And most of the action happens on various islands. Right now the islands are static stuff I designed or generated in a very basic way, but playing with your demo sparked a whoooooole lot of nice ideas that would make the game a billion times more interesting and replayable.

Be sure I'll keep you updated and properly credited if I end up using your lib someday :)

1

u/BlaiseLabs 28d ago

The game sounds fun, best of luck to you and no pressure to credit beyond what the license requires.

1

u/captain_obvious_here back-end 28d ago

I just need a few months with nothing else to do :/

1

u/pencilUserWho Oct 31 '26

How hard would it be to add typescript on top?

1

u/BlaiseLabs Nov 01 '26

All the functions are pure so it supports typescript or another flavor of JS natively including frameworks like react vue etc...

2

u/kukoscode Oct 31 '26

Cool I could use this for my project

2

u/Deep-Secret Oct 31 '26

That's so fucking sick!

2

u/Vertigras_Dev Oct 31 '26

Wow - really impressive. Love the night/day inclusion and the colour selection for it... Especially hwo the contours add depth to the water as well.

We have dabbled in procedural generation of sprites and such too ... trying to close the loop on base asset forging via prodedural gen.

2

u/Outside-Wall-2807 Nov 02 '26

the names scrolling along the bottom of that gif (leafCrown, barkTrunk, bitSway, swayingChain) read like a Pokemon moveset. i want to know what a swayingChain does to a water type.

2

u/Naufal_Dev 29d ago

wowwwww

1

u/workhuofficial 28d ago

Love that you cited the sources. Is there one function you’d recommend starting with?

3

u/RecallProtocol Oct 31 '26

Genuinely interesting documentation. I don't do this stuff but I may go play with all of these neat toys, thank you for sharing!

2

u/BlaiseLabs Oct 31 '26

Thank you, the catalog is very dense at the moment so it is alot to sift through manually.

Hope you have fun nonetheless.

2

u/[deleted] Nov 01 '26

[removed] — view removed comment

2

u/BlaiseLabs Nov 01 '26

The repo is a catalog of citations, so the core value isn't the code. Even then, the largest code file is less than 500 lines of code it's very easy to reason about.

1

u/[deleted] Nov 02 '26

[removed] — view removed comment

1

u/BlaiseLabs Nov 02 '26

Thanks, what type of projects would you like to see more of?

1

u/[deleted] Oct 31 '26

[removed] — view removed comment

3

u/BlaiseLabs Oct 31 '26

Thank you, all the citations and functions are in the catalog.md file if you want to check them out.

You can also generate your own randomized version of the island using the demo.

1

u/bitanath Oct 31 '26

How does this post have just 2 upvotes? Or is it just my client?

2

u/[deleted] Oct 31 '26

[removed] — view removed comment

4

u/captain_obvious_here back-end Oct 31 '26

Demo clearly shows it is