Hello Guest

Author Topic: performance considerations  (Read 5121 times)

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
performance considerations
« on: May 27, 2013, 08:47:46 am »
hi,

i'm hesitating between several solution for sprite animation and wonder what would be the most cost efficient one (and not too tricky to implement in code :)). i'd like to individually control loop or pingpong option for each of the animation.

1) one spritesheet containing all animations packed in a square file (i.e. 2k x 2k) - seems quite tricky as far as i experimented
2) one spritesheet containing all animations but each animation on its own row (non square)
3) a seperate spritesheet for each animation

what do you think ?
« Last Edit: May 27, 2013, 10:55:57 am by mike2d »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: performance considerations
« Reply #1 on: May 27, 2013, 11:51:31 am »
None of these matter really - you are going to import them into a sprite collection right? At the end of the day, what matters is that everything goes into and fits in your sprite collection. You can work with your source images any way you like to, you don't have to import spritesheets. If it makes more sense to you, import loose images instead.

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: performance considerations
« Reply #2 on: May 27, 2013, 01:24:26 pm »
there's no sprite collection involve in my process.

i try to apply an animated sprite (using a self-made spritesheet) onto a mesh.

do i need sprite collection ? what's its purpose then ?

i'm trying to grasp the whole machinery of sprite animation but there are many thing i don't know they exist or how to use them :)

so i guess, the more spritesheets you have, the more draw call it'll cost and the more bigger each spritesheet is will cost in memory right ?
« Last Edit: May 27, 2013, 01:26:29 pm by mike2d »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: performance considerations
« Reply #3 on: May 27, 2013, 01:29:14 pm »
How are you applying them? With everything in 2D Toolkit, you will need to create a sprite collection somehow, either at runtime or in the editor. As mentioned on the other thread you CANT apply an animated sprite onto a mesh. It just isn't possible.

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: performance considerations
« Reply #4 on: May 27, 2013, 01:35:18 pm »
:)

that's the point. as i can't use 2dtk to apply an animated sprite onto a mesh, i'm not using it...

thus, i'm looking for help to animate a texture onto a mesh.

so as far as i understood sprites stuff, i've made an animation resulting in several sequences of frames.
i've put these frames into a spritesheet to minimize draw calls.
and i applied the spritesheet onto my mesh.
that works but my question is more on the performances or the best practices side.

my spritesheet is a 2k x 2k file conatining several animations and i'm wondering what's the best approach to use them with loops option between the three choices i mentionned on the first post of the topic.

sorry for my explanation but i'm not english, i try my best but maybe i'm not clear enough...

PS let's use this thread only from now on :)
« Last Edit: May 27, 2013, 01:37:33 pm by mike2d »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: performance considerations
« Reply #5 on: May 27, 2013, 01:52:31 pm »
Just look into the code in tk2dAnimatedSprite to see how it does looping, etc. Its pretty straightforward - its in the UpdateAnimation function. Same concept applies to this.

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: performance considerations
« Reply #6 on: May 27, 2013, 01:54:20 pm »
thanks