Skip to main content
gamedev.net
🔒 Locked

Block falling algorithm...

Started by Dark Star 6 replies 650+ views
Original Post
Dark Star
Dark Star
Hi all, been playing mr driller lately to study for a project, Im making a remake of it soon I was puzzled by how they make the blocks fall when the level is being re-adjusted, by that I mean when a block below ceases to exist, how do they make the others fall? I know how Id do it, but I dont get how they do it when u got connected blocks. To see what I mean check out the illustration below:

    1
    2345
      6
    X
 

say the numbers one to six are the coloured blocks (all with same colour and connected to each other) and X is another colour block. all the coloured blocks (the same number) should fall until block 2 sits on top of block X. like so
  


    1
    2345
    x 6

Mr Driller does this and I got no idea how I would design an algorithm to do this....blocks 3,4,5,6 and 1 dont fall all because they are connected to block 2 that is sitting on a block (x) which cannot fall. Thanks for your help Dark Star UK
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
c t o a n
c t o a n
It''s a cross-post! Grrr.... I''ve learned to hate these (ever since I made the mistake not too long ago).
Chris PergrossiMy Realm | "Good Morning, Dave"
Dark Star
Dark Star
Then dont, respond....usually I dont respond to post that critise or have content unrelating to my post but now I must explain.

I cross post from time to time because, I have seen that many people come onto gamedev.net forums mainly looking at what they wanna look at. So some people dont look at all discussion forums. I cross post because my message usually gets answered by more people that way and I have found this works.

There is nothing to hate about it....if U recognise the post from another forum, dont open it. Move on. Logical right?

People get annoyed because they want to. If cross-posting was really a BIG problem like most make out here then I think my message would have been deleted by a moderator long time or they would have a program to monitor cross-posts among forums.

Let's get back to helping those in need, people. I shouldn't have to write back to explain something soooo small as cross-posting.

Think about it... respond if u want....I will not!...it's done!

DarkStar
UK
(loves cross-posting)


P.S. Responding to users who cross-post is more a waste of time. People need to stop complaining then the world would move faster. I should know...I live in the UK...they love to complain.

[edited by - dark star on August 31, 2003 1:39:38 PM]
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
ToohrVyk
ToohrVyk
Do a recursive dynamic check to see if a block can move down.

For each block, remember all blocks that must be falling in order for it to be falling too.

This includes :
-blocks in the same "object" as this one
-blocks below this one

Then, set all blocks to "don''t know if can move".
For each block, determine if it can move : look at all blocks "tied" to this one and determine if they can move (if not already determined). If all tied blocks can move, then the current block can move. If any of them is blocked, all others are blocked too.

To make things easier, always study the lowest blocks first.

ToohrVyk

johnnyBravo
johnnyBravo
Well use the way you are setting the 123456 block.

Like put them into an array, scan under each one and make sure there isnt any blocks under. If there isnt move them all down one.

etc etc

about cross posting, i use to do that a little bit on difficult questions, but i can sorta see why ppl might get pissed off. As they put all this effort into writing an answer and it might of already been answered way b4.
drekkar
drekkar
i''d also assume that most people (or at least i) read all the forum topics
ToohrVyk
ToohrVyk
Johnnybravo : your method does not work in cases like this one:



11
122
112
22



Where 1 are 2 are blocks belonging to objects 1 and 2. Using your method, the above will not move, even if there''s nothing below.

ToohrVyk

Dark Star
Dark Star
well JohnyBravo,

I dont think it matters if people put all effort into answering questions when its been done on another forum dozens of times, because in the same post in a specific forum people put their effort into answering the posts and people still offer their ideas,so whats the difference if its in many forums. The cross-poster gets multiple answers from people who DONT always look in all forums.

And to drekkar,

Its wrong to assume all people read all forums and all topics. I dont, and not everyone would..because there are some people who may not be interested in other forums. So my cross-posting reaches more people. It works most times, not all..other times it pisses people off who dont have to open the post. At least when I cross post I dont change the subject to confuse people into opening it.

As I said before, if cross-posting was really a big issue on here I''m sure the moderators would be deleting cross-posts or develop software to monitor cross-posts. But they have not yet, meaning its no big deal.

People, dont waste time writing one-liner posts just to complain about something u did not have to read, surely You remembered the topic from last forum? Then leave it alone. We should not have to write off the topic originally answered.And I usually never have to justify my actions.

To all who suggested solutions to my problem thanks very much, I have taken on board the ideas. And to all those who suggested solutions to my problem, without complaining about something sooo insignificant as cross-posting thanks even more.

This topic doesn''t need to go further....does it?

DarkStar
UK
---------------------------------------------You Only Live Once - Don't be afriad to take chances.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.