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
336 stars 14 forks source link

Arbitrary 2d array data instead of TileMap? #28

Open shazzner opened 1 week ago

shazzner commented 1 week ago

Hello, I'm working on a 3d puzzle game involving blocks of different types. I'd like to setup a feature that generates a random puzzle based on predefined rules, naturally I found WFC. Most implementations though center around generating TileMap data and in looking at this project's docs it looks like you need a source and target tilemap.

Instead of building shims and translating tilemap data to data that I can use for my game logic, I'm wondering if I can simply pass in a 2d array of constraints (consisting of int values), along with target dimensions and it would solve that.

I saw that you have a sodoku solver, but my case is a bit simpler and I didn't see this specific example. Thanks!

AlexeyBond commented 1 week ago

Hi.

This addon does not require TileMap or any other specific node. Instead it uses mappers to interface between the algorithm and nodes. So if you do have some sort of map-like node in your game, you can implement a mapper for that node type.

If you don't have such nodes and really want to work with just arrays, then it gets more complicated, as WFC-specific part of the addon is built with assumption that there is some sort of map node. You'll have to