Optimising C++ for runtime/Implimenting external processes

So I’ve gone down the rabbit hole of procedurally generated open worlds, which I haven’t seen a lot of examples of in UE4. With every success I have I greedily want to push things further.

I have a primitive terrain generation algorithm that runs in an actor class. Right now when I hit a point where c++ is using too many instructions it freezes ue4. Limiting the number of statements per tick to make it performant in a game engine makes it take too long or forces me to simplify the algorithm.(which I ultimately intended to make even more complex in the future) Though I’m sure some optimization is possible, it’s not on the scale of being solution.

Running this script in the engine feels like I’m dragging the bull through the mud.

Is there a way to:

  • run a script externally or unimpeded by the routine of the engine
  • call back to the engine when its done producing the serialized data

AND(if so)

  • how will this affect packaging
  • will this affect acceptance on distribution networks like steam or xbox

I could be looking at this the wrong way entirely. If anyone knows if this is possible, if there’s another solution beyond my limited knowledge of c++ and ue4 or if you have any input at all please leave a comment/answer.

Disclaimer: I am new to low level programming, so it is difficult for me to effectively search for the correct approach to a specific problem as I am not entirely familiar with every possible functionality of c++ or even most of the terminology. So I’m sorry if this is covered in the Docs or something but if you point me in the right direction I will figure the rest out myself.

Thanks so much!

Ok, I figured it out on my own, if anyone else runs into this problem there are 2 answers.

  1. Threading, this guy does an excellent tutorial. Unreal 4 Threading - Running a Task on a Worker Thread - YouTube
  2. FMonitoredProcess, there isn’t very much information on this that’s applicable for a novice like me, so good luck.