Sunday, January 27, 2013

The stupid bug

I think this is a Corona/Lua problem - and we stumbled into it.
So for the 'static' scenes we seem to be okay. It's the ones that have a scrolling background that have problems.
At about 25 to 29 seconds - when objects are not getting inserted such as enemies - I get the same problem. A run time error thrown by Corona/Lua:
Runtime error
...pos\flights of fancy branch\Managers\moveManager.lua:29: attempt to call method 'translate' (a nil value)
stack traceback:
[C]: in function 'translate'
...pos\flights of fancy branch\Managers\moveManager.lua:29: in function 'moveBackgrRuntime error
...pos\flights of fancy branch\Managers\moveManager.lua:29: attempt to call method 'translate' (a nil value)
Same thing happens whether or not the code to move the background is in John's new module or not.
I think this this frankly is a Lua problem and it has to do with memory management. Is this a big issue? Not sure. What happens when a player has to deal with a phone call, or real life issue and walks away. So I think this is an issue - we probably need some kind of global answer where after 20 seconds of no user input so wait state is put in place.
So that is problem 2. Problem 1 was why my intro/train code wasn't playing well with John's changes. And I stated that correctly - John did the right thing in terms of pushing common tasks into a single module, and my code wasn't playing well with his.
Oh boy - Lua is twitchy.
I did make some changes to some code - I need to review before I push it up to SVN. In a nutshell tho - take a look at how I load the objects into memory in level0. Very old school procedural code way of doing things. In essence - pay attention to '-- BEGINNING OF YOUR IMPLEMENTATION'. It seems to be that I need to load objects I'm going to manipulate as well as any other functions into memory BEFORE the scene management code gets called. Ouch. Pain. Not happy. Very very old crappy yecch bad. Double plus not happy. But by doing that I was able to get to level 3 - the horizontal planes flying in formation - before stuff crapped out.
I also made sure I not only killed - I added rings of garlic and then sowed salt into the ground - in level0 regarding the objects called and created. Can I say that I am not a fan of garbage collectors I can't touch. C++ is a happy place. C is good. C# is meh - and Java is in the same place. Oh well, I am a dinosaur and the tar pits beckon.
In any event I am going to do more review etc. of the program before I post anything. John - I only added one function and also defined bg1 & bg2 as local vars in Managers.playerManager. I think that is kinda benign - okay so I added a third arm to the guy but hey, it seemed like the right thing to do.  It's not like I added another head or anything like that...






No comments:

Post a Comment