问题
This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game. but there is a question rising in my mind.
when i will set goal to complete the level, how will i know the goal is achievable ?
suppose in a level where i have to collect 5 Red, 12 blue, 9 green objects by matching the same(like farm heros). how would i decide how much moves i need to set to make this goal achievable. i mean it should be challenging but not be impossible.
since the objects spawn in a random whats the surety that there will be enough number of gem in the game to not make impossible.
is there some logical explanation for this, or i just have to test and look out how many moves it takes to achieve the goal.
Is there an algorithm which generates the gems according to target set, or they are generated in random manner?
To be more clear towards my question i am going to take an example of King.com's farm-heros-saga .
In level 9 the target is to collect number of four types of objects 26,26,14,5 respectively. and the maximum number of moves are 22.
now this goal may be achievable and challenging(i mean you can achieve it in two or three trials ) but not impossible.
Now my question is what made those guys so sure that it will not be impossible, how they decided that 22 move will be enough and challenging.
well.. they could have put the maximum number of moves to 5 or 6. but that would surely make it impossible to clear the level. so how they decided to keep move 22 or this.
Are they using static pattern to generate and spawn objects, or ratio of collectible gems is fixed(i.e in total gameplay there will be X%,Y%,Z%,M% of gems respectively ), or there is some other way.
I just need some hint what should i look for..
回答1:
I am not sure if I get your problem right but I assume:
You have some 'maze' like game board with falling/movable gems or some swap-able gems and after match removal/scoring 'random' gems fill the hole.
then:
backward generating
simply generate the level gems backwards. First generate the target solution and then randomly generate
N
-back steps to game level start. This is not doable for random generating of gems but always grants the solution inN
-steps. The draw back is there is guaranteed only one solution.semi random gem generation
for example this is how Bejeweled works. Remember the level state, generate random gems and test if any valid move is possible. if not then generate different random gems. If still not generate another random set ...
if still no valid move after
N
generations then generate some special gem like hypercube or bomb or joker or what ever. This is simple and always grants playability but not the solution inN
-moves
来源:https://stackoverflow.com/questions/24952187/how-to-be-sure-that-a-target-goal-in-a-match-3-game-level-will-not-be-impossible