SpriteBatch -> 2x performance improvement anyone?

  ... information about changes and new features of AndEngine,

How do you like the SpriteBatch feature?

I waited for this for my whole life!!
48
49%
I'll use it in my next project!
27
28%
I don't know... yet.
22
22%
I don't need it, can I have a beer instead?
1
1%
 
Total votes : 98

Re: SpriteBatch -> 2x performance improvement anyone?

Postby moppelg » Sat Jun 18, 2011 12:09 pm

Good morning,

it seems a nice thing. But how can I apply this on the Particle.class? Is that something I have to do in my code or does this need changes in the andengine?
Because this should really boost the particle performance since it is using always the same particle.

Best regards,

Moppel
moppelg
 
Posts: 64
Joined: Sun Jun 12, 2011 12:42 pm

Re: SpriteBatch -> 2x performance improvement anyone?

Postby Nicolas Gramlich » Sat Jun 18, 2011 2:13 pm

Hi,

moppelg wrote:Good morning,

it seems a nice thing. But how can I apply this on the Particle.class? Is that something I have to do in my code or does this need changes in the andengine?
Because this should really boost the particle performance since it is using always the same particle.

Best regards,

Moppel


the Problem is that the (or at least the current implementation of) SpriteBatch makes individual alpha and coloring impossible :(
The ParticleSystems would be much less awesome (only position, rotation, scale).

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: SpriteBatch -> 2x performance improvement anyone?

Postby illserveu » Sat Jun 18, 2011 3:45 pm

What about TiledSprite please? I mean, TiledSprites that have the same animation?
illserveu
 
Posts: 31
Joined: Sun Mar 13, 2011 1:37 pm

Re: SpriteBatch -> 2x performance improvement anyone?

Postby Nicolas Gramlich » Sat Jun 18, 2011 3:53 pm

Hi,

illserveu wrote:What about TiledSprite please? I mean, TiledSprites that have the same animation?


Those sould work to, but you have to use a SpriteGroup instead of a SpriteBatch, because the "data" in the AnimatedSprite needs to be refreshed potentially every frame and is not static like desired for the SpriteBatch.

The http://code.google.com/p/andengineexamp ... hmark.java shows the use of a SpriteGroup.

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: SpriteBatch -> 2x performance improvement anyone?

Postby aerobowl » Mon Jun 20, 2011 9:28 am

is great to hear that there is new enhancement on AndEngine
will eager to find out and replace my AndEngine projects with the latest
aerobowl
 
Posts: 7
Joined: Tue Feb 08, 2011 3:29 am

Re: SpriteBatch -> 2x performance improvement anyone?

Postby myrddin » Mon Jun 20, 2011 10:37 pm

HI,

It's a good idea, it's like a bitmapdata (in flash).
I have a question, can we use sprites with different sizes ? Or we have to use the same size for each sprite ?
Thanks
myrddin
 
Posts: 3
Joined: Thu Jan 27, 2011 7:34 pm

Re: SpriteBatch -> 2x performance improvement anyone?

Postby Nicolas Gramlich » Mon Jun 20, 2011 11:24 pm

Hi,

myrddin wrote:HI,

It's a good idea, it's like a bitmapdata (in flash).
I have a question, can we use sprites with different sizes ? Or we have to use the same size for each sprite ?
Thanks

sizes don't matter.
You can even scale/rotate.

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: SpriteBatch -> 2x performance improvement anyone?

Postby aerobowl » Tue Jun 21, 2011 3:52 am

im abit confuse where would be the best place to update spritegroup or add/remove sprites from spritegroup?

for the moment i detach, make new spritegroup and attach it back in scene's onUpdate
thou working but not too sure is that the good way.

thank you
aerobowl
 
Posts: 7
Joined: Tue Feb 08, 2011 3:29 am

Re: SpriteBatch -> 2x performance improvement anyone?

Postby salami » Tue Jun 21, 2011 11:03 am

Thanks for the update.

I used SpriteGroup with an ObjectPool and it worked ok, only problem was that it took too long to make sprites invisible.

I attached a SpriteGroup to a scene and in onAllocatePoolItem() i added a sprite to the SpriteGroup. In onHandleRecycleItem(Sprite) I set sprite.setVisible(false).

Is there a way to make sprites disappear faster?
salami
 
Posts: 57
Joined: Wed May 11, 2011 3:22 pm

Re: SpriteBatch -> 2x performance improvement anyone?

Postby Nicolas Gramlich » Tue Jun 21, 2011 1:19 pm

Hi,
aerobowl wrote:im abit confuse where would be the best place to update spritegroup or add/remove sprites from spritegroup?

for the moment i detach, make new spritegroup and attach it back in scene's onUpdate
thou working but not too sure is that the good way.

It was the only way up to the changeset I just commited. I kind of forgot to add remove methods, as I hadn't needed them for the Benchmark I did.

Changeset: http://code.google.com/p/andengine/sour ... 2e20d696d9

The andengine.jar from the AndEngineExamples is also updated.
salami wrote:I used SpriteGroup with an ObjectPool and it worked ok, only problem was that it took too long to make sprites invisible.

I attached a SpriteGroup to a scene and in onAllocatePoolItem() i added a sprite to the SpriteGroup. In onHandleRecycleItem(Sprite) I set sprite.setVisible(false).

Is there a way to make sprites disappear faster?

When calling setVisible(false) the update is reflected on the very next frame being drawn!

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

PreviousNext

Return to Updates

Who is online

Users browsing this forum: No registered users and 3 guests