Hello Guest

Author Topic: Zoomable Level - Best Practices  (Read 5554 times)

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Zoomable Level - Best Practices
« on: March 12, 2013, 04:33:40 pm »
I have an idea for an app that would include the ability to pan, rotate, and zoom into the level like many games do.

I have a few questions about best practices when planning how this is setup. See attached image as reference.

1) I would like my zoom to vary between showing the whole map to zooming into about 200%. So the landscape would be twice as larger and the viewer would be closer to the action. How can I even begin to support this idea with HD graphics on retina displays? To have the level viewable all at once, it basically needs to be nearly 2048 tall already, but then I want to be able to get 200% closer, meaning it will have to be HUGE. Any tips or tricks to avoid having MASSIVE images?

2) Is 2DToolKit a good fit for this idea? Should I explore something like Rage tools?

3) I've tried some brief tests using the dicing feature. This does help, but I was wondering if there's a to not only eliminate blank space, but also slices that end up being identical. For instance when I dice the attached image (leaving out the blue, and making it transparent) I get many slices, representing the inner portion of the island, that are the same. How could I optimize this?

I guess I'm looking both for specific answers, and hopefully some tips to point me in the right direction for creating a level that is able to use panning, rotation, and zoom, all with support for HD devices such as iPad 3.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #1 on: March 12, 2013, 05:33:37 pm »
If your level is as simple as the screenshot there, then perhaps RageTools could work better for you. You can obviously mix and match, use RageTools for the large scale detail and then add tk2d sprites for detail. You can even get them to batch if you use the same shader on both objects.

Matching identical textures in the atlas (for dicing, and also when not dicing) has been in my todo for a long while now. There are very obvious uses for that, but I've not got around to it. It will obviously help in this massively, and let you get away with much larger textures than you would normally. The other thing which has been in my todo is manually drawing partitions for dicing. There are certain things which can be optimized manually much much better than an automatic algorithm can.


dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #2 on: March 13, 2013, 06:16:24 pm »
What would be the recommended way to pan/rotate/zoom? I come from Flash development where we didn't have cameras. So I am accustomed, and it makes sense to me, to have a game object that contains everything and move/rotate/scale that.

Is this bad? should I instead be transforming the camera?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #3 on: March 13, 2013, 06:18:32 pm »
Its more efficient to transform the camera.
When you move the camera, Unity knows the world hasn't moved, but when you move a hierarchy of objects, they all need to be updated.

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #4 on: March 13, 2013, 07:31:11 pm »
is adjusting the orthographic size of the tk2dCamera the recommended way to achieve zooming in and out?

How will this affect the benefits of using tk2dCamera such as the auto scaling and such?

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #5 on: March 13, 2013, 07:40:13 pm »
Actually I see that doesn't do anything. Do I need to NOT use tk2dCamera for this?

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #6 on: March 13, 2013, 07:52:53 pm »
Sorry for so many posts, and sorry for bothering you. I have found the zoomScale property.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Zoomable Level - Best Practices
« Reply #7 on: March 13, 2013, 09:05:11 pm »
To answer your previous question, it really doesn't matter if you want to use tk2dCamera or not - the main deciding factor in that choice should be, do you want 1 world unit = 1 pixel? If the answer is yes, then the tk2dCamera is your best choice.