Resizing TextureAtlas capacity

Forums Programming cocos2d support (graphics engine) Resizing TextureAtlas capacity

This topic contains 7 replies, has 2 voices, and was last updated by  Iancu Tudor 2 years, 5 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
October 24, 2011 at 4:53 pm #236345

Iancu Tudor
Participant
@iancu-tudor

Hi guys,

I am currently working on an infinite side scroller game.My problem is that the first time the game starts ,it scrolls pretty hard, the odd thing is that the fps do not drop, it’s at 60 constant andiIf you die and replay, it works perfectly!I have a batch node containing all my textures, and i get this message, CCSpriteBatchNode: resizing TextureAtlas capacity from [40] to [54].Could this be the problem?Also i searched the forum but could’t find anything useful!

Any help will be appreciated!

Thanks a lot!

October 24, 2011 at 6:26 pm #352553

araker
Moderator
@araker

The message that the texture atlas resizes its capacity is merely a informative message. There is nothing wrong with your app. If you want to prevent the resizing (allocating enough memory once is faster than having to reallocate), you can give the batch node a initial capacity that is large enough to hold all items.

October 24, 2011 at 6:53 pm #352554

Iancu Tudor
Participant
@iancu-tudor

Thanks for the tip, I forgot about capacity! The message does’n appear anymore, but the first play is still very poor!

October 24, 2011 at 7:53 pm #352555

araker
Moderator
@araker

Try time profiler to find out what is causing the stalls in your app.

October 25, 2011 at 3:59 pm #352556

Iancu Tudor
Participant
@iancu-tudor

That was the first thing i did, everything works ok, no leaks, or overusage of the cpu.I am using setPosition, to move the layer around, maybe that could be causing the lagging!

October 25, 2011 at 6:02 pm #352557

araker
Moderator
@araker

In your first post you say that the FPS doesn’t drop, so in which way exactly does the first run perform less than other runs?

Are you executing code / loading assets in the first run that don’t need to be loaded during the next runs?

If you’re sure it’s not the CPU, then look at the GPU. Usual suspects are

- large sprites

- much overlapping / layered sprites

- a lot of sprites in screen

- a combination of these three

October 25, 2011 at 6:10 pm #352558

Iancu Tudor
Participant
@iancu-tudor

Nope, the same things are loaded each time, the fps does not drop, my parallax works smooth, my hero also smooth, but the ground is lagging really bad, and some of the obstacles!Basically all the things that come towards the hero are lagging the first run!I must do some more tests, there must be something i’m missing! The ground sprite is 480 in width, and 30 in height, maybe this could be the problem!

October 27, 2011 at 9:56 pm #352559

Iancu Tudor
Participant
@iancu-tudor

I think i figured out the problem i had with the jerky sprite movement!Box 2d wasn’t updating as fast as it should, i just changed the timestep, now everything works great!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.