Hello Guest

Author Topic: Getting my work flow with the tilemap, need help with figuring out 4 things...  (Read 6513 times)

codejoy

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
I took the plunge and got this 2d toolkit in hopes of solving my slow down issues with my 2d game running on Ouya.    I am spending my saturday night trying to mash it into all the code I have had running in my old game (one that loaded from TMX levels).  I ditched loading from tmx levels and am just trying to get this working from the ground up.  I can start drawing a map...but two things that I need to get my workflow back is this:

a) I see where I can set a physics2d material, this is great but it sets ita cross the map, I want to split the colliders up later so I can cordon off various parts of the colliders with different materials.
b) Then I also have sprite/diffuse material of various colors/settings/ I would like to apply to some tiles and not others.  How can I do this after (or before) I build the map?
c)  Finally, I like a parallaxing effect can I get this with the tilemap editor and some magic with the orthographic camera? Or can I set it to perspective and some how arrange various layers to do this effect automatically?
d)  how can i go back and edit/muck with a sprite collection and sprite sheet.  I think I selected bilinear and want point filtering but cannot find out where to find/set that again so mypainted tiles are painting with blinear tiles...just cannot figure out what item i need selected for the menu to show up or where the menu is.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
a - Split them up using layers. One of the reasons the tk2d tilemap can be really fast is that it merges everything into one larger mesh, same applies to physics. You can work around that by using layers.
b - The easiest option is to use vertex painting in the tilemap editor, but if that doesn't work for you, you can add the same sprite twice in a sprite collection and override the material on the second sprite. It might be cheaper to create multiple copies of the texture though, as you get a significant perf boost from batching.
c - Use a combination of layers, z offsets between layers and a perspective camera.
d - Open up the sprite collection editor, you'll find the filtering in the settings page.

codejoy

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Thanks for the fast reply, still learning the system (dove right in).

a)  This makes perfect sense, do many layers increase draw calls?  Just still investigating this first time I have had to optimize a game.

b) When you say vertex painting is that the Color option on the Tile map script? (The same as in the painting color demo?) .  Mostly the sprite/diffuse material i had was so that point lights would react to various parts of the level...I will have to research this more.

c)  Had to toggle the fixed z, got it :) ty!

d) I feel very dumb, I see the sprite collection tab I have but nothing is in it? (And I did build a sprite collection with a sprite sheet for the tile map) just nothing shows up... i must be looking in the wrong spot will keep hunting.

Thanks again, so far it isn't as bad to integrate now that I know a bit more on it.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
d - its in the sprite collection editor. Open up the sprite collection editor, its in the settings page.

codejoy

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
I think I am having problems because of where my png is located on opening the sprite collection.


if I see the collection where I created it in Assets/TileMaps
I can select that, then I goto SpriteCollection tab, it has a warning:
The following assets are in one or more resources directories.
These files will be included in the build.

I cannot dismiss this warning, no option for settings comes up and below that is just a text bar with the circle selector to it , the text bar has the name of the png file:

icecave-tiles.png

Though I do realize where I created the sprite collection below that has a folder (same name as sprite collection) and in that it has two atlas files and another SpriteCollection data object?  I can open this and have it change the filter mode.  I also see a material under sprite definitions, changing seems to not do anything.

*though again selecting things from the hierarchy and changing the material on the chunks, does work? *


I did just do a test level, its still doing 15 draw calls none saved by batching so I am guessing in all my mucking i broke the batching :(  Was doing faster though, fewer verts.  and I can go from 30fps up to about 50 if i dont do that sprite/diffuse material in the chunks, and use what was originally there... (though I of course lose all lighting effects)


Shane



« Last Edit: November 10, 2014, 02:31:15 am by codejoy »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Quote
The following assets are in one or more resources directories.
This means the asset (icecave-tiles.png) is in a directory called resources or is under a directory called resources. It shouldn't...

Quote
Filter mode
Select the sprite collection object, click edit and find it as seen in the screenshot in the docs
http://2dtoolkit.com/docs/latest/reference/sprite_collection.html

Quote
I did just do a test level, its still doing 15 draw calls none saved by batching so I am guessing in all my mucking i broke the batching :(  Was doing faster though, fewer verts.  and I can go from 30fps up to about 50 if i dont do that sprite/diffuse material in the chunks, and use what was originally there... (though I of course lose all lighting effects)

How many layers, how big are your partitions, how many visible at a time? I don't know what you're dealing with here... Post some screenshots maybe and I could spot some issue? tk2d splits up your tilemap into chunks, each chunk is by default 32x32, so if you had 3 chunks visible vertically and 5 horizontally, you'd get 15 draw calls. Not bad though, as it will have maximised throughput there. In that case you should have around 30k tris. If you're getting crappy lighting quality it implies you're massively vertex bound. Splitting up chunks more could potentially help there, but you'll be trading off additional draw calls there.