Jump to content
  • Advertisement
Alexander Nazarov

Nuances in the creation of the game Match-3

Recommended Posts

Hi. I have some stupid questions about Match-3 game (CandyCrash, GardenScapes...).

1. How to organise the structure of the game?  Should I use MVC pattern or apply more dynamical approach?

2. There can be a situation, when new game element is falling to an empty place not from top, but from the  adjucent column? How can I implement this functionality? 

3. What and why should I use for the game board: game space or GridLayoutGroup in Canvas??

Share this post


Link to post
Share on other sites
Advertisement
Quote

There can be a situation, when new game element is falling to an empty place not from top, but from the  adjucent column? How can I implement this functionality?

Do you mean e.g. falling diagonally? For reference, can you give an example of a game that has this behavior?

Quote

What and why should I use for the game board: game space or GridLayoutGroup in Canvas??

I don't see any mention of what technology you're using, but searching for 'GridLayoutGroup' suggests it's Unity. Are you using Unity?

Share this post


Link to post
Share on other sites
7 minutes ago, Zakwayda said:

Do you mean e.g. falling diagonally? For reference, can you give an example of a game that has this behavior?

I don't see any mention of what technology you're using, but searching for 'GridLayoutGroup' suggests it's Unity. Are you using Unity?

Thanks for your answer and sorry for not complete question.

 

Quote

Do you mean e.g. falling diagonally? For reference, can you give an example of a game that has this behavior?

Yeap, I mean exactly this case. Games for example are HomeScapes, CandyCrash, Indy Cat. You can check that video below, set playback speed to 0.5 and you will see this effect.

 

Quote

I don't see any mention of what technology you're using, but searching for 'GridLayoutGroup' suggests it's Unity. Are you using Unity?

Yeap, I'm going to create my game using Unity. Can you suggest some advises for this type of game?

 

 

 

Share this post


Link to post
Share on other sites

Thanks for posting the video - that's helpful.

Regarding how to implement this in Unity, I'm not up to speed on Unity's newer features (including the newer 2D features), but my initial thought is that GridLayoutGroup may not necessarily be the optimal solution. I looked at the documentation for it, and it looks like it's a UI component that might not really be intended for or suitable for game logic/representation like in a grid-based matching game.

Again, I don't have direct experience here, and I may be off base. If so, perhaps someone who's more up to speed on Unity will comment. Based on my past experience with Unity though, I would think a 'game space' solution (assuming I understand what you mean by that) would be more appropriate.

Regarding diagonal sliding and game logic in general, maybe you already have this in mind, but the approach I'd take is to implement the game logic in purely discrete terms, where items are only ever entirely in one cell and move instantly from one cell to another. Then add the animations (sliding, etc.) as purely cosmetic effects on top of that.

If I were doing it, I'd implement the gameplay so that the logical and cosmetic elements could be easily separated out, including support for disabling all cosmetic elements so you can observe the game logic in its simplest form.

As for diagonal moves in general, how to implement that might become more clear if you separate logic and cosmetics as I suggested (which you may already be doing). If you run into further issues with that, you can of course always post back.

Share this post


Link to post
Share on other sites

@Zakwayda, couldn't you answer one more question? I have separated my game logic from the view. It woks without any animations and visual effects. Now the question is how can I properly bind my view(animation, effects etc.) with my logic. When I find match3 cells on the board and delete them in logic, there can be several operation that logic does instantly (deletes match3, explodes something, generates another cool element). How can I simulate this actions in my view?

 

And another question, is it bad solution if I write all my logic in visual terms. I mean is my (M)(V)(C) based program will look like (MV)(C) i.d. logic and view will be one unit.

Share this post


Link to post
Share on other sites
Quote

And another question, is it bad solution if I write all my logic in visual terms. I mean is my (M)(V)(C) based program will look like (MV)(C) i.d. logic and view will be one unit.

This question I don't quite understand (I'm not sure what 'i.d.' means). If you mean combining logic with visuals/cosmetics, it's not bad per se, but I think there can be advantages to keeping them separate or at least conceptualizing them independently. YMMV though.

Quote

I have separated my game logic from the view. It woks without any animations and visual effects. Now the question is how can I properly bind my view(animation, effects etc.) with my logic. When I find match3 cells on the board and delete them in logic, there can be several operation that logic does instantly (deletes match3, explodes something, generates another cool element). How can I simulate this actions in my view?

I don't think there's any one right answer to this question. There are lots of ways you could do it. But I can offer some ideas.

I understand (I think) the kind of thing you're talking about. A polished 'match 3' game (or similar game) will often have multiple events in sequence that result from a single move. For example, any matches animate and disappear, other pieces animate and slide into place, 'scoring' effects are generated, bonuses are awarded, and so on. One move can result in multiple events occurring in sequence, each with a logical component and a visual/cosmetic component.

One thought is that you don't necessarily need to perform multiple logic steps in sequence and then perform all the visual corollaries in sequence. You can instead interleave them, e.g.:

logic
animated visual
logic
animated visual
logic
animated visual

Instead of:

logic
logic
logic
animated visual
animated visual
animated visual

It can be done either way, but interleaving might be easier.

As for how to implement the visuals/animations specifically, again, there are various ways to do it. I think in Unity coroutines are often used for this sort of thing. Personally I've always found it easier and more intuitive just to handle everything in the 'main loop', as it were, but that's up to you of course.

Other ideas that might be helpful are an event queue, and/or the 'run and return successor' idiom. I could say more on that, but this is probably long enough as is. I can probably elaborate further if it'd be helpful though.

Lastly, I don't want to throw you off in any way. If what I'm suggesting doesn't seem intuitive, then obviously you should do whatever works best for you. At the very least though, I think thinking through the logic independently of cosmetic effects can be helpful in figuring out how things can or should be implemented.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!