Hello everyone, currently I’m working on cave generation in unreal engine. I am using blueprints for logic. First I create an array in size of width*height and randomly fill it with 0 or 1. Then pass 1 iteration to smooth it out with celular automata. Checking the neighbours and applying logic for every tile. For 128x72 int array and single iteration the process takes approximately 10 seconds. In the future I’m planning to add corridors between rooms, spawning enemies and loot etc… Also I will use marching squares for mesh generation.
Should I continue with blueprint or writing cave generation logic in C++ will be worth in the long run?
Note: Ex Unity user, followed through Sebastian Lague’s cave generation tutorial before.
I would highly recommend using C++ for this, especially if you’re from Unity and already have coding experience.
Just 9,216 elements should not even approach 10 seconds, but that’s the blueprint overhead for you.
Blueprints are run in a virtual machine after being compiled down to bytecode, and every single node call has cost. Not the code the node is running mind you, that’s separate. This is why you typically want to do high-iteration code in native C++.
(even variable gets are nodes)
Generally Blueprints are too slow for operations that require many loops, calculations, etc. So for prototyping it’s fine to use Blueprint, but after the function is done I would definitely rewrite it to C++.
Thank you, I decided to continue with C++ for the most part. When I profiled the smoothing pass and neighbour detection functions C++ is like 5 times faster.