Results 1 to 6 of 6

Thread: Looking for an idea...

  1. #1

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237

    Looking for an idea...

    I'm cloning Super Puzzle Fighter (II?) that was on the PS1. If you're not familar with the game you have 4 colors of blocks fall and if a rectangle of size 2x2 or bigger of the same colors meet they form a larger block, a single larger block. If I have my array of information say:

    0 0 0 0 0 0
    0 0 0 0 0 0
    0 0 0 3 3 0
    1 1 0 4 4 0
    1 2 2 4 4 3
    3 2 2 4 4 4
    1 3 2 4 4 4

    How could I determine where a large block should go? I've been fighting with this function for a while.
    Simple example are the 2's. What do I use? Another array? Some other data structure? And once a larger block is made it needs to stay. For example the 4's, if the tower of fours (2w, 4h) was created first then that block needs to stay when the right most 4's land, and not make a 3x2 with a 2x2 on top, and vicea versa.

    Also the blocks are made as new ones land, the small blocks come two at a time. so this:
    .....2 1
    .....|..|
    .....\/\/
    2 2
    2 2 2 would be a block 2x2 with a single on its lower right side.
    but when the 2 hit the bottom it would become a 3x2. If you know the game it helps.

    Any ideas? I know this is a BIG question but I'm hoping someone else has does this clone and/or has a flash of genius.

    NOMAD

  2. #2
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    All you have to do is to loop trough all the possible positions and check if they have a square or whatever. For example for a 2x2 square, this would check of the other 3 blocks are equal to the top-left block: (it does this for all the possible squares on the map)

    VB Code:
    1. For X = 0 to MapW - 2
    2.     For Y = 0 to MapH - 2
    3.         If Map(X, Y) = Map(X + 1, Y) And _
    4.          Map(X, Y) = Map(X, Y + 1) And _
    5.          Map(X, Y) = Map(X + 1, Y + 1) Then
    6.             'It's a square! Blow it up or something
    7.         End If
    8.     Next Y
    9. Next X

    As to the other question, it's easy, every frame just check if there's a block below the falling block, if there is, then make it "fixed", add it to the map or something.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  3. #3

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237
    hmmm I see what you're saying, but they don't have to be squares. You can have 2x3 that goes to a 3x2 or 2x3 (like my 4's example)... I dunno. It needs to remember which way came first so I need to save the data from the last, I can't recalculate it each loop.

    Say I check the entire board each time I run a game loop. How would save the data to remember where the larger blocks where last time? I figure I can check to see if there is a square relitivly easily by working from one direction looking for blocks.

    Hmm let me work on it. Thanks for your input Jotaf98!!!

    NOMAD

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Thanks

    But unless you want it to run at 50fps, it's ok to loop trough all the blocks and check if there's a 2x3 or a 3x2 or whatever you want at that position, every frame. When you find a big block, do whatever you want with it, you don't have to remember it I think. You'll see that it's not worth the effort, optimizing something like that with code to remember the biggest blocks and stuff...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237
    If I run through the entire thing each time with an algorithm that finds the big block, some something as simple as if it finds a # it looks for another # catacorner and goes from there (relitivly simple), operating from top to bottom (as an example). If I had a long short one on the bottom say 4x2 on the last row and I started putting blocks one top of it and it then looks like this:
    # # <- both newely added
    # # # #
    # # # #

    then the algorithm would make it two blocks one 2x3 on the left side and a 2x2 on the right. Where it should rightfully be a 4x2 with 2 individual blocks on top. Thats why I can't get past the idea that its gonna need to remember the big blocks positions from the previous loop.

    What I'm thinking about is only checking the newly placed blocks cause nothing else will chenge from the previous screen. Somewhere along the lines that if it lands on a big block of its # then it checks to see if it has neighboring #s of its type to make the big square grow or if it makes a new block that has to be two by two...
    I'm gonna be busy on homework projects for a while from school. But I'll try to still discuss theory about this with anyone who is willing to listen to me blaber.

    NOMAD

  6. #6
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    Similar to tetris? Save the highest point of a column, then check of the lowest spot on ur block is hitting the highest point of column (for each thing, from side to side on ur block). If there's a collizions, check colors.
    Don't pay attention to this signature, it's contradictory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width