Giter Site home page Giter Site logo

alexeybond / godot-constraint-solving Goto Github PK

View Code? Open in Web Editor NEW
244.0 7.0 10.0 6.12 MB

WFC (Wave Function Collapse) and generic constraint satisfaction problem solver implementation for Godot 4

License: MIT License

GDScript 100.00%
godot-4 wave-function-collapse constraint-satisfaction-problem procedural-generation godot godot-addon godot4 wfc

godot-constraint-solving's People

Contributors

alexeybond avatar supamiu avatar totallygatsby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-constraint-solving's Issues

[Docs] Custom Preconditions2D

Hello,
I want to preface with how much I appreciate this addon as it offers a very complete and relatively easy to use integration of WFC. I am trying to make a custom Precondition2D that uses perlin noise (Or simplex noise) to create denser forested areas and plains that are to be populated by WFC. However, I am having trouble understanding how to use the bitset object and the mapper object. I'm also uncertain on how to add the custom precondition to the generator. Would it be possible to have a small crash course? The dungeon example isn't super explanatory...

Air tiles

Hello, how to make it use empty space in the sample? With walls in a GridMap it gave an error assert(mapper.size()>1) because it was only one tile type. Actually there are two types: wall and empty. Add another wall type, it runs but it fills target region with solid wall, ignores free space in positive sample.

[Docs] Add metadata to GridMap

I am encountering difficulties using WFC2DPreconditionDungeon with the GridMap demo. Specifically, I am unsure how to set metadata for grid tiles, such as "wfc_dungeon_road" and "wfc_dungeon_wall." I have attempted various combinations, including setting the metadata for each MeshInstance3D within the library-source, but have been unsuccessful in retrieving the metadata in the code (the assert(not passable_domain.is_empty()) in /wfc/problems/2d/preconditions/precondition_2d_dungeon.gd always fails).

Is it possible to use WFC2DPreconditionDungeon with gridmap?
How can I set the metadata in my grid tiles?

Suppose that I want to add WFC2DPreconditionDungeon with the gridmap demo, what are the steps that I should follow to set the "wfc_dungeon_road" and "wfc_dungeon_wall" metadata to the mesh?

Am I supposed to set metadata for each MeshInstance3D inside the library-source?

I can contribute by adding some documentation regarding that part when everything will be more clear.

[Docs] How to make a good sample?

After using the addon I feel like I'm still struggling with the same thing: creating a proper sample.

Trying to imitate the one in the example scene will quickly hit limits, like when you have multiple types of ground tiles or you want to create different kind of biomes.

I feel like this might be a nice priority to have for the docs, feel free to close if that's not the case tho.

[Suggestion] Multi-Layered TileMap Support

I see according to the features implementation it is not yet added. Is there any known workarounds or any current plans to add it to this plugin? If i want to add trees on top of tiles already placed, with the current features this is not possible (see image below.)

Positive Rule Map
image

Generated Output
image

Rerun on different Rect.

Hello. Again not an issue, but just want to ask/discuss the plugin.

I am trying to dynamically load chunks of the world as the camera moves around. Basically the algorithm would basically just load the tiles in the world that are visible on the camera. Is there an easy way to rerun the WFC algorithm on a different Rect2i on the same TileMap?

Thanks!

[Discussion] Why gdscript and not something else?

Wouldn't the speed be better using C# or something else? I'm not trying to offend anyone, but I'd really like to know what was the benefit of picking gdscript. Read multiple times that iteration is faster in other languages etc.

Big key dungeons

Hello, to make a lock and key dungeon:

Generate your dungeon with the locked doors.

How to make a series of separate walkable regions with wfc? And maybe also ensure that there is somewhere a certain tile (door) between each A -> A+1 region. And maybe a way to find the door of each region, so a key can be generated and linked to it.

[Docs] Samples and Negative Samples

Hello, I've just started a project and was really curious on using your WFC generator to help generate my isometric world map.
I was reading through another Docs request about good samples, and I'm trying to understand exactly how to make good Positive samples and Good negative samples. Currently, I am trying to generate a city scape using the WFC, but the generator seems to generate a lot of combinations that were either not given in the positive sample or it would generate combinations that were normally regarded as bad from the negative sample.

It would be useful to have some visual examples of how the generation logic is supposed to function so that we can work around it. For example, if I place a tile by itself on the negative sample example will that be understood that that tile should never be placed, or will it understand that I mean to say that that tile should never be alone? As in, it should always have at least 1 neighbouring tile.

Here I have what I'm using currently, and I have complete matrices = false added to the base code.

In case you want some context on the blocks, they're just for visual reference I know it looks nothing like a city lol
But the tiles should represent:
grey = exterior tiles,
black = road tiles,
green = wall tiles,
red = interior tiles,
orange = door tiles,
blue = end of road tiles

Prositive Sample
PositiveSample
Negative Sample
NegativeSample
Result (Long Road is prebuilt by me)
Result

How to use your addon to generate dungeons.

Hi there! I've been busy messing around with your addon and trying to find a way to generate rooms that connect in a 2D Tilemap. I was going to try to mess with the rules, but am unsure how it works.
Do you know any good resources on how to use your WFCRules?

Does this respect the various properties of the tile?

First of all, this is an awesome plugin. I apologize for making an issue post as there's no discussion post options. This is not an issue, just a question. Does this plugin respect the various properties painted onto the tile? e.g. custom data, physics, navigation, etc?

[Discussion] Tile probability

After working on layered map support, I realized that it'd be better for me to use this for my game rather than trying to make my own solution, because your solver works like a charm and you seem to be very comfortable with it and keeping it up to date.

What I'm missing for my game is mostly multi-layers (which is being done in #4) and tiles probability.

This issue is mostly to open the discussion on how it could be implemented and what the solver should accomplish to be considered as working with probabilities.

The features

In order to be considered done, the solver would have to be able to read a weight from each tile in a tileset, tile by tile. Setting this info could be done using different methods, one of which being using custom property painting in the tileset editor (or even using the built-in probability property), the other being using some kind of configuration resource for more advanced cases.

A feature that's not required per se but that could be interesting would be to have conditional weights, for instance tile A having a weight of 5 next to tile B but weight of 2 next to tile C, that's a more advanced case that would probably only be solved using a custom resource or a custom ruleset (maybe tile aliases or something to help with that?)

The implementation

If we're using the built-in approach to have a basic probability system, we could simply read the tile's properties to grab probability from that, then using it to computed a weighted random when picking the tile in the solver (I'm failing to see where tho)

Using a more custom approach would require giving cells a probability using a config resource, which could be useful to handle Scene Tiles (which is something I'm doing in my game to have collectable elements placed directly as tiles so they match the grid perfectly).

Maybe we should just make it either support both approaches or just the custom one so worst case, everything can be done with it even tho it'd be worse in terms of DX

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.