Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8018145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:03:41+00:00 2026-06-04T21:03:41+00:00

I do not understand what I do exactly when I add a CCSpriteFrameCache or

  • 0

I do not understand what I do exactly when I add a CCSpriteFrameCache or CCSpriteBatchNode to my cocos2d application. Can somebody please explain the following points (it would be helpful if you could explain a few; please write the corresponding letter in front of your answer according to which question you are answering):

[all questions imply the achievement of best performance and lowest memory-use]

a) Is it crucial to create spritesheets for every single layer ? (For example: Menu – own spritesheet, GameLayer – own spritesheet…)

b) Can somebody explain why I have to add sprites to the batch node, and what a batch node generally is ?

b1)So, why can’t I just do something like:

      [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"menusprites.plist"];
       CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"menusprites.png"];
      [self addChild:spriteSheet];

And then just add sprites to my layer by calling

CCSprite *mySprite = [CCSprite  spriteWithSpriteFrameName:@""]; 
[self addChild:mySprite];

without adding them to the batch node ? Because from what I understand it works like this :

I add my spritesheet with all the sprites on it to the screen. My app then goes into the plist and looks for the coordinates of the sprite I want to display and then places it on the screen. So why should I call

[spriteSheet addChild:mySprite];

?

c) How do I then get rid of the spritesheet for memory purposes when I do not need it anymore ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:03:42+00:00Added an answer on June 4, 2026 at 9:03 pm

    a) It is best to create as few spritesheets (CCSpriteBatchNodes) as is possible. Sprite batching reduces draw calls. Draw calls are expensive. Still, every batch node creates one draw call. So you want to use as few as possible because the ultimate goal is to keep draw calls as low as possible.

    b) The CCSpriteBatchNode renders all of its children in one go, in one batched draw call. That’s why you need to add sprites to the batch node so it can render them all together. Only sprites using the same texture as the batch node can be added to a batch node, because you can only batch draw from the same texture. Whenever the engine has to switch from one texture to another, it issues a new draw call.

    b1) You can’t do this because the batch node renders its children. If you add the sprites to any other node, each sprite draws itself, which means one additional draw call per sprite. And the sprite batch node has nothing to do.

    c) The CCSpriteBatchNode is just a regular node. You can remove it from the scene like any other node. The texture and sprite frames are cached in the CCTextureCache and CCSpriteFrameCache singleton classes. If you want to remove the textures and sprite frames from memory, you have to do it through the cache classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure exactly how to understand the usage of message in socket.io. I'm
I do not understand why application goes down when there are too many requests?
I do not understand pointers. Where can I learn more about them?
I clearly do not understand git at all. This is what I'm getting: git
I do not understand because when the data were entered into the login are
I could not understand BorderThickness={TemplateBinding BorderThickness} . Here the code: <ControlTemplate TargetType={x:Type wpftoolkit:DataGridCell}> <Border
I simply do not understand why both works: this.timer.Tick += new EventHandler(timer_Tick); this.timer.Tick +=
I do not understand what environment a eval or exec statement executes in. You
I do not understand this error, do not generate error in JsonResult Test (),
I do not understand how to use enumeration types. I understand what they are,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.