krychu / wfc

Wave Function Collapse library in C, plus a command-line tool
348 stars 20 forks source link

CLEANUP Label Never Reached #22

Open nsmryan opened 2 years ago

nsmryan commented 2 years ago

The wfc__create_allowed_tiles function has a CLEANUP section that is not reachable. There is a return before this label, and no goto to jump to it. Is there are missing check that should jump to this label, such as on the return of malloc?

https://github.com/krychu/wfc/blob/38b08ab7a276ba0e4266c3b85ef7f32cc59d4bce/wfc.h#L899

krychu commented 1 year ago

good catch yes 👍 I'll prep a PR. Thanks for reporting.

How's your game going? Are you using wfc with any success? :)

nsmryan commented 1 year ago

I am using it with good success! I still plan to do more with this at some point but I am using this library to generate levels for my roguelike, and they are generally pretty good. I think the main thing is really just playing with the seed, while the wfc library itself does a great job.

I don't know if I mentioned this, but I also wrapped wfc as a TCL extension to play with seed interactively in TCL. https://github.com/nsmryan/tclwfc

krychu commented 1 year ago

oh nice! great to hear it's useful.

Nice about TCL bindings, I can link to that in the docs when I update them next time.

I'm currently testing various custom rand() implementations. High chance one is going to end up in wfc. Generally this means another boost in performance, but also cross platform stability.

Quick question: do you use max_collapse_cnt in wfc_run? I think it might not be an useful argument.

nsmryan commented 1 year ago

I have never tried using that option. I'm glad to hear about a speed boost- always welcome even though its been fast enough for me so far.