Collapse game experiment / help

This forum is currently in read-only mode.
From the Asset Store
Template for dungeon/maze generation, using wave function collapse
  • I am trying to figure out how to do a collapse game.

    At the moment when I click a block i clear that single block.

    But clearing should only happen if the picked/clicked block is connected to at least two other blocks in the same colour. How can I test that?

    And if its going to destroyed all the connected blocks in the same color should also be destroyed. How would you guys do that?

    Here is my innitial setup

    [attachment=0:31xlh7lo][/attachment:31xlh7lo]

    please do some happy hacking

  • You would need to put the blocks in an array, then use floodfill or something... although I'm sure floodfill uses recursion, and I'd imagine Construct can handle that since a function seems to be able to call itself (just checked).

    See here for some methods of flood fill..

    http://en.wikipedia.org/wiki/Flood_fill

    If you know flash, here's a flash implementation with source that you could try to convert -

    http://www.emanueleferonato.com/2008/06 ... mentation/

    Maybe you'll get some ideas from those.. maybe someone else will..

  • Before posting this one I did a funny flood fill experiment.

    The idea was to create a detector object that is shaped like a " + " and that is slightly bigger than the bricks... the idea of this is to trigger collisions in the directions n, s, e, w

    If the detector objects detects a collision it replaces the colliding brick with a detector. This gennerates a flood fill and a nice effect... but this approach will take several frames for the flood fill to be complete. But I really like that way of generating the flood fill and in general the idea of adding "detectors" dynamicly to the stage.

  • Yeah it's one way around the problem but to do that every frame for so many blocks, there's no surprise the framerate is low. You'll be much faster using an array and using the floodfill method there.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I made one with "+" object and it works pretty well but you have to limit things and disable selecting when blocks are falling.

  • Well... I dont have any framerate problems. It just takes several frames to compute.

    And for the idea of using recursion. The function object fails to do any propper recursion.

    I tried to implement a simple recursive calculation of the n'th factorial. n * (n-1) * ... * 1

    [attachment=0:39icf8w2][/attachment:39icf8w2]

    it fails...

    Any ideas on how to fix this?

  • Doppel: yours works for the first go, then it seems a bit random after that.

    xombul: You'd have to ask the devs if function object can handle recursion. btw.. if your method worked and there was no noticable slowdown, then go for it

    Would be interested in getting this sorted 'cause it would be a useful thing to have in the future. I just don't have the time to experiment a lot atm or I would try a few things myself.

  • I made one with "+" object and it works pretty well but you have to limit things and disable selecting when blocks are falling.

    I have tried this several a few times before... here is my current go at the "clustor detector pattern"

    [attachment=0:22r4u5fn][/attachment:22r4u5fn]

    I just wish I could somehow do it instantly instead of delaying stuff a few frames.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)