Hello Guest

Author Topic: Loading times on Tilemaps  (Read 3969 times)

spr

  • Newbie
  • *
  • Posts: 2
    • View Profile
Loading times on Tilemaps
« on: January 23, 2014, 06:02:50 am »
Hey there,

I'm still very new to 2dtk and I'd really like to know if this is normal.
I am developing for Android currently and did experience some really long loading times.
In the end the tilemap turned out to be the 'problem', so I ran a few scenarios through my phone (Samsung Galaxy S2)

The Testing Scene did only have 1 Camera and the tilemap attached. I only used one sprite over the whole tilemap with a box collider attached.

No Map at all (0x0) = Around 1 second loading time
My Standard Map (128x128) = Around 20 seconds <-- Way too long for me/Average mobile phone gamer
Half of the planned Map (64x64) = Around 5,5 seconds <-- Acceptable, but map is kind of small
Big Map (512x512) = Over 3 Minutes, I quit at that point.

So I would really like to go with my Standard Map Scenario, but the loading time just is not good enough. The player has the option to choose from several maps, so I'm afraid I cannot load the level async ahead of time. Is there anything I'm missing here? Anything I could optimize?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Loading times on Tilemaps
« Reply #1 on: January 23, 2014, 11:04:13 am »
Is your tile map committed before you build for your platform? If it isn't it will be building the tile map at load time as opposed to simply loading the built tile map meshes, which will be quite slow. If you use platform collections, it will build every time - I'd turn off platforms to see if the performance is acceptable before proceeding.

Run the profiler to see what takes the most time. If all the data is ready (based on the criteria above), there should be very little computation at runtime. You shouldn't see tileMap.Build in the profiler. If you do, please check the above and look at the debug output to see if there are any messages

spr

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Loading times on Tilemaps
« Reply #2 on: January 24, 2014, 02:36:21 am »
Hi!

Thanks for your help! :)

The tilemap indeed was not commited, but that only reduced the loading speed by about 0.2 seconds on the half size map, and around 1 second on the 128x128 map. I do not use the Platform Collections either.

The top 3 in my Profiler were:

Overhead 63.2%
Camera.Render 14.2%
Graphics.Present 5.7%

Cleared right before the loading and stopped right after. I couldn't seem to find anything called tilemap.Build.

When I delete the tilemap again the profiler stats stay at about the same, the scene loads in under one second though.

Any Idea?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Loading times on Tilemaps
« Reply #3 on: January 24, 2014, 11:36:04 am »
How many ms for that frame? The percentages don't really mean anything without the total time to put it in context. Is the spike just for one frame?

How big is your partition size? How many layers.
Do you have prefabs turned on in the level?
How many game objects are there in your scene after committing?
Try on another device, ideally different architecture to rule out some device specific issue.

Try a deep profile to see if you can narrow this down further. My guesses are:
1. vertex upload time. This could be driver overhead here, and reproducible with a normal similarly high poly mesh in Unity.
2. game object creation time. Unlikely but it could be the case if you have far too many of them.