need help with logic for Octagon tile spawning
So I've got a puzzle that's formed of tiles to make an octagon shape. I'm looking to get some perspective on the logic i should use when working with the blueprint system in UE4.
So to break down what i'm trying to do, i have a spawner spawning up to 8 tiles in an octagon shape, this means i can have up to 65 (if you include having no tiles spawn at all) variants of an octagon shape that can generate. My issue is i need logic to not make the puzzle impossible so that when the current piece moves out of the spawner, the next piece generates with certain logic (Depending on an, EASY, MEDIUM & HARD criteria) to not make it impossible.
So if we move out of the abstract & i try help visualize what i mean, if i'm on easy then a certain amount of pieces need to spawn (say between 8 & 5) to make a full octagon & that 0 pieces is spawned at a low rate.
Now my logic so far is to create an array with a range of 65, set all 65 values to all the different variants of the total "octagon" shape then create the modes for difficulty that (somehow, not sure how to do this part with blueprints) have rules for which pieces can be generated next based on the current mesh array that has been spawned.
Problem is i can see this becoming a huge series of if statements, checking values & making the whole thing more convoluted than it needs to be. So if anyone has any ideas on how to tackle this idea, i'd be grateful & like to chat!
asked Mar 01 '19 at 04:46 PM in Blueprint Scripting
You need to be very clear about what you're trying to do before you try and code it.
I understand what you're talking about and the possibilities are not 64. It's 'ways of choosing x from y':
How many ways to choose 0 from 8 ( written 8C0 ) = 1 + How many ways to choose 1 from 8 ( written 8C1 ) = 8 + 8C2 = 28 + 8C3 = 56 + ... = 256
You could do it easily in concept with an array of 0 or 1. Just set the array with a loop and random int in range. Then shuffle it. Then just draw the tiles.
Or, you could make a blueprint tile which is randomly on or off. Then to make the next chunk of the corridor, just put 8 tiles there. It will always be different.
Then you can start thinking about difficulty settings. I already see a problem, I think, in that the walker will not be able to get from one corridor section to the next. But I could be misunderstanding your game mechanics...
Hope that helps...
Follow this question
Once you sign in you will be able to subscribe for any updates here