On 11/7/15, Netanel M. <[email protected]> wrote: > Hey, the code is too messy and long
My sympathies, hate when that happens, >for me to create a bugcode as I can't > pinpoint where the issue occurs. At this point seems more pressing understand better the code and refactor out the messiness than to fix the bug, and trying to build a bugdemo may help with that by giving a small concrete goal. If the code looks too daunting to simplify, then you may start with a simple situation and start adding aspects of your app, say - a scene with M batchnodes, scheduling K percent additions and K percent deletions per frame, running in one thread. If playing with M and K brings the same error than in the app, you have a bugdemo (but not gained much understanding about your app) - If the bug has not been seen, select an aspect in which the app differs with the bugdemo. Select a well defined aspect, add a simplification of the aspect to the bugdemo. Test, rinse and repeat. Examples of aspects to add (some may not make sense for your app, which I don't know): - The demo is adding all in one swoop and deleting all in one swoop. The app probably has a myriad of separate additions and deletions per frame. Lets break the additions and deletions in a number of separated operations, say three, they are done in the same scheduled call - what if the calls are done in different scheduled operations ? - what if some operations are moved to another thread ? By looking at what aspect to add you will gain understanding about what the app should be doing, what does and how. Adding the simplified aspect to the demo will make you more aware of core responsibilities in the aspect, and alternative ways to implement. Ideally, that will suggest partial refactors that tend to un-mess the code. Incidentally, and not the more important, you can end with a working bugdemo. Yes, this is laborious, but the way out from messy code it always is. > anyway, it only happens now when I'm > dealing with insanely large amount of sprites and pymunk bodies. as long as > > I keep it in reasonable amounts it's a none issue. > thanks anyway for your fast support! sorry if I wasted your time. What had been a waste of time is to play the '20 questions game' over a complex situation. Best wishes. -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cocos-discuss. For more options, visit https://groups.google.com/d/optout.
