Hello Guest

Author Topic: Quick question regarding tiles  (Read 4592 times)

Sparkky

  • Newbie
  • *
  • Posts: 1
    • View Profile
Quick question regarding tiles
« on: October 23, 2012, 10:58:25 pm »
My group is looking to switch over to Unity to from our own C# based engine to take advantage so this whole "multi-platform" thing people keep talking about ;) and I just had some questions I couldn't find on the Asset store or on the page for this product.

One of the requirements we have is being able load and run large tilemaps. So for example in our current engine we have 10,000 x 10,000 tilemaps being rendered in small chunks as the camera moves around. We're looking at ~100x100 tiles being displayed on the screen absolute worst case scenario.

Will 2d Toolkit be able to right out of the box (or with a little bit of work) be able to handle rendering a tile map from a 2d array? And does it have any sort of "only render or care about what's on the screen" without huge overhead (an issue we're hitting with other solutions).

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Quick question regarding tiles
« Reply #1 on: October 23, 2012, 11:34:56 pm »
Hi Sparkky,

You can run large tilemaps perfectly fine, limited by the size of the mesh in memory right now (2D Toolkit doesn't stream tilemap geometry in or generate data on as the camera moves).

It splits up your tilemap into chunks by default - so if you had a 512x512 tilemap with 32x32 chunks, each chunk will be built out of 32x32 tiles. Each chunk is a separate renderable elemtent, so those not visible will get culled out. tk2d also will not generate data for empty chunks.

Having said that though, 10k x 10k tiles is rather large though. Fully populated, that would be 400,000,000 vertices. It shouldn't be a problem to render (depends entirely on how fast Unity culls objects), but memory cost would be far too prohibitive. If you were going for something that big, I suggest setting up different scenes and streaming them in and out for various parts of the world. Obviously it won't be a problem if you dont fully populate the map.

If you don't care about collider meshes, it should be possible to make it "stream" (generate mesh data on the fly) with a few changes here and there - I'd probably be able to help / point in the right direction there. Generating collider mesh data is far too expensive to do at runtime.

So yeah, the answer to your question isn't that straightforward.
Anyway, hope that helps. Feel free to ask if you have any further questions.