2D Toolkit Forum

2D Toolkit => Support => Topic started by: Aorata on July 11, 2012, 11:44:34 pm

Title: Tile map problems
Post by: Aorata on July 11, 2012, 11:44:34 pm
I'm not sure if it's not supported or if I'm being stupid.

I want to use a full size image of a platform to break into separate tiles and build from that.
That way, if I want to extend the platform, I can duplicate many tiles of the middle section.

Like this:
Full platform breakdown into> Corner -center - Corner   so I can duplicante "centers" and make> Corner - center - center- center- Corner

However, when I have a spritecollection with the full size image, I can't do the breakdown...

So I though, I'll just make a sprite collection of the already separated 64x64 images and then build from that... My platform is built out of 22 separate tiles. If I could arrange them somehow, all would be perfect, but when I import them to the tile map editor, the order gets scrambled into something that doesn't make sense to me...

And making each platform one by one without being able to select 6x tiles at the same time, is just no good.

I hope I made myself clear, english is not my first language. I'll be happy to repost if something is not understood.

Thanks!
Title: Re: Tile map problems
Post by: unikronsoftware on July 11, 2012, 11:54:16 pm
Have you tried importing the texture into the sprite collection as a SpriteSheet (New > Sprite Sheet). It was built to solve this very problem.
Also, once you've created your tilemap, in settings > palette properties, adjust tiles per row so it will match your original spritesheet.

Hope that helps. If I didn't get what you meant, please post some pics to explain.
Title: Re: Tile map problems
Post by: Aorata on July 12, 2012, 05:10:06 pm
No I haven't, so I am being stupid.

And I'm going to continue with my stupidity.

You said I should import the texture into the sprite collection as a SpriteSheet... I don't know how to do that. What I did was create the SpriteSheet and just drag the textures into it.

I know, from inside the SpriteSheet editor I can create a SpriteSheet that will be called New Sprite Sheet, but I don't know how to import or edit the tiles there.

If there is a manual on how to do it, or if you can explain it I would be veeery grateful.

Thanks a lot!
Title: Re: Tile map problems
Post by: unikronsoftware on July 12, 2012, 05:20:09 pm
Hope this helps -
http://unikronsoftware.com/2dtoolkit/doc/tutorial/Importing_a_spritesheet.html
Title: Re: Tile map problems
Post by: Aorata on July 12, 2012, 05:28:38 pm
I read that, if I understand correctly, I can import a spriteSheet created in another program like zwoptex? But I can't do the editing within 2dtoolkit.
Am I mistaken?

Thanks
Title: Re: Tile map problems
Post by: unikronsoftware on July 12, 2012, 05:32:02 pm
Not really. You can import evenly divided spritesheets, like the one in the doc page.
You can't import complex spritesheets in yet.
Title: Re: Tile map problems
Post by: Aorata on July 12, 2012, 06:37:56 pm
So I was being stupid.
All solved.
Thanks a lot!
Title: Re: Tile map problems
Post by: unikronsoftware on July 12, 2012, 06:40:40 pm
Glad its sorted!
Title: Re: Tile map problems
Post by: fsadeq on July 16, 2012, 03:14:01 am
I'm using this method for my tilemaps, and I'm wondering why the transparent tiles in the palette have a white fill in the transparent area? Of course they are using transparent shaders, and the tiles look completely fine when I paint them, but it is a little distracting having that mess in the palette. Is there something I'm missing? Thanks.
Title: Re: Tile map problems
Post by: unikronsoftware on July 16, 2012, 08:10:15 am
They should look the same, they use the same shaders. What version are you running? I fixed a bug in 1.76b2 where incorrect vcolors meant you got some weird behaviour sometimes. Also could you post a pic of this so I there isn't any confusion as to what were talking about?
Title: Re: Tile map problems
Post by: fsadeq on July 16, 2012, 11:54:06 am
I'm using the latest you posted. I don't have access to the project now, but if you look at the picture here http://unikronsoftware.com/2dtoolkit/doc/tilemap/Tutorial.html at step number 6, the space around the triangle or the flag for example would be filled white instead of transparent.
Title: Re: Tile map problems
Post by: unikronsoftware on July 16, 2012, 09:51:13 pm
Thats really strange (and unexpected). The code actually uses the exact geometry drawn in game in the palette, and uses the same shaders. Something must be going horribly wrong. Do you have premultiplied alpha enabled on your sprite collection, or a custom shader?
Title: Re: Tile map problems
Post by: fsadeq on July 16, 2012, 10:32:37 pm
I don't have premultiplied alpha on and am using both the included SolidVertex and BlendedVertex shaders. Strange thing is that I am not noticing this problem with tilemaps using sprite collections without sprite sheets, only the ones with them. When I turn on premultiplied alpha, the transparent ares fill black instead of white. Also, to clarify, I am not noticing this in either the the sprite collection editor or the final render data, only in the tilemap palette.

Maybe there is something completely obvious that I am overlooking? I will try re-creating from scratch.

Also, probably completely unrelated, but I've gotten this error two or three times. Not sure what I did to get it:

Code: [Select]
ArgumentException: Getting control 4's position in a group with only 4 controls when doing mouseUp
Aborting
UnityEngine.GUILayoutGroup.GetNext ()
UnityEngine.GUILayoutUtility.DoGetRect (Single minWidth, Single maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options)
UnityEngine.GUILayoutUtility.GetRect (Single width, Single height, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options)
UnityEngine.GUILayout.Space (Single pixels)
tk2dTileMapEditor.DrawTileDataSetupPanel () (at Assets/TK2DROOT/tk2d/Editor/Tilemap/tk2dTileMapEditor.cs:240)
tk2dTileMapEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2d/Editor/Tilemap/tk2dTileMapEditor.cs:1021)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
UnityEditor.InspectorWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Title: Re: Tile map problems
Post by: unikronsoftware on July 17, 2012, 10:26:52 am
Which tilemap editor view were you on when you got that?
Title: Re: Tile map problems
Post by: fsadeq on July 17, 2012, 11:59:52 am
Honestly don't remember, I didn't see it immediately. But I think paint mode.
Title: Re: Tile map problems
Post by: unikronsoftware on July 17, 2012, 12:25:04 pm
I'll dig around a bit see if I can figure out what went wrong.
Title: Re: Tile map problems
Post by: fsadeq on July 25, 2012, 02:23:25 pm
I know you're swarmed with questions, but did you ever figure out why the tilemap palette would be rendered differently from the actual placed tile? Thanks.
Title: Re: Tile map problems
Post by: unikronsoftware on July 25, 2012, 06:18:09 pm
Differently how? A screenshot would really help.
Title: Re: Tile map problems
Post by: fsadeq on July 25, 2012, 07:47:27 pm
Sorry, was referring to my original question earlier in the thread: http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,453.msg2146.html#msg2146
Regarding the transparent parts of a tile being rendered solid white in the palette.
Title: Re: Tile map problems
Post by: unikronsoftware on July 25, 2012, 11:19:54 pm
It should render correctly - I've not seen any case so far where it doesn't. Would it be possible to get me a repro case for this? You can delete the contents of the textures if you want, I don't need them. Just anything which can show me the issue.
Title: Re: Tile map problems
Post by: fsadeq on July 28, 2012, 02:35:14 am
Ok, I've figured out the problem. This only happens when using a sprite sheet in a collection. Once you have sliced the texture and are in edit mode, if you have two different materials (one solid, one transparent) being used in the sprite collection, then once in the Tilemap Editor, it will render the tiles in the palette as if they all have a solid material. This only affects the palette, and once you place the tile, it renders correctly. The palette renders correctly if you only have one transparent material being used.

So you can check this out for yourself:

-Make a new sprite collection
-Add a sprite sheet that has some transparent tiles
-Slice, apply the config settings
-In the settings, use the default material which uses a transparent shader
-Use the collection in a tilemap editor and notice the palette should be rendering the tiles transparencies correctly

-Go back to the sprite collection and add a new material, making it solid
-Change one of the tiles to use the solid material
-Commit changes, go back to the tilemap editor, now all the tiles in the palette are rendered as solid
Title: Re: Tile map problems
Post by: unikronsoftware on July 28, 2012, 09:32:53 pm
Thanks for the thorough repro steps.

Once you said you had different materials, I instantly knew what it was - I should've caught it sooner actually. The tile preview uses the first material in the list as initially the tilemap only supported one material initially, and I forgot to update this when adding support for multiple materials. I'll sort this out.
Title: Re: Tile map problems
Post by: unikronsoftware on July 28, 2012, 11:50:34 pm
That's fixed now. Drop me an email and I'll give you a patch.