Hello Guest

Author Topic: Lots of sprites always on screen  (Read 5951 times)

mfcas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Lots of sprites always on screen
« on: July 22, 2013, 08:32:26 am »
I have a screen always filled with 16x16 sprites (for fullscreen full HD it will be 8100 sprites). I need to change the sprites' spriteID very often.

For now I create an array of sprites, but it takes very long to instantiate a big number of sprites, and also having such a big number of GameObjects on the screen slows things considerably.

What's the best way to make this run fast?

Can I use a tilemap and change tile's sprite id without rebuilding the whole mesh?
« Last Edit: July 22, 2013, 08:42:49 am by mfcas »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Lots of sprites always on screen
« Reply #1 on: July 22, 2013, 11:07:11 am »
You could use the tilemap. The tilemap system updates based on partitions - default is 32x32 tiles, but user definable to be smaller or bigger. When a tile changes, a partition is marked as dirty and when you call Build, only dirty partitions are rebuilt. Could work quite well in your case.

mfcas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Lots of sprites always on screen
« Reply #2 on: July 22, 2013, 12:38:40 pm »
Can we expect tiles rotation by 90, 180, 270 degrees anytime soon?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Lots of sprites always on screen
« Reply #3 on: July 22, 2013, 12:48:30 pm »
You can vote for it on the trello, but I can't commit to any timescales.
It is high up in the tilemap requests right now, though.

mfcas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Lots of sprites always on screen
« Reply #4 on: July 22, 2013, 01:01:38 pm »
Voted, and removed my vote from autotile just to make it stand out more. Even 90 degrees rotation would get me a long way because I can manage the rest with flipping.
The performance is so much better when using a tilemap! I have to switch back to the sprites though, but only until the rotation gets in.

Thanks for the help!
« Last Edit: July 22, 2013, 01:04:08 pm by mfcas »