Search Unity

[RELEASED] Super Tilemap Editor

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

  1. vambier

    vambier

    Joined:
    Oct 1, 2012
    Posts:
    102

    No problem:) So I have to paint the tiles first in the tilemap, then select them, and then "Add Brush Selection". That works, might be a good idea to add that to the manual since it wasn't clear to me that it worked that way. But it works, thanks!!
    Now if I would want to add tiles to an existing view do I have to paint the existing view in the tilemap, add the new tiles, then select and create a new view from that selection?
    That seems a bit more complicated than it needs to be. Would it be an idea to make the selection in the Tile Palette and create a new view from there. And maybe also add functionallity to add new tiles to a view from within the Tile Palette?
     
    Last edited: Feb 24, 2020
  2. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Ok, so I guess you mean you want to use a different sound per tile (not per tilemap). In that case, you can use Tile Parameters to add an Object parameter to the tiles with the AudioClip you want to play. Instead of using colliders for this, you can use this method:
    Code (CSharp):
    1.  
    2. AudioClip audioClip = TilemapUtils.GetTileParameter<AudioClip>(tilemap, player.transform.position, "footSound");
    I have attached a package update that will be included in the next update of STE including this new helper method.
     

    Attached Files:

    gferrari likes this.
  3. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    You can also select the tiles from the tileset palette to create a view from that selection. But adding tiles functionality could be tricky to achieve. The idea is to save a rectangular selection as a view (from a tileset palette or from a tilemap).
    If you want to speed up the process, you could reserve an area in the tileset atlas for some type of tiles, like terrain, and add the tiles on that area and make a view from the whole area.
     
  4. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hi! I have 2 questions
    1) Have I a method to get neighbours. Like Tile.GetNeighbours(); ?
    2) I'm using the pathfinder (work perfect) but I need a idea how to resolve this issue. I have a NCP and he move around the map, I want the pathfinder detect and avoid the NCP. Maybe with a param in the tile and set blocked when he move, and the previous blocked false?

    Thanks!
     
  5. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there!
    1) No, there is no method for that, but in RoadBrush you can see how to get the neighbour tiles.
    2) You can use the physic raycasting to add other elements that blocks the player:
    upload_2020-2-25_11-2-46.png
     
    gferrari likes this.
  6. war76mm

    war76mm

    Joined:
    Jan 20, 2020
    Posts:
    10
    Hi, do you have any plans to add support for hexagon tile maps? Searched the thread but didn't find anything...
     
  7. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    At the moment I have no plans to add support for hexagon tilemaps.
     
  8. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    42
    Hello! I'm adding a feature to my game where enemies can leave trails of slime and whatnot, and I'm planning to do this with a custom brush that checks all surrounding neighbour tiles (including diagonals) and places down the correct 'goop' tile accordingly. I'm currently using a modified '47 ' brush, and the idea is to update the tilemesh every frame and place goop down at (multiple) character positions, and I think I'll need to make modifications to my local STE copy to do this in a performant manner! I just wanted to check a few things to figure out what optimisations I'll need to make code-side -

    * When I place a tile down with a brush, can I set it so it only checks it's neighbour tiles for modifications, rather than the whole map? Checking with the profiler at the moment, it seems that FillMeshData() is rebuilding the entire mesh and re-creating every single tile in the map, rather than only modifying the tiles that have been added or replaced or removed. Ideally it would be caching the existing data, and only changed the tiles modified by the Brush.

    Would it be feasible to have a super-optimised UpdateMesh() function for doing realtime operations like this?
     
    Last edited: Mar 12, 2020
  9. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The Mesh is regenerated because empty tiles are not included in the process and also, subtiles could be used, with 4 small tiles per cell. Technically you could reuse the tiledata if the changes doesn't affect the mesh data (only if the tiles change the uvs but not if you add a tile, remove a tile or a tile is divided in subtiles)
     
  10. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    42
    I've been able to do a bit of editing to the TilemapChunk_Renderer.cs code and create an additional UpdateMesh() path that is about as optimised as I can think to make it! It really just took a bit of refactoring of the existing code and adding a new Array that tracks whether a tile is 'dirty' or not, and cleaning up some repeat memory allocation and checks that don't need to be there when making procedural meshes and making everything work with Arrays. A lot of the heavy lifting was done already :)
     
    Last edited: Mar 19, 2020
  11. Alexflame108

    Alexflame108

    Joined:
    Sep 24, 2019
    Posts:
    23
    @CreativeSpore

    Just started to use your asset, it's pretty awesome, thanks!

    But I have a problem, can you please have a look?

    I use free 2d art pack but still can't understand why i have this problem.

    I think screens will talk for themselves.
     

    Attached Files:

  12. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    42
    There seems to be a bug with the way the collider mesh is generated, specifically in 2D Polygon Collider mode! If you set a tile's collision shape to Polygon, make it half height, and then tile it will some 'Full' collider-shaped tiles, the Polygon Collider mode interprets the shape in an incorrect way as you can see in the attached photo: collider_polygon.png

    In 3D or Edge Collider mode the shape generates as you'd expect, although there is a weird blep there that might account for the Polygon Collider going wrong!
    collider 3d.png

    Sadly I want to be able to use the A* Pathfinding Project with this, so using Edge Colliders becomes difficult! Hopefully this is possible to fix.
     
  13. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Try using the CarpetBrush. You are using a Brush used for roads and it doesn't look the same because you forgot to add the holes in between the corner tiles.
     
  14. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Add this patch. It will be included in the next version and removes the optimization that merge the colliders so you can use polygon colliders with no issues at all.
    The problem with polygon colliders is, they have to be closed areas and there are many situations were this could lead to ghost collider lines. Disabling the merging each tile will create it's own collider. Shouldn't be a big performance issue in most cases.
    The patch is part of the new version of STE, so you could have some compilation issues. If that is the case, send me an email.
     

    Attached Files:

  15. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    42
    Thanks for the patch! I'm a bit wary of using it though, as it'll create thousands of polygon collider components for my maps which isn't very optimised at all :(

    It does feel like there's a bug in the way the merged collider 'mesh' is generated though. For example, the middle blue section here does not get a polygon collider component added for it in the tile chunk object, but it does for the left and right sides:

    polygon colliders 2.png

    It feels like that middle blue section should be a new Polygon Collider component, as in the Edge Collider version it creates three Edge Collider components with one in the middle:

    edge collider 2.png

    I guess I could work around this by using the Pathfinding behaviour I just found bundled with this rather than A* Pathfinding Project, however :)
     
  16. Unusual-Cadence

    Unusual-Cadence

    Joined:
    Aug 12, 2015
    Posts:
    42
    So I've hacked my TilemapChunk_Colliders.cs a bit to use the Clipper library (http://www.angusj.com/delphi/clipper.php) to merge the collider data together in to optimised collider components - it seems to fix my issues, but definitely something unique to my needs, haha. Maybe worth looking at the logic to combine the tiledata colliders, as I think it's something to do with the way the first and last points in a path link up:

    Collider broken.png Collider fixed.png
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there!
    I tried the same layout and it works fine on my side:
    upload_2020-3-30_12-9-34.png
    Even with different combinations of edge/polygon colliders with and without optimizations.
    By the way, thank for telling me about the Clipper library. I looks really interesting.

    About your issue, I guess it could be some modification you made or something missing in the patch I have in my updated version.
    If you send me an email, I can send you the last updated version.
     
  18. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I have found a bug using polygon colliders that could be causing some issues:
    Here you can see the fix:
    upload_2020-4-6_11-51-30.png
    Before removing the last vertex, it checks if it is equal to the first vertex.
     
  19. ffman22

    ffman22

    Joined:
    Oct 7, 2014
    Posts:
    36
    hello I am working in a 2D pixel art project in Unity and I am using the super tile map editor to create the levels design, but this week we start to use the corgi engine, and and I want to use the feature of the engine that allow me to use the sprite mask to hide parts of the background that are not in the current room. but that doesn't work with the super tile map editor, is any config that I can do to allow me to use sprite mask with the super tilemap editor?
     
  20. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I have sent you an email with a patch including Sprite Masking feature.
    It will be also included in the next update.
     
  21. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hi! I don't know if this kind of error is about this asset. Thanks!!
    Using last version of TileMapEditor and Unity 2019.3.5f1 (It happend in the editor some times (Frequent) and when I press play but the game work fine)

    upload_2020-4-28_22-31-27.png
     
  22. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Can you enable full script log and post the full callstack to see the source of this error message?
    upload_2020-4-29_17-26-9.png
     
  23. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    I don't know if it related with Super Tile Map Editor :/ Thanks!
    upload_2020-4-30_17-47-59.png
     
  24. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Thanks for the screenshot. I couldn't find anything related to this error.
    Sometimes, Unity doesn't upgrades properly from a previous version. I don't know if it is related, but you could try to isolate the issue. For example, it could be a prefab (try to unpack repack) or a component (try to copy values and remove and add it again from clipboard)
     
    gferrari likes this.
  25. chrische5

    chrische5

    Joined:
    Oct 12, 2015
    Posts:
    52
    Hello

    Im very New with your Tool and have two main questions. At first... Is it possible to create a randombrush with animated tiles? And second.. I painted my map with a random brush. It looks very nice. But if i change one tile cause of optimations the whole map will randomized again. Thats not what i want. Is there a possibility to freeze the map and work on individuell tiles on this map?

    Christoph
     
  26. digiwombat

    digiwombat

    Joined:
    Sep 26, 2013
    Posts:
    48
    I have a bunch of tilemaps (various layers and about 80 maps) and the performance in the running game is fine, however, the Collider and Mesh rebuild when the level loads causes a hang for about 6 seconds for rebuild and GC.

    Is there a way to (preferably) just cache the colliders and meshes inside the file (I know they're being built in the editor) rather than rebuilding them on Scene Load? As it is, if I turn off the OnEnable and Update rebuilds, the map just doesn't show up on play. I just want to build the meshes/colliders ahead of time and only update them if there's a change.

    I also never want to rebuild the colliders since map collision is static for me.

    I could write some code to spread the rebuild out across multiple frames, but that doesn't really solve the issue for me, it just hides it behind a (potentially quite long) loading screen.
     
  27. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    To use animated tiles, add an animated brush to a random brush and enable this checkbox.

    upload_2020-5-8_9-33-27.png

    To avoid the tilemap to refresh the random brushes, you can also add this option or just avoid refreshing the tilemap.
    The tilemap is refreshed when drawing outside the tilemap bounds, so you can set an initial bound and draw inside the bound to avoid that.
     
  28. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Technically, colliders are only updated if you are using 3D colliders, but you can remove these lines to make it persistent in detriment of scene size:
    m_meshCollider.sharedMesh.hideFlags = HideFlags.DontSave

    For the chunk tile mesh, you could enable the chunks manually when they are inside the camera view to avoid loading all at once or do the same as with the colliders, removing these lines:
    m_meshFilter.sharedMesh.hideFlags = HideFlags.DontSave;
     
  29. chrische5

    chrische5

    Joined:
    Oct 12, 2015
    Posts:
    52
    Hello

    I know this, but i dont kwno how to do. if i create an new randow brush, i can choose the tiles on the tilepalette. if i choose at the bottom a animbrush, a "tile" is added, but it seems empty. if you want i can send you a video or something like that. i'm sure, i'm the problem.

    thanks.
     
  30. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Can you send me a test project? Or an screenshot with the brush inspector?
     
  31. papazingo81

    papazingo81

    Joined:
    Jun 2, 2019
    Posts:
    14
    Hi, Loving the Asset. thanks

    However need a little guidance. I'm building a Rimworld type game and I've managed to write something that draws walls using a road brush at runtime. How would i go about scripting a tile preview, similar to in the editor that shows the currently selected tile before placing?
     
  32. BlooBaba

    BlooBaba

    Joined:
    May 10, 2020
    Posts:
    1
    Hey, really enjoying how versatile STME is. I'm having one issue where I'm not sure how/where to place corner pieces for autotiling (the photo was done using Unity's tilemap system). Also, is there any documentation for Brush47? I think that's what I should be using, but I'm unsure of where to place tiles to get the desired result.

    EDIT: Brush47 is the correct tile to use, just took a fair bit of trial and error. Would still like some documentation for it. Also going to post a YT tutorial on this specific brush as some may not realize how versatile this package is.

    upload_2020-5-20_15-47-17.png
     
    Last edited: May 20, 2020
  33. MoFaShi

    MoFaShi

    Joined:
    Oct 25, 2015
    Posts:
    43
    Hi, I am wondering does this tool support RPG Maker styles assets?
     
  34. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I'm glad you liked the asset.

    About your question, check this code used to display a brush preview using a RawImage:
    Code (CSharp):
    1.  
    2. RawImage rawImage = uiBrush.targetGraphic as RawImage;
    3. rawImage.texture = m_tileset.AtlasTexture;
    4. rawImage.uvRect = brushContainer.BrushAsset.GetAnimUV();
    5.  
     
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Good to know you found the answer. You are right, there are many undocumented features that should be commented as well. The number of features is increased faster than documentation :D
    But I will try to keep creating more tutorial videos for these features.
    If you don't mind sharing your YT tutorial, that would be great as well.
     
  36. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    There is no specific brush for them, but it would be easy to create one.
    But you can support them using the CarpetBrush and AnimatedBrush.
    An specific brush would be better if you want to create the brush directly from the atlas texture, selecting all the tiles.
    If you want, you can also have a look to our other tool RPG Map Editor that supports specifically RPG Maker Tileset layout.
     
  37. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hi!! Again here. I have a issue with the pathfinder, Why my path look like this. I try different modes, but it always find the path in this way. Thanks!

    upload_2020-6-1_11-52-8.png
     
  38. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Did you tried to don't use any Heuristic?
    upload_2020-6-4_16-28-10.png
    It happens due optimizations in the Heuristic algorithm to find the path faster. For short distances, you can use None.
     
    gferrari likes this.
  39. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    135
    Hi! I have another question. I want to use random brush with animated tile. But when I add it only show the ID 0

    How can I use it? Thanks in advance

    upload_2020-6-10_12-21-4.png
     
  40. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Can you send me a test project or package with your tileset and resources? It couldn't reproduce it, maybe it was fixed with the last changes in the tool. In that case I could reply you back with a fix.
     
  41. LunarMountainGames

    LunarMountainGames

    Joined:
    Jul 24, 2019
    Posts:
    10
    Hi, I'm using the STE to create a world that dynamically loads in chunks then destroys them as the player moves along. Currently, I'm creating bounds and filling/destroying chunks based on the player's position, but I'm wondering if I'm doing this the wrong way. Is there a better way to get the chunks in a radius around the player to fill tiles? Thanks.
     
  42. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I think that could be a good approach. I don't know the details, but you could take into account the default chunk size is 60x60, so if you use multiple of this size it could be more efficient.

    There is no method to destroy a chunk directly, but it could be easy to achieve and it would increase also the performance when destroying chunks (instead of just erasing the chunk tiles). Let me knot if you need help with this.

    Check this post with an example to generate a procedural world in real time. It could give you some ideas.
    https://forum.unity.com/threads/released-super-tilemap-editor.387330/page-9#post-2876541
     
    LunarMountainGames likes this.
  43. LunarMountainGames

    LunarMountainGames

    Joined:
    Jul 24, 2019
    Posts:
    10
    Thanks, I'll check it out. I'll send you a message if I get stumped.
     
  44. Saishy

    Saishy

    Joined:
    Jun 3, 2010
    Posts:
    79
    Using unity 2019.4.0f1, you cannot select a tile from the tileset for RandomBrush:

     
  45. SoulDesign

    SoulDesign

    Joined:
    Jul 27, 2018
    Posts:
    8
    Really thanks for your long time support
    I'm working whith a function like HeatMap each grid have a num of heat.
    the grid of i click whith mouse will change the num of heat.
    upload_2020-6-29_10-25-24.png

    I add a int paramater for one tile and put this tile on a rectangle area to get that goal.

    I have a question for set Parameter.
    i can get the tile's paramContainer and the parama belong a tile As the Docs write

    but when i set the heat param, the whole grid's tile that i paint will change the heat at same tilme.
    Is there any way only change one grid param and others keep the oringin param
     
    CreativeSpore likes this.
  46. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I have attached a patch here. Let me know if you find any other issue.
     

    Attached Files:

  47. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I am afraid it is not possible. The tile parameters are shared by all the tiles of the same type.
    But you can use the component TileObjectBehaviour to create the tile instantiated as a gameObject.
    Just attach this component to a gameObject, create a prefab from it and attach it to any tile you want to be instantiated.
     
  48. Saishy

    Saishy

    Joined:
    Jun 3, 2010
    Posts:
    79
    It worked!

    Thanks!
     
    CreativeSpore likes this.
  49. Stab

    Stab

    Joined:
    Jan 26, 2013
    Posts:
    13
    Hello!
    There is added new feature with LWRP: now we can add secondary textures to sprites (normal map and mask). I try to add normal map to atlas sprite as secondary texture, but normal map didn't work =(
    All other objects in scene works propertly.
    Any workaround or may be adding support for secondary textures for 2d lighting in future versions?
     
  50. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Are you using the same material in the Tilemap? Is it using the Sprites/Default material or another special material?