First of all, I don’t know if I’m posting this in the correct thread. I’m working in a C++ based project, so I supposed this one is the correct one. But move it if you consider it necessary.
Anyway, the thing is I’m creating a puzzle game. The numbers that compose the puzzle are randomly chosen every time the level is loaded. However, I need to know if the puzzle will have a solution with those numbers. And I need to know this BEFORE the level is loaded. The function I implemented to test this is recursive, and it must execute for each number until it finds a solution or a dead end. And of course, if it finds a solution, the testing stops (I don’t need to know if there are other solutions). In case there is no solution, I have to generate a new array of random numbers, and test them again.
The problem I’m having is that if I test this when the BeginPlay event triggers, everything (game and env.) crushes.
So… what I did is to create a blueprint based on my C++ class blueprint. And I did this testing in the construction script… but it crushed everything again. If I do the test just once (testing just one number), it works fine…
The question is: How should I solve this? I need to pre-calculate this array of random numbers. I’ve been thinking about creating a loading level or something, to calculate these numbers, and then load the level with the puzzle… but I don’t know if the loading level will crush too. Maybe I should use multi-threading… I don’t know. Any ideas?
Thanks in advance!