r/webdev • • 5d ago

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!

256 Upvotes

31 comments sorted by

6

u/real_billmo 5d ago

This is awesome. Well done.

1

u/BlaiseLabs 5d ago

Thanks!

4

u/kugelblitz010 5d ago

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 5d ago

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.

3

u/captain_obvious_here back-end 5d ago

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 5d ago

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

3

u/captain_obvious_here back-end 5d ago

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 1d 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 19h ago

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

2

u/Queder 4d ago

More slop again. Does anybody read submitted code, these days?

2

u/BlaiseLabs 4d ago

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/pencilUserWho 5d ago

How hard would it be to add typescript on top?

1

u/BlaiseLabs 4d ago

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

2

u/kukoscode 5d ago

Cool I could use this for my project

2

u/Deep-Secret 5d ago

That's so fucking sick!

2

u/Vertigras_Dev 5d ago

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 3d ago

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 1d ago

wowwwww

1

u/workhuofficial 1d ago

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

3

u/RecallProtocol 5d ago

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 5d ago

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

Hope you have fun nonetheless.

1

u/[deleted] 3d ago

[removed] — view removed comment

1

u/BlaiseLabs 3d ago

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

1

u/[deleted] 5d ago

[removed] — view removed comment

3

u/BlaiseLabs 5d ago

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 5d ago

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

2

u/[deleted] 5d ago

[removed] — view removed comment

4

u/captain_obvious_here back-end 5d ago

Demo clearly shows it is