Game Development Community

iT2D 1.5 Preview 1 - PUAP_SCRIPT_CHANGE breaks script recursion - LOGGED (ITGB-206)

by Tim Newell · in iTorque 2D · 07/06/2011 (1:57 pm) · 6 replies

Build:1.5 Preview 1
Platform: Device and Simulator (maybe MacOSX as well)
Target: Device

Issue: Turning on PUAP_SCRIPT_CHANGE causes recursive calls to not correctly hold their local variable values. This does work with the flag off.

Step to Reproduce:
1) create a function that has a for loop that is called X number (like 10) and in this loop it calls itself.
2) you will get an infinite loop because it will not maintain the correct loop variable values.

Suggested Fix: N/A I ended up just having to turn the flag off since I did not have time to dig into the interpreter code and find out why that flag breaks it.

#1
07/11/2011 (6:02 am)
Hi Tim.
I got the same behaviour.

I posted some details about what was going with me, but anybody replied me..
I stopped to use recursive function to avoid this bug.
In some cases, I wrote the same function in c++.

Here is the thread:
Script Issue
#2
07/11/2011 (6:41 am)
What is this PUAP stuff? I see it all over the code. It appears to pretty much rip iT2D apart and put it back together again for the iPhone.
#3
07/11/2011 (7:34 am)
PUAP tag is for iphone optimizations someone made. I don't remember what PUAP stands for but I think it had something to do with their company maybe.
#4
07/14/2011 (6:48 am)
PUAP stands for Pick Up And Play. Tim is right in what they are intended to do, but some problems are cropping up thanks to Tim's research. For example, both Tim and I are tracing what we believe to be a big leak when certain ones are turned on. You're right, it does split the code in many places, but they do get the job done for performance gains. They were added before I was on the project full time, so I do not have access to any comments or e-mail regarding them.
#5
07/14/2011 (12:30 pm)
I am pretty sure the issue here is due to the switch of using just 1 dictionary in pushFrame and popFrame of consoleInternal.cc. PUAP_SCRIPT_CHANGE reuses the same dictionary except for recursion which it creates a new one everytime. If you remove the check for recursion so everything uses the one dictionary then it will fix the infinite loops the broken recursion caused. However it seems like it may only do the recursion once or twice so its not really a fix, but maybe it will help you find the real problem.
#6
08/03/2011 (2:28 pm)
Logged ITGB-206