Hello Guest

Author Topic: Performance questions  (Read 3642 times)

pedronveloso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Performance questions
« on: November 11, 2013, 03:01:55 pm »
I'm doing a top down game and I'm using a lot of sprites on top of other sprites (background, terrain, terrain details, characters) etc. Any special recommendations to this use-case?

1. There are big chuncks of the background that all belong to the same atlas and in runtime I've to change the color of each of this sprites dynamically. Do I still have some advantage by creating a Static Sprite Batcher since they all come from the same atlas, or does the fact that I'm tinting the color of each sprite to a different value makes SSB useless?

2. This same chunks are map areas on my game, and I just need to be able to click on them. I've created polygon mesh for all of them, and selected Collider Cap = Front because I don't need the back. But I also don't need to detect collisions between the area maps themselves, just need to handle clicks (or touch events on case of mobile) on them. Is there a way to cap so that I only have "Front" and not the lateral collider that is typically needed for say side-scrollers ?

Thks in advance

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Performance questions
« Reply #1 on: November 11, 2013, 09:31:25 pm »
1. If you change the tints of the sprites dynamically every frame, then the SSB won't be a good choice here. Its quick to build though and you'll break even at some point with 1 SSB vs many sprites.

2. No. Just flag them not to collide with each other or anything else in the physics collider mask setup and that should sort it out.

pedronveloso

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Performance questions
« Reply #2 on: November 13, 2013, 04:25:45 pm »
1. If I place them in a SSB the SSB rebuild happens automatically during runtime everytime I re-tint my sprintes, or do I have to trigger it via code?

2. That's what I'm currently doing already. Thanks :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Performance questions
« Reply #3 on: November 13, 2013, 04:51:24 pm »
1. You have to update the SSB in code manually. The individual sprite game objects won't exist at runtime.