CocosSharp and Circles

johanksonjohankson SEInsider, University ✭✭

Hi!

I'm playing around with CocosSharp (I'm a totally newbie at CocosSharp) for my own amusement. The game I've made consists of a whole bunch of circles. I currently use one CCNode for each circle that has a CCDrawNode that draws the actual circle.

I threw in a simple QuadTree-implementation to handle collision checking.

My problem is that when I add about 300 of these fine circles I get an "Destination array is not long enough to copy all the items in the collection. Check array index and length."

So, what would the solution be? Is it?

A ) There is somewhere where I need to up the limit?
B ) Batch circle drawing into a single node and redraw the whole node each time and keep a list of "virtual entities" on the side
C ) Use sprites with the drawback of pixel perfect scaling (they are all different sizes and colors) (perhaps create a mipmapping thingy)
D ) Something totally different

Performance is not an issue, I simply can't add more objects.

Thanks

// Johan

Best Answer

Answers

  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Johan,

    I've opened up an issue here for a proposed feature request to be able to customise the size of the CCDrawNode buffers which should be included in our next release.

    In the interim, my suggestion would be to partition your drawing into two (or however many are needed) CCDrawNodes.

  • johanksonjohankson SEInsider, University ✭✭
    edited December 2015

    The problem is actually that I can't add more nodes. For the moment I have one circle per node (A CCNode with a single CCDrawNode child).

    So if I have 150 circles, I have 150 CCNodes with one CCDrawNode child each.

    It's when adding a new CCNode to the layers Children property that I hit an upper limit. Or are they batched in the background somehow?

Sign In or Register to comment.