Hey guys,
I am creating a procedurally generated tile based map. I start the construction of the map on event begin play, but I quickly run into the million loop limit that is meant to prevent infinite loops. Is there a way to bypass this?
To put it in perspective a 1000x1000 map automatically hits the million loop limit and that’s if all you do is generate a tile.
Rebuild the engine from GitHub source?
Probably easier just to split the loops into sub-loops.
Instead of 1000x1000, do 10x10 sections can get each section to do 100x100.
You can go into ScriptCore.cpp and look for the property RUNAWAY_LIMIT. That property determines how many loops you can hit before the limiter kicks in. I hope that this helps!
so I tried converting my for loop into a for loop with a break and I break it up in intervals, so I’ll do like 1k iterations at a time → break → run loop again at last stopping point.
But this logic still caused the infinite loop detector to fire.
I would really like to not have to rebuild the engine from source and then deal with keeping it up to date at this stage. Is there any other way to get around this?
Interesting.
Is it ok to spread out the cretion over a few frames?
Set a timer or use Tick() to generate the tiles shortly after the Blueprint is constructed.
This either requires building the engine from source to fix the loop limit, which I would like to avoid, or using the tick() event. As I already tried using booleans to stop and restart the loop to no avail. The infinite loop detection must encompass all loops on a single event fire.
Have you tried using a delay? You say you are generating the map which means play cant begin until the map is generated. There is a reason for this limit though, if you do an infinite loop in construction script it can render an entire blueprint useless. Another suggest I might have is to use “Do N” node.