AlexeyBond / godot-constraint-solving

WFC (Wave Function Collapse) and generic constraint satisfaction problem solver implementation for Godot 4
https://godotengine.org/asset-library/asset/1951
MIT License
357 stars 14 forks source link

[Example] Generating a platformer level #25

Closed danbraik closed 2 months ago

danbraik commented 2 months ago

Hello, thank you for this wonderful addon. After reading some of the discussion, I understood better how to use Precondition. It gave me the idea to use WFC as a better autotile feature than builtin one. Moroever, the idea is to draw the shape of a platformer level and let WFC fill it. I had to use a special tile for the AIR since it is a 2D side view. You can find the prototype project so everyone can learn from it. test-wfc.zip

So, the settings is:

Demo:

Level map: image

Result in game: image

Now I am just wondering if it will take more times to set the rules than actually and manually draw levels myself ;-) Have a nice day!

AlexeyBond commented 2 months ago

Hi.

I'm glad someone besides myself could get how to use this feature 😆

I did think about making a more generic precondition that would map a tile from target map to certain domain. Mostly for cases when initial level layout is generated by another procedural generator (such as Gaea, or alike) that isn't wrapped in a precondition and WFC just polishes the details. I guess it would work for your case as well.

I did also consider creating a WFC-based autotiling-like functionality that would work directly in the editor. But that seems to be too complicated and isn't likely to be significantly more useful than the existing autotiling functionality (with terrains).