I did a test to see how many times I can call a function recursively in C3:
And the answer is 237.
Is this a hard limit? Or can it be higher/lower on other devices, depending on the amount of RAM etc.?
Develop games in your browser. Powerful, performant & highly capable.
Can’t reproduce. It sets v to 500 or any other limit I throw at it? Got it to 1500, and after that the screen is black. Couldn’t look at the browser console to see if there are any errors. In the past I’ve seen a recursion limit error when trying to do a flood fill algorithm. Luckily any recursive algorithm can be made iterative instead.
This is odd, I'm getting the same v=237 on my laptop and desktop pc. And then "Maximum call stack size exceeded" error in console.
The only thing I did differently was make the v<500 condition directly below the function instead of as a sub event. Perhaps the sub event takes up more data so the stack space gets used up faster?
Yeah, you are right! With no sub-events I get ~430 iterations. With two nested sub-events only 163
So probably event sheet functions use js functions under the hood but uses more data so the stack space is used up faster?
Stack space is usually a fixed size in programs but I could imagine it’s fixed per tab or something in browsers’ js engines.