How do I Detect a Match Prediction in a Match 3 Game ?

0 favourites
From the Asset Store
Match 3 Game Gem Pixel Art work for any kind of Match Games.
  • Hello, I made a match 3 game with simple functions comparing Frames, X and Y to detect a match , the Game is ready , but I don't know how to detect a match prediction if the player doesn't see where he can match,

    I Know I must check every piece and rank it to see which ones can be moved , but I dont know how to do it , could someone help me? thanks

    I attached the File of the game ! Fill free to use the code

    dropbox.com/s/jraccor4raeuba4/Match3NewVersion.c3p

  • Hi there, I would make something like this:

    1. check every tile for a potential match (see if Y top/bottom or X left/right are the same tile)

    2. store that information in the tile.

    3. check the list of potentials to see if there is any tile around them that match their needs.

    I really think this solves it, but let me know :) I could do some code if necessary.

  • on a second thought, you should check for at least 2 tiles far from the origin, like below:

    because there may be a match like the one below:

  • Thanks dupuqub , I already tryed to do this but I couldn't get it , Ive been searching everywhere and there is nothing similar in the forum , if you code in my file , i really appreciate that !!

    thanks again !

  • I am working on a sample to solve your problem, not coding directly on your project.

    I believe I've found a minor bug in the process, meaning it is possible to handle this bug (if it is a bug), but it would be much simpler if it was fixed (again, not sure if it is a bug).

    I'm currently waiting for a response from the devs, I'll let you know when everything is sorted.

  • It wasn't a bug, here you go.

    github.com/dupuqub/constructs/blob/master/Match_Predict.c3p

    Feel free to ask anything, but you'll find (by moving the mouse around) that every possible match for every tile is already present in the tile itself. All you have to do is choose one.

  • Thanks dupuqub, I saw your code and it works, you used a origin point (Mouse) to determine where to start looking sideways, now I have to figure out how to automatically search each block to suggest a good move to flash or shake the pieces for the player see it !

    Thanks

  • The origin point is actually the current tile inside the "for each tile".

    On the start of layout I give a pass through every tile and set every possibility, then the mouse is used only as a debug method for seeing those decisions that were already made.

    To select a match, you could choose a random tile, then see if it has some possible match, if it hasn't then you choose another random and so forth.

    To select a match inside the tile it would be nice if it were also random, but in a way you cover every possibility so the game doesn't look to be prioritizing horizontals or verticals or anything else.

    Feel free to ask for any further help.

    Cheers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    you can watch my tutorial on match 3 game on my youtube channel.

    It's fully functional, so maybe you can get more insights here.

    Hope it helps

    youtu.be/9ISEJK8vtZI

    Cheers

  • HI bartalluyn

    Thanks for reply, I have seen some of your tutorials and they are great , nice job !

    In the match3 tutorial I did not see nothing about the predict match !

    I just want to show the possible moves , but show only one and the best move ,thanks

  • I believe I gave you a decent enough tool to analyze every possible outcome. You should be able to go somewhere from there.

    You could give a pass through every tile, check where there is a possible match and then check the row or column for the length of the possible match. If it is greater than the last, then store its address somewhere (maybe a global) as the best match possible (remember to store the tile and the tile that should replace it).

    I could code this for you, but I don't feel comfortable doing this since the bulk was already delivered.

    I truly believe you can manage it, but if your code doesn't work just post it here and someone will definitely help.

  • Hi dupuqub

    You did a gret job and I realy apreciate that , and I'm very happy with your quick response, but I still haven't managed to implement it in the game, because assuming that there will always be at most two identical pieces together, because a match has already been made before, so the system has to automatic after 5 seconds the player is not touching the pieces , decide which is the best move of all the possibilities and just suggest one, and all the pieces related to that move must be shown to the player, example with a flash or a sine or something like that, I still couldn't do it , thanks !!

  • Hi,

    I think it can be done using a simple algorithm that loops through the shapes.

    For each shape

    - "pretend to drag it to the left"

    see if there is a match horizontally

    Yes: Add UID's of matches to a temp array

    No: continue

    see if there is a match vertically

    Same yes/no logic

    - "pretend to drag to the right"

    same

    - "pretend drag up.." & same

    - "pretend drag down.." & same

    Finally highlight the UUD's somehow

    something like that. maybe there are more optimal way, but i'm all for easy solutions

    Hope that helps

  • Hi All ,

    For me it is not being easy, it's being a challenge LOL , in the example below assuming that the piece to move is X, how to make the system detect the best movement? what would be the criteria for eliminating the other moves? if it start looking vertically and find a match and don't look any further,it can have a better move horizontally and it won't show , and so on ,how to rank all the pieces and suggest the best move thats the challenge for me ! Maybe I must check for a match of 5 , ( because is the maximum of match ), if I find two or more of 5 I can pick any one of then a random because does not matter which one as they are the same , else I start looking for a match of 4 , and so on ... , I dont know ,Thanks

  • bartalluyn

    If You implement this in your Match 3 Template I will Buy it from Scrirra Store ! Thanks

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