Search Unity

[RELEASED] Super Tilemap Editor

Discussion in 'Assets and Asset Store' started by CreativeSpore, Feb 21, 2016.

  1. Supergeek

    Supergeek

    Joined:
    Aug 13, 2010
    Posts:
    103
    Thanks, I'll follow up in the RPG Map Editor thread then.
     
  2. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    I'm confused how to accomplish something I'm trying to do. I have a mountain I'm drawing with a carpet brush. I'd like to have a ladder going up onto the mountain, but the brush behavior is prohibiting that. Here are before & after images:





    As you can see, adding the entrance causes the autotiling to treat as no longer part of the mountain. (The base of the mountain isn't drawn with a brush if that's relevant)

    I *think* brush groups might be the way to solve this, but I haven't been able to work out a configuration that works. Is there something I'm missing or another workaround? I tried adding the entrance to another tile map on top of the background tile map, but that creates collision issues.
     
  3. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there!
    Draw the rock wall around the mountain limits. And place it in a tilemap over the ground.
    I think you are using the same brush for the wall and the ground.
    upload_2016-7-23_19-3-39.png
     
  4. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    So does that mean I have to abandon the carpet brush for drawing the walls?
     
  5. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Use the road brush instead. You can use the carpet if the tile collider is full, like in my example, but if only a part or if has colliders, the colliders generated by the carpet brush won't work because it takes one of the tiles participating in the construction of a corner tile.
    If you can post the part of the tileset used for the top of the mountain I could help you more to decide a solution.
     
  6. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14


    The tiles are 16x16, so that top half portion is what I've been using as the carpet brush (also have some extra interior pieces not posted). Been drawing the bottom wall portion manually as necessary.
     
  7. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Ok, then follow these steps.

    • Set the brush Brush Autotiling Mode to Self and Other
    upload_2016-7-24_20-5-34.png

    Activating other, the brush will consider any other tile not empty for autotiling.
    So now, you can draw a ground tile and avoid the wall to surround it.
    But you have to draw the top part of the montain in a different layer, so the base of the mountain doesn't affect the autotiling of the top wall.
    • So you have to create two tilemaps, one for the top, and other for the base as you can see here
    upload_2016-7-24_20-9-38.png

    The TopLayer would be the highlighted area and the Ground the darken area.
     
  8. likwid

    likwid

    Joined:
    Apr 24, 2013
    Posts:
    16
    Any way to fully create a map at runtime? For procedurally generated levels, for example.

    Also, if I instantiate a TilemapGroup prefab during runtime, it is turning "Pixel Snap" off when it is added to the scene. I don't see a way to turn Pixel Snap back on through code for each map in the TilemapGroup.
     
    Last edited: Jul 24, 2016
  9. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    Ah, that solves my issue decently, thanks.

    Another question. I have a set of tiles like this:


    It's a 2x2 grid. What I'd ideally like to do is treat them as a subdivided carpet brush - where the tiles seen form the 4 corners, and the edges are generated by autotiling the mid-sections (ie: the top edge would be the top center of the image, basically cut from the center of the two top corner tiles).

    I've been digging into the brush system, and it *sounds* like this is possible, but not sure how it's handling the subdividing when a tile is made up of multiple tile parts - GetSubtiles, basically. Could you explain that a bit further?

    Worst case, I can cut up the art and make the tiles manually. It'd just be nice to not have to if I can write a bit of code to handle it.

    And while I've got your attention, here are some things on my wishlist that would be awesome to see added in future updates, in case you needed ideas. ;)
    - A way to tag a tile to default in a given tilemap group so I don't have to worry about swapping layers so often
    - A debug view so I can temporarily identify what tiles belong to which layers (maybe color certain layers)
    - A way to 'lock' the random tiles of a certain layer so that they don't get regenerated every time I refresh in case I like the look of a specific case (or in case I, say, update the game and don't want the view to change)
    - A way to use multiple tilesets for a single tile map
    - A quick way to drag the scene view while in tile edit mode. Currently I have to select something else to get my default camera controls back.
     
    Last edited: Jul 24, 2016
  10. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    You can see an example of a procedural level creation in the RogueLikeDemo scene. The tilemap group contains a script called RogueLikeMapGenerator that generates procedural map when calling the method GenerateMap. You can execute the method from inspector by right clicking the script and selecting the option.
    Don't forget to call tilemap.UpdateMesh() after making changes in a tilemap.

    For the pixel snap, add this property to the tilemap class in tilemap.cs file and set it to true after creating the tilemaps:
    Code (CSharp):
    1.  
    2. public bool PixelSnap
    3. {
    4.     get{return Material.HasProperty("PixelSnap") && Material.IsKeywordEnabled("PIXELSNAP_ON");}
    5.     set
    6.     {
    7.         if (Material.HasProperty("PixelSnap"))
    8.         {
    9.             Material.SetFloat("PixelSnap", value ? 1f : 0f);
    10.             if (value)
    11.             {
    12.                 Material.EnableKeyword("PIXELSNAP_ON");
    13.             }
    14.             else
    15.             {
    16.                 Material.DisableKeyword("PIXELSNAP_ON");
    17.             }
    18.         }
    19.     }
    20. }
    21.  
    I have fixed some prefab issues for next version, including the pixel snap being lost.
     
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    I'm glad I could help you ;)

    About the subtiles, the GetSubtiles should return an array of uints with the tileData to be used to paint each portion of the tile in this order: from bottom to top, from right to left. So only that portion of the tile will be used to build the final tile.
    upload_2016-7-25_12-8-36.png
    You have to adapt the the CarpetBrush, and check the A2x2Brush to see how to display only 4 tiles.
    Then, for each autotiling combination you have to return the right uint array with any of the 4 tiles for each subtile.
    If you see in CarpetBrush, there is an integer variable idx calculated through the autotiling check with each neighbor.
    This value will tell you the type of tile it is:
    Code (CSharp):
    1. int idx = 0;
    2. if (AutotileWith(brushId, brushIdTop)) idx = 1;
    3. if (AutotileWith(brushId, brushIdRight)) idx |= 2;
    4. if (AutotileWith(brushId, brushIdBottom)) idx |= 4;
    5. if (AutotileWith(brushId, brushIdLeft)) idx |= 8;
    6. // '°', '├', '═', '┤', | 0, 2, 10, 8,
    7. // '┬', '╔', '╦', '╗', | 4, 6, 14, 12,
    8. // '║', '╠', '╬', '╣', | 5, 7, 15, 13,
    9. // '┴', '╚', '╩', '╝', | 1, 3, 11, 9,
    For example, if the idx is 15 it will be a cross, autotiling with all neighbors.
    A 0 means, there is no neighbors.
    So with this ASCII scheme you can check all combinations you need.

    About the wishlist.
    I have added some of your requests in the next update:
    - A way to tag a tile to default in a given tilemap group so I don't have to worry about swapping layers so often
    Right now, a tile always considered to be in group Default if it is painted without using a brush. But I want to add a group property also for tiles.
    - A debug view so I can temporarily identify what tiles belong to which layers (maybe color certain layers)
    I have already added an option to highlight the selected layer in a tilemap group for next version
    - A way to 'lock' the random tiles of a certain layer so that they don't get regenerated every time I refresh in case I like the look of a specific case (or in case I, say, update the game and don't want the view to change)
    I will think about this.
    - A way to use multiple tilesets for a single tile map
    This is something I really want to do, and give more options like adding padding to the atlas texture.
    Probably soon there will be something like that.

    - A quick way to drag the scene view while in tile edit mode. Currently I have to select something else to get my default camera controls back.
    You can always drag the scene with the center mouse button.

    Thanks for your requests, it helps me to improve this tool ;)
     

    Attached Files:

  12. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    This is something I really want to do, and give more options like adding padding to the atlas texture.
    Probably soon there will be something like that.


    Consider adding "extrude" instead of padding, as it's much more beneficial - it helps reduce artifacts when zooming in/out considerably. Extrude takes the outside pixels of a single tile and extends them outward. Unity's texture packer has this feature as well as TexturePacker (it's so important I tracked down a Gimp plugin to apply it to the tilesets I purchased).
     
  13. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    Other things on my wishlist now that I've used the tool to create a more complex scene:

    - When creating a Polygon collider, it'd be nice to have an "Auto Fit" button that would evaluate the transparency in the tile and set the initial 4 collider points to be a bounding box around the actual image. Often I'll want to tweak that, but just as often I've found that's the collider I want.
    - It'd be nice to be able to multi-edit colliders. For instance, I have a table that is a 3x3 grid of tiles, and going through each tile manually to setup collider info is cumbersome. Not prohibitively bad (I'd prioritize this relatively low), but still not ideal.
    - Definitely want to reiterate my suggestion that I be able to tag tiles with which layer (tilemap group) they go into by default. I just had to toss an entire map because I accidentally put a ton of tiles on the wrong layer and it broke everything.
    - Hot keys to move to different tilemap groups
    - When I switch layers, even if they use the same tile set, the Tile Palette resets its position. Usually I'm switching layers because I realized I need to put something on a different layer, so preserving my position would be nice.
    - Half the time when I create a brush, it puts it in the root Assets folder instead of the folder I'm trying to use. I see you have code in your brush creation that tries to put it in the correct folder, it just... doesn't seem to always work. Not a big deal, just an annoyance.
    - I'd like to be able to quickly draw large chunks of tiles by pressing one position, holding a key, and pressing another position. I find myself defaulting to the Shift key to do this, which obviously doesn't work. Useful for long lines or big boxes.
    - I'd like to be able to select tiles already placed and move them to a different tilemap group in case I put them in the wrong layer (say I put them in the background layer but need to bump them into the foreground). Right now the workflow of deleting and replacing can be a bit cumbersome.

    It's already an awesome tool and definitely the best tile map editor I've found thus far. (Also I managed to get that 2x2 carpet brush to work in less than an hour, which wasn't so bad...). Just think there are some usability improvements that would really make editing go a lot faster.
     
  14. likwid

    likwid

    Joined:
    Apr 24, 2013
    Posts:
    16
    Having an issue trying to delete tiles at runtime. I'm able to easily change the tile using this code:
    Code (CSharp):
    1. Vector2 localPos = tilemap.transform.TransformPoint(transform.position);
    2. TileData data = new TileData();
    3. data.brushId = 0;
    4. data.tileId = 1;
    5. tilemap.SetTileData(localPos, data.BuildData());
    6. tilemap.Refresh ();
    But if I try to Erase the tile, using this code (localPos is the same as above), nothing happens. I don't think my localPosition is finding the correct tile.
    Code (CSharp):
    1. Vector2 localPos = tilemap.transform.TransformPoint(transform.position);
    2. tilemap.Erase (localPos);
    3. tilemap.Refresh ();

    What's the best way to get a tile's coordinates based on localPosition?
     
    Last edited: Jul 26, 2016
  15. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    "tilemap.Erase(localPos);" is calling "SetTileData( localPos, Tileset.k_TileData_Empty );"
    So probably you did something wrong.
    If you want to calculate the transform's position relative to the tilemap you should use:
    Code (CSharp):
    1.  
    2. Vector2 localPos = tilemap.transform.InverseTransformPoint(transform.position)
    3.  
    Now to take the grid coordinates you can use:
    Code (CSharp):
    1.  
    2. int gridX = BrushUtil.GetGridX(localPos, tilemap.CellSize);
    3. int gridY = BrushUtil.GetGridY(localPos, tilemap.CellSize);
    4.  
     
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Wow! that was a big wishlist :)
    I will take all of them into account, and here some commentaries about some of them:
    • You can multi-edit the tile colliders. Just select all the tiles you want to modify and all modifications you do in the Tile Property window will affect all of them.
    • I am not sure what do you mean about tagging tiles. Do you mean to highlight the tiles of the current selected layer?
    • With hot key to move to different tilemap groups, do you mean to different tilemaps inside the tilemap group?
    • The problem of the assets being created in the root assets folder happens when you don't create them by right clicking over the assets folder and selecting the option through the floating menu. But I fixed that changing my code for this one (thanks to this link):
    Code (CSharp):
    1. public static T CreateAssetInSelectedDirectory<T>(string name = null) where T : ScriptableObject
    2. {
    3.     var asset = ScriptableObject.CreateInstance<T>();
    4.     ProjectWindowUtil.CreateAsset(asset, "New " + typeof(T).Name + ".asset");
    5.     return asset;
    6. }
    • If you put tiles in the wrong layer, you can select them holding shift key. This will cut the tiles. Then you can select the right layer and place them on it.
    I'm also happy to hear how fast you managed to create a custom brush ;)
     
  17. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    So let's say I have two layers (tilemaps in a tilemap group): Background & Foreground. And I have a bookshelf that's several tiles high - some of those tiles go in Foreground so they obscure the character and then some of them go in Background and block character movement.

    Currently I have to mentally keep track of which tiles go in which layers. And just as often, I forget and have to rework things.

    It would be nice to be able to say "This tile always gets painted to the Background tilemap" and "this tile always gets painted to the Foreground." And then when I do the painting, the tiles get put in the appropriate tilemap without me having to worry about it.

    Maybe that's a new kind of brush or maybe it's a property on the tiles.

    Yup.

    --

    So I think a lot of my workflow suggestions boil down to this: it can be cumbersome to remember to switch to different tilemaps in a group at the right time, especially if you're using more than 2 layers, and messing it up can require a lot of reworking of the map. Right now my map has several layers: a background, a decoration layer, multiple object layers, and a foreground. A lot of my time is spent switching layers, remembering what goes in what layer, and fixing problems when I mess that up. Streamlining that would be a huge workflow boon.
     
  18. likwid

    likwid

    Joined:
    Apr 24, 2013
    Posts:
    16
    This seems to work, however I'm encountering this error when I Erase() a tile when my projectile hits it OnCollisionEnter2D:
    Code (CSharp):
    1. void OnCollisionEnter2D (Collision2D col) {
    2.         Tilemap tilemap = col.gameObject.GetComponentInParent<Tilemap>();
    3.         if (tilemap != null) {
    4.             Vector2 localPos = tilemap.transform.InverseTransformPoint (transform.position);
    5.             int gridX = BrushUtil.GetGridX(localPos, tilemap.CellSize);
    6.             int gridY = BrushUtil.GetGridY(localPos, tilemap.CellSize);
    7.             tilemap.Erase (gridX,gridY);
    8.             tilemap.UpdateMesh ();
    9.             Destroy (this.gameObject);
    10.         }
    11.     }
    Code (CSharp):
    1. Destroying components immediately is not permitted during physics trigger/contact, animation event callbacks or OnValidate. You must use Destroy instead.
    2. UnityEngine.Object:DestroyImmediate(Object)
    3. CreativeSpore.SuperTilemapEditor.TilemapChunk:FillColliderMeshData() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/TilemapChunk_Collider.cs:557)
    4. CreativeSpore.SuperTilemapEditor.TilemapChunk:UpdateColliders() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/TilemapChunk_Collider.cs:106)
    5. CreativeSpore.SuperTilemapEditor.Tilemap:UpdateMesh() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Tilemap.cs:663)
    6. Bullet:OnCollisionEnter2D(Collision2D) (at Assets/Scripts/Bullet.cs:46)

    Also, is there a way to set a unity "tag" on certain tiles? For example, I want all the ground tiles to use the Tag "Ground".
     
    Last edited: Jul 27, 2016
  19. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I will check this to fix the issue. Meanwhile, try moving the tilemap.UpdateMesh (); call into the OnDestroy method.
    About tagging tiles, you can only tag the tilemap, but tiles are not separated gameObject, all of them are part of a mesh, so it is not possible.
     
  20. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The tag on tiles would be tricky. Because the name of the tilemap is set by the user and there are some complicated use cases, like, what is the brush supposed to to if I create a tilemap named Ground and I try to paint a tile tagged Overlay.
    I think, this issues of missing the right layer could be fixed by highlighting the selected layer. What I did for next release is adding a Color Multiplier factor to be applied in all not selected layers, so instead of make the selected layer brighter I darken the unselected layers by multiplying this factor.
    It looks like this:
    https://twitter.com/CreativeSpore/status/758228529473523712
     
  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    New version of Super Tilemap Editor 1.3.6 available!

    Changelog:
    • Added an unselected color multiplier in the tilemap group to be multiplied by the unselected tilemaps tint color to highligh the selected tilemap
    • Added preview of tiles to be filled when using the fill tool
    • Added an option to disable Undo/Redo while painting, to improve the painting performance
    • Added multiediting support in tilemap inspector
    • Improvements in tilemap material management, now using Material Property Block, reducing the memory allocated.
    • Improvements in access to the tilemap data, using a dictionary for tilechunks
    • TileObjectBehaviour sets also tilemap sorting order and sorting layer were it is created
    • If only a single empty tile is selected from a tilemap, the brush will erase when painting
    • Fixed empty contacts array when receiving a collision event from a tileChunk with a MeshCollider
    • Fixed error when calling UpdateMesh for a tilemap during a collision event
    • Fixed issues when dragging a tilemap into a tilemap group
    • Fixed creating assets in the current project view, not in the root folder
    • Fixed some issues when creating a prefab of a tilemap or tilemap group
    • Fixed an issue selecting a tilemap from a tilemap group with a children that is not a tilemap
    • Fixed selecting an empty tile sets the selected tile to empty
    • Fixed updating the tileObjects transform when refreshing the tilemap after changing the CellSize
    • Fixed memory leaks when importing tmx maps
     
    bitbiome_llc likes this.
  22. Fab4

    Fab4

    Joined:
    Sep 30, 2012
    Posts:
    114
    Hi after upgrading I get the following error message
    any suggestions how to solve this.?
    I use 5.4
     
  23. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    I've just found it's a bug (or feature) of Unity 5.4.0f1 so the built-in material has to be found using the AssetDatabase while in the Editor.
    What I did to fix this was creating a new method in Tileset.cs:
    Code (CSharp):
    1.         Material FindDefaultSpriteMaterial()
    2.         {
    3. #if UNITY_EDITOR
    4.             return UnityEditor.AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Default.mat"); //fix: Unity 5.4.0f3 is not finding the material using Resources
    5. #else
    6.             return Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
    7. #endif
    8.         }
    And change the lines with this code:
    Code (CSharp):
    1. m_material = Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
    To call this method:
    Code (CSharp):
    1. m_material = FindDefaultSpriteMaterial();
    I will submit the fix in the next version.
     
    Fab4 likes this.
  24. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Hey there,

    this is not vital since it's just a test project where I'm trying to learn Corgi & STE.
    I just updated STE to the latest version and this happened:



    999+ of those errors:

    Failed to find Sprites-Default.mat
    UnityEngine.Resources:GetBuiltinResource(String)
    CreativeSpore.SuperTilemapEditor.Tilemap:get_Material() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Tilemap.cs:76)
    CreativeSpore.SuperTilemapEditor.BrushBehaviour:GetOrCreateBrush(Tilemap) (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Brush/BrushBehaviour.cs:107)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:_DoToolbarButton(Rect, eToolIcon) (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:854)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:DoToolBar() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:827)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:DoPaintInspector() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:493)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:OnSceneGUI() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:459)
    UnityEditor.DockArea:OnGUI()
     
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    Try the fix in my previous post ;)
     
  26. Fab4

    Fab4

    Joined:
    Sep 30, 2012
    Posts:
    114
    Sounds perfect. Thanks in advance
    great support :)
     
  27. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Well I guess that I'm to much of a n00b but... the instructions are not very clear to me :(

    Where exactly in Tileset.cs should I place that code big code?
    Also, about the code that has to be replaced, I only found that code in Tilemap.cs ... should I replace all those with that other code?
     
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    Don't worry, I will explain it better.

    You have to find these lines in the code:
    Code (CSharp):
    1. m_material = Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
    You should find 3 lines, in the Tileset.cs file.
    Remove the full line and copy this code instead:
    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR
    3.             m_material = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Default.mat");
    4. #else
    5.             m_material = Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
    6. #endif
    EDIT: This fix is only working in version 5.4.0f3, it's not working for other versions, so the code should be:
    Code (CSharp):
    1.  
    2. #if UNITY_EDITOR && UNITY_5_4
    3.             m_material = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Default.mat");
    4. #else
    5.             m_material = Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
    6. #endif
     
    Last edited: Aug 7, 2016
  29. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The new version of Super Tilemap Editor 1.3.7 has been released!
    I have fixed the issue with Unity 5.4.0 in this version, and more:
    • Performance improvements and reduction of memory allocations
    • Fixed some collider issues when using 2D colliders with PolygonCollider2D or when activating isTrigger
    • Fixed Sprites-Default material issue when using UNITY 5.4.0
    • Fixed Undo/Redo tilemap update
    • Fixed empty contacts array when receiving a collision with a tileChunk with a MeshCollider
     
    Fab4 likes this.
  30. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    544
    What's the different between Super Tilemap Editor and RPG Map Editor ?
    I'm making a game similar to stardew valley, which one the best i should choose ?
    Thank you.
     
  31. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    The differences are too many to list, but basically:
    • RPG Map Editor is a tilemap editor focused on using RPG Maker VX tilesets and the way they work, mostly with a ground layer for objects in the ground, a ground overlay layer for transparent tiles like flowers, etc, and an overlay layer to place tiles over the player (but you can add more layers if you want). RPG Map Editor also includes an RPG framework with the basics to have a player, enemies, path finding, vehicles, area transitions, map serialization in xml. etc.
    • Super Tilemap Editor: was made to be a general purpose tilemap editor. You have more flexibility to make any kind of game based on tiles, and it's more customizable.
    The tilemap core in both tools is almost the same, so they both are optimized for creating big maps and allow real-time edition with a high performance, even in mobiles.

    To make a game like Stardew Valley, RPG Map Editor would be my best choice. You have a framework to start with and the kind of tilemaps in the game will work very well with the RPG Maker tileset style.
     
  32. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    544
    Thanks! i will give it a try
    In RPG Map Editor, do we can only use RPG Maker VX tileset, like in the docs or we can use our custom tileset ?
    Can i slice the atlas 128x128 for the tileset ?
     
    Last edited: Aug 10, 2016
  33. outgunned

    outgunned

    Joined:
    Aug 12, 2016
    Posts:
    2
    Hi,

    I'm unable to use the editor as brush position resolving doesn't seem to work

    transform.position assign attempt for 'Brush' is not valid. Input position is { NaN, NaN, NaN }.

    Stack trace:
    UnityEngine.Transform:set_position(Vector3)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:DoPaintInspector() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:575)
    CreativeSpore.SuperTilemapEditor.TilemapEditor:OnSceneGUI() (at Assets/CreativeSpore/SuperTilemapEditor/Scripts/Tilemap/Editor/TilemapEditor.cs:459)

    Any ideas? Unity 5.4.0f3 (64-bit), Windows 10
     
  34. outgunned

    outgunned

    Joined:
    Aug 12, 2016
    Posts:
    2
    Magicly started working after deleting and re-creating the TileMap. I wonder what was causing this? :p
     
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I think is was because the tilemap CellSize had a component set to zero.
     
  36. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Hi! I'm having trouble trying to figure out positions of my rooms. I'll try to explain my problem as best as I can.

    Context:
    I'm using the RogueLikeTileset from the examples (TileRowLength 57)
    I've changed the Cell Size of the map to 3.2 (I don't undestand what this is for, but it made the map look bigger).

    What I'm trying to achieve:
    I'm making a random generated dungeon. I made 4 types of rooms and converted them to a prefab. I instantiate this prefabs randomly in a map.

    Problem:
    I need to know where the rooms are exactly positioned so I don't position other rooms overlaping with each other.
    I get the width and height of the room from MapBounds.size and I set the position by using transform.position.
    Then I used Debug.Drawline based on that position, width and height, where the map is supposed to be, but as you can see in the image, the map is not drawn where it tells me to be drawn.
    I thing that might be because of that Cell Size propertie, because as you can see the DrawLine is drawn from the center of the red square.
    Could you please help me understand why the map is drawn with that offset from the center of the cell size?

    tilemapproblem.png
     
  37. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    The CellSize is the size of a tile in Unity units. So a CellSize with value (1, 1) will create tiles with the size of a Unity unit.
    The red lines you are showing in the screenshot are the chunks of tiles. The tilemap is divided in chunks of 60x60 tiles because there is a limit in the number of vertices a mesh can have. So each time a tilemap chunks is created, because there is at least a tile on it, the red lines will appear. The tile grid is drawn with white lines.

    To create a dungeon with random rooms, you have to draw all the rooms with the bottom left corner at position (0, 0).
    You can see the current brush position on the top left corner while paining.
    This way, the room position is always the same and the performance is better because you don't use more than one tilemap chunk for the room.

    To avoid mistakes, you can set the size of the room before painting and disable "Allow Painting outside bounds"
    upload_2016-8-12_19-53-18.png

    Now all rooms have the same offset position set at (0, 0) you can use this code to place them in the dungeon.
    Code (CSharp):
    1. void PlaceRoom(Tilemap roomTilemap, int roomX, int roomY)
    2. {
    3.     Vector2 roomSize = roomTilemap.MapBounds.size;
    4.     transform.position = new Vector2(roomSize.x * roomX, roomSize.y * roomY);
    5. }
     
  38. grogshotgames

    grogshotgames

    Joined:
    Aug 6, 2015
    Posts:
    77
    Thanks for your answer! It worked now. Also you should add that info to the documentation, it's really useful :)
     
  39. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    You are welcome ;) I will add this in the documentation.
     
  40. goranobradovic

    goranobradovic

    Joined:
    Mar 11, 2014
    Posts:
    16
    Thank you for the great asset. Like many others, I am trying to combine Super Tilemap, Corgi engine and Spine for my game.

    Question about Tiled (TMX) import - I was successful in importing some of my TMX files but I am not sure about animations and colliders. Are those features supported by the importer? I have tried with simple animation and some colliders but it looks like Super Tilemap does not import those. Actually, with animation present in one of TMX files I got error in Unity when importing ("Object not set to reference ....").
     
  41. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Thank you for supporting this tool ;)
    I am thinking to give support for animations and tile properties when importing from tmx.
    I will check that error. Probably is because there is a missing data member in a class.
     
  42. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    I've used this for a few significant sized maps now, and here are some revised thoughts:
    - I'd really like a line / quad fill, perhaps by holding some key and clicking on two points. I find that both with my mouse and touchpad, I make a bunch of mistakes filling spaces that I then have to correct.
    - Having the ability to pan the camera without the need for the 3rd mouse button would be nice while a tilemap is selected. I develop on laptops a lot, and it's hard to use without a mouse. There may be a way to hook some shortcut up in Unity, not sure.
    - Multi-layer cut & paste would be good if possible. There are times when I want to squish an entire map or make a large hallway less wide, but I can't do that without modifying a bunch of layers.
    - It'd be cool to have an "arbitrary" brush that has a variable number of cells, and each cell can be on a different layer - leave it up to the developer to worry about layer naming and such. I find that I have a lot of 2-tile high objects where one tile belongs on the background and one on the foreground, and it'd be good to just be able to drop those down thoughtlessly. The multi-layer cut & paste would also solve this problem adequately.

    Some of these are echoes of previous suggestions, I think.

    Overall, this is still treating me really well, and I recommend it to people looking for a good Unity tilemap editor.
     
  43. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    I have already thought about adding more painting modes, like rect, filled rect, ellipse and filled elipse, line... I hope they will be available soon.
    About the problem with middle mouse, I have change the painting method to paint only when Rect Tool (T) is selected. So pressing W (Move tool) will allow dragging and pressing T will allow painting again (also pressing any toolbar button).
    You can add this line to achieve the same until next version is released:
    || (Tools.current != Tool.Rect && Tools.current != Tool.None) in TilemapEditor.cs line: 497
    Code (CSharp):
    1. private void DoPaintSceneGUI()
    2. {
    3.     Event e = Event.current;          
    4.  
    5.     Tilemap tilemap = (Tilemap)target;
    6.  
    7.     if (DoToolBar()
    8.         || DragAndDrop.objectReferences.Length > 0 // hide brush when user is dragging a prefab into the scene
    9.         || EditorWindow.mouseOverWindow != SceneView.currentDrawingSceneView // hide brush when it's not over the scene view
    10.         || (Tools.current != Tool.Rect && Tools.current != Tool.None) // allow painting only if the selected tool is Rect or None
    11.         )
    12.     {
    13.         m_brushVisible = false;
    14.         SceneView.RepaintAll();
    15.         return;
    16.     }
    17. .....
    18. }
    I'm also working on multi layer selection.
    Once I have the multi layer selection, I will try to add the option so when you drag a tilemap group prefab into the scene, it becomes the new brush selection. This is a little tricky because I have to deal with cases like different number of layers or with different names. But I will see what I get.
    And thank you for recommending this tool ;)
     
  44. bdsowers

    bdsowers

    Joined:
    Oct 11, 2014
    Posts:
    14
    Running into a problem with "phantom tiles". Check out the following screenshot:

    Those faded tiles near the top right shouldn't be there. I didn't draw them there. When I select the root Tilemap Group or any specific layer, they vanish. Then they often vanish for the duration of editing. However, if I then close the scene and return, they're back again.

    Wouldn't be a big issue if it were only in edit mode, but they showed up in play mode as well. Suspect there's some stale data laying around that isn't getting removed.
     
  45. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    It looks like the painting brush. If you select some tiles and press play with a tilemap selected in painting mode, the brush won't disappear.
    Try unselecting the tilemap before pressing play. I have fixed this issue in the next release, so the brush is destroyed when you press play to avoid it to appear in this case.
     
  46. freedow

    freedow

    Joined:
    Aug 22, 2016
    Posts:
    1
    I have a 32x32 map and two tilesets with different sizes (32x32 and 64x64) and when I create a tileset from the tmx files it creates a single tileset 32x32. Is there any way to import as different tileset files? Or any way to import a tmx using different tilesets?
     
  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The tilemaps in STE use a Mesh to render the tiles using a material with a main texture (the texture with the tiles or tileset atlas). A tileset can only have texture because only a texture can be the main texture.
    For these reason when a tileset is created, a single tile size should be used.
    The TMX importer now take the tile size from the first tileset, and expect all other tilesets to have the same tile size.
    I could maybe manage to create tiles with different uv so each tile will have different resolution but at the end, in the final tilemap, all tiles will have the same size (the cell size specified in the tilemap).
    But if the tilesets are used in different layers I could manage to create the tilemaps with the right cell size for the tiles contained on it.
    If this is the case, and you can send me a tmx example I can work with, I will try to make these changes.

    Checking the code, maybe you can make a simple modification to achieve this:
    change the line TmxImporter.cs 78 for this one:
    Code (CSharp):
    1. Vector2 tileSize = new Vector2(tilemap.Map.Tilesets[tilesetIdx].TileWidth, tilemap.Map.Tilesets[tilesetIdx].TileHeight);
     
    Last edited: Aug 22, 2016
  48. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    New version of Super Tilemap Editor v1.3.8 will be available soon.
    EDIT: It has been released just now ;)

    One of the main fixes in this version is one related with the destruction of the Sprites-Default material due a mistake (previously I was using different material instances that should be destroyed but I changed this when using the built-in material Sprites-Default)
    This is destroying the Sprites-Default and all sprites are rendered with pink textures when the game is executed in a build and a tilemap is destroyed, for example, loading another level.

    Until the version is released this is the modification that should be made in the Tilemap.OnDestroy method:
    Code (CSharp):
    1.         void OnDestroy()
    2.         {
    3. #if UNITY_EDITOR
    4.             if (m_material && m_material.hideFlags == HideFlags.DontSave && !AssetDatabase.Contains(m_material))
    5.             {
    6.                 //avoid memory leak
    7.                 DestroyImmediate(m_material);
    8.             }
    9. #endif
    10.         }
    11.  
    This is the complete changelog:
    • Improved BrushUtil.GetGridX and BrushUtil.GetGridY precision
    • Added DisableTilePrefabCreation to tilemap class to disable the creation of tile prefabs
    • View Mode has been replaced for a popup list where you can select the tileview
    • Now the tile palette keeps the state between tilemaps using the same tileset
    • Now, to paint a tilemap, the Rect tool (T) should be selected, allowing rotating, scaling and dragging when other tool is selected
    • Added Auto-Shrink option to Map section of a tilemap
    • Fixed issue when changing the Autotiling Mode or Group of a brush was resetting the selected tiles
    • Fixed removing tilemap brush when loading the scene (to avoid seeing the brush ghost in play by mistake)
    • Fixed destruction of the tilemap material when the tilemap is destroyed if this material is an asset
    • Fixed some cases where a tilemap chunk was in the wrong position (0,0,0) and tile prefabs were instantiated in the wrong place
    • Fixed a warning error when editing the map bounds using the handles
    • Fixed Shrink Map issues when using tiles with a prefab if the tilemap object is selected
     
    Last edited: Aug 24, 2016
    bitbiome_llc likes this.
  49. Shodan0101

    Shodan0101

    Joined:
    Mar 18, 2013
    Posts:
    141
    Hi CreativeSpore,

    Awesome asset, I just have a question can you create Parallax Backgrounds "layers" for your titles. So you have an foreground and a background "parallax effect"?
     
  50. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    The code to create a parallax in not included in the asset. But you can create a tilemap and attach a script to move it according to the camera position.
    A tilemap is like a plane, it can be translated, rotated and scaled without any problem.
     
    Shodan0101 likes this.