Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[RELEASED] Super Tilemap Editor

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

  1. hublard

    hublard

    Joined:
    Aug 19, 2015
    Posts:
    35
    Hey there,

    someone already tried to Export map data?

    i use this asset for my 2d multiplayer (Server/Client)

    Player can build stuff and that will synchronized and stored (save) in Server database (mongodb)
    when a new Player Login he will get updated from Server (load)

    so e Need to save serializated data.


    if someone already worked on this and can help me i would be very thankful :)


    best regards
     
  2. lonehamster

    lonehamster

    Joined:
    Aug 14, 2018
    Posts:
    32
    Is there someone familiar with this that might be able to help mentor me in using it for my project? I would be happy to pay for the help.



     
  3. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    Check this out. It may help:
    https://creativespore.com/2018/07/03/how-to-iterate-a-tilemap/

    If you need more help let me know.
     
  4. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    That would be complicated to do without changing the workflow a lot, so it won't be possible in a short term.
     
  5. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    Not sure what you need help with. With the tool or with the tileset?
     
  6. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    63
    Hi! I have an issue with the playmaker for STE Actions

    Assets/PlayMaker4STE/Scripts/TilemapActions/SetTilemapChunkRendererProperties.cs(61,25): error CS1061: Type `CreativeSpore.SuperTilemapEditor.STETilemap' does not contain a definition for `UpdateChunkRenderereProperties' and no extension method `UpdateChunkRenderereProperties' of type `CreativeSpore.SuperTilemapEditor.STETilemap' could be found. Are you missing an assembly reference?

    I use the last STE vesion and 2018.2 unity version.
     
  7. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore
    So I have a question about a possible weird use case for Super Tilemap Editor and wanted to get your thoughts on it.

    So I original purchased this assets to prototype a number of different top down game ideas and it has worked great for that, I also tried your smart platformer collider asset to prototype some platformer-ish style games it that went fine too. One other style of game that I am looking to prototype is a terraria / starbound style side scroller sandbox game. Event those this is a side scroller view, I don't think the smart platformer collider package would be that helpful for me here. I am currently prototyping with this assets:

    https://assetstore.unity.com/packages/templates/systems/terrain-engine-2d-115381

    which seems to be the only one of its kind that is geared specific toward this kind of game I want to prototype (even though it is new in its development) however a thought just came to me that while Super Tilemap Editor seems to always be shown with a top down style of game, is there any technical reason why it would not be a good choice for a terraria / starbound style game?

    Thinking about the core features that I would need / want from a tilemap manager for this game:

    ---------------------------------------------------------------------------------------------------------------------------------------------

    Colliders

    I already know with my previous prototypes of top down games that this should work the only difference being is that I would use the physics engine to be able to push the player down instead of not using it with top down games.

    Blocks

    Basically blocks are tiles however one thing I think that terraria / starbound tiles do differently is they have the option to have overlapping so not sure how I might be able to do that with Super Tilemap Editor.

    Destructible / Buildable Map

    I prototyped a top down survival crafting game so I know this asset handle that kind of functionality pretty well.

    Lighting

    I am not sure about this as I have never need to try lighting with any of my prototype so would be interested in your opinion on this.

    Fluid (more of a nice to have)

    This is the most interesting one. Ideally there might be a different asset that I could use with this that could provide 2d fluid functional, again would like to here your thought son this one.

    Performance

    This is pretty much a concern for any game however if I take what I think terraria max map size is, it is a little over 20 million tiles (though I might need multiple layer for background, foreground etc.) but I would think this come down to more or less doing proper culling of what gets rendered and how chunk of rendered tiles are loaded / unload but would like to hear your thoughts on this one too.

    ---------------------------------------------------------------------------------------------------------------------------------------------

    I am definitely going to continue to prototype with the other assets however if that does not work out for me, I would be interested in hearing you thoughts if you think Super tilemap Editor would would be a good choice for this style of game (I don't want to even try it if you think it would be a bad choice).
     
  8. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore So one other thing I though of that would be a nice to have but not super critical it to have falling tiles but not sure if that is support supported or possible with Super Tilemap Editor.
     
  9. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    101
    Sorry if this has been answered before but I'm interested in Super Tilemap and was wondering how it compares with Unity's built-in tilemap editor? I haven't tried Unity's yet and I'm definitely happy to buy the asset, I'm just interested in improvents of workflow, performance and such using Super Tilemap vs built-in. Thanks!
     
  10. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    There is a typo in that method I don't have in my version:
    Should be UpdateChunkRendererProperties not UpdateChunkRenderereProperties.
    Maybe you typed an 'e' by mistake.
     
    gferrari likes this.
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    Here is a list of features that (at the moment I made the list) were not included in the Unity Tilemap System:
    https://forum.unity.com/threads/released-super-tilemap-editor.387330/page-18#post-3287124

    You can check in some review people using Unity Tilemap System have found STME to be very useful.
    I personally found STME more easy to use and more powerful, but I can't be objective about my little creature :D
     
  12. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    Hi there,

    I made STME to be very fast in performance. If you dig in the forum you can find a demo with a procedural map being generate at runtime with a good performance and a lot of posts about this.

    The collider generation is really fast and optimal and is also made in real time creating only the minimum colliders around the areas with colliders. You can also use 3D or 2D colliders and change the collider properties as well.

    For lighting, you can change the tilemap material for SpriteDiffuse to be affected by any light in the scene. Or use the vertex painting to create your own lighting system.

    Using colliders you can use the physics to create any fluid without any problem.

    About blocks, I didn't understood what you mean about overlapping them. But if you need to convert a tile in a gameObject, you can use the TileObjectBehaviour component. Attach the component to a gameObject, create a prefab and attach the prefab to any tile. When you paint the tile, the prefab will be instantiated using the tile as sprite.
    I use it for interactive elements like doors, chests, traps, etc.
     
  13. gferrari

    gferrari

    Joined:
    Jan 14, 2015
    Posts:
    63
    Thank you a lot! I fixed it, but is not my type error, I download it from the assetstore.
     
  14. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore Thanks for the feedback but let me expand on my overlapping tiles question.

    This is essentially what I think I want to be able to do just from my experience playing around with Starbound as that is the template I am using as least from a visual perspective. Lets say I have my tilemap configured for 16 x 16 tiles however the tiles I want to use are 24 x 24 leaving 4 pixels on each side "overlappping" and each tile would have some sort of order so that if a dirt tile is next to a stone tile, one of them has it overlapping area draw on top of the other tile.

    Let me give you a few screenshots I pulled from Starbound to show you want I mean:

    overlapping-tiles.png

    This shows 2 1 tile width stone stacks with 1 tile in-between. As you can see the space in-between the 2 stone stacks is smaller than the space the stone stacks take up even though they both occupy the same 1 tile width space. On the right you can also see when I fill the 1 tile width empty space with dirt tiles, it overlaps the existing stone tiles making them look smaller in width even though the tile did not appear to change. I am assuming the tiles did not change as when I placed the dirt tiles, not a single pixel of stone tiles changed so I assume the dirt tile is just being drawn on top (now I have no way of knowing this, they could have create the assets so exact so that it did not look like the tile changed but since each tile seems to have a number of different variations and blocks can be placed in any configuration and there are so many different types of blocks in this game, this is my best guess on how they did it at a high level).

    Another Example:

    overlapping-tiles2.png
    overlapping-tiles3.png

    Here you can see what an empty 1 x 1 tile looks like and the difference between what dirt surrounding stone and stone surrounding dirt looks like.

    You can also see this with other kinds of tiles:

    overlapping-tiles4.png

    Again, these are just my best guesses on how Starbound might be doing this based on playing around with it and my best naive guess on the simplest way something like this could be done if I where going to look at implementing it.

    Is this kind of tile "system" possible out of the box with Super Tilemap Editor and if not, any guidance how one might implement such a "system" (with either the way I described or some other way that I might not be thinking of) if possible with Super Tilemap Editor?
     
  15. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore So I have another question as it relates to building a starbound style map system.

    I figured with having the max map size that I want (6000 x 3000, 20 million tiles) I decided it would be good to split the tiles up into chunks so that the map would not be updating all the time. I decided to chunk the tiles into 30 x 15 groups and based on what I currently feel would be the max zoom out size I would want to support I need to render a size of 9 X 7 chunks around the center of the player (which is 28,350 tiles). If the user were to move at a 45 degree angle, that means when the map needs to update because the player has entered a new chunk, that would require at most 13,500 tiles to be updated (6,750 for the possible new chunks coming into range and the 6,750 tiles for the possible chucks coming out of range that can be removed). This is basically the code that I have for doing that:

    Code (CSharp):
    1. private void DrawWorld() {
    2.     List<int> newDrawnChunks = new List<int>();
    3.     List<WorldChunk> chunksToRender = _world.GetChunksAroundByPosition(_playerGO.transform.position, _renderedChunksWidthRadius, _renderedChunksHeightRadius);
    4.  
    5.     for (int n = 0; n < chunksToRender.Count; n++) {
    6.         WorldChunk chunk = chunksToRender[n];
    7.  
    8.         // no need to drawn chunks if they are already drawn
    9.         if (_drawnChunks.Contains(chunk.Index)) {
    10.             newDrawnChunks.Add(chunk.Index);
    11.             continue;
    12.         }
    13.  
    14.         for (int i = 0; i < chunk.TileIds.Length; i++) {
    15.             Vector2 worldPosition = chunk.GetWorldPositionByIndex(i);
    16.             int worldTileIndex = chunk.GetWorldTileIndex(i, _width);
    17.  
    18.             if (_worldData[worldTileIndex] != 0) {
    19.                 _mainWorldTilemap.SetTileData((int)worldPosition.x, (int)worldPosition.y, _worldData[worldTileIndex]);
    20.                 _environmentTilemap.SetTileData((int)worldPosition.x, (int)worldPosition.y, _worldData[worldTileIndex]);
    21.             } else {
    22.                 _mainWorldTilemap.Erase(new Vector2(worldPosition.x, worldPosition.y));
    23.                 _environmentTilemap.Erase(new Vector2(worldPosition.x, worldPosition.y));
    24.             }
    25.         }
    26.  
    27.         newDrawnChunks.Add(chunk.Index);
    28.     }
    29.  
    30.     // clear up old chunk that are no longer needs
    31.     for (int i = 0; i < _drawnChunks.Count; i++) {
    32.         if (!newDrawnChunks.Contains(_drawnChunks[i])) {
    33.             ClearChunk(_drawnChunks[i]);
    34.         }
    35.     }
    36.  
    37.     _drawnChunks = newDrawnChunks;
    38.  
    39.     _mainWorldTilemap.UpdateMesh();
    40.     _environmentTilemap.UpdateMesh();
    41. }
    In the editor, there is a bit of lag when the player moves into another chunk (which causes this code to run) but in a build it seems to run fine with 2 tilemaps (not sure if I would need more eventually) though since this is probably going to be the biggest bottle neck for performance when the player is moving around (and I have not even gotten to prototyping lighting or liquids), I want to get this code as performant as possible.

    The 2 questions I have are about this are:

    1. Is this the most performant way to handle this kind of map system with Super Tilemap Editor?
    2. Is there anything I could do to make this run faster in the editor or might is just be better to just build debugging tools in the game itself to be able to debug / play around with stuff (which I will want to build at some point anyways)?
     
    Last edited: Dec 3, 2018
  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    STME was designed to fit the tiles in a grid, but you can modify the code used to place the tiles to make the tiles bigger or smaller than cell size. Here is where you should add your custom factor. In this case, using 0.5f the tiles will be 50% bigger than cell size:
    upload_2018-12-3_19-56-25.png
     
  17. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    You could use a Coroutine to create the map around the player or camera when it is not visible yet.

    Also, a dictionary for _drawnChunks would be faster than a list.

    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

    About the editor, it is always going to be more slow that a build. I guess you already avoid having the tilemap selected while playing. The drawing of the tile palette consume some resources.
     
  18. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore So as I am focusing right now on the performance part (as without that, nothing else really matters) so let me try to approach this from a different angle. Instead of trying to do things that might be completely unrealistic, lets say I want to dedicate a maximum of 20% of each frame for rendering / updating the tilemaps leaving 80% for the rest of the game with lighting, physics, UI, game play logic, etc. (and let me know if in your experience if this seems unrealistic for a Terraria / Starbound style game), that would give me about 3.2 milliseconds for that so my questions would be:

    1. In that time frame, what would you say the number of tile I should be able to update would be?
    2. Would the number of tilemaps being updated effect how many tiles I could update (i.e. would updating 10,000 tiles on 10 tilemaps be much slower than updating 50,000 tiles on 2 tilemaps or vis-versa)?

    Also, I did trying the coroutines however with the max speed of the player I am looking to support, that causes slowness in the built version of the game so not sure if that method is really going to help me out.
     
  19. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore So another thing I was thinking about trying was instead of loading / clearing several thousand tiles at a time, maybe I could have chunks of tiles that are already set and just enable / disable the chunks instead of each tile. I know that Super Tilemap Editor is using at least 1 mesh for rendering the tiles but not sure if it uses multiple meshes or if it is possible to do what I am looking to try to do through the exposed API in order to see if it improves the loading / unload of parts of the world while in it.

    I am sure this might have negative effects when it come to memory usage and initial load up time however if the load up time is only slightly longer compared to any performance gained by just enabling / disable the chunks instead of individual tiles when the player moves around, that might be a trade off I can live with since loading the world is only going to happen once per game session.
     
  20. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore One last question that relates to another possible idea I have for performance improvements I can try with how I use Super Tilemap Editor is if multiple tilemaps exist with colliders under the same tilemap group and those colliders overlap, would those colliders get merge (so that instead of 2 colliders that would prevent the player from moving from 1 tilemap to the other, there would just be 1 collider and the player could move from one tilemap to the other)?
     
  21. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    998
    It is very difficult to calculate the time dedicated by the tilemap logic. But I can tell you how it works.
    The tiles are rendered using a mesh in a chunk of 60x60 tiles (you can change this size but this value is optimal).
    So, if the chunk area has at least a tile, the tilemap will create a children chunk gameObject to hold any tile in the chunk area, if there is no tiles, no chunk will be created.

    In terms of performance, the chunks that are not visible are not renderer nor updated ( the only thing updated so far are animated tiles ).
    Animated tiles consume some performance because it has to rebuild the mesh.uvs each frame for all the tiles that has animations, no you could avoid animated tiles to improve the performance. But as I said, this only happens for any visible chunk.

    For colliders, each tilemap manages its own chunks, but there is not management for a tilemap group so far. You could check the code in the tilemapChunk_Collider.cs file and apply the same logic to a tilemap group simplifying it to your needs. For example, you should decide how to manage when the same cell has tiles with colliders with different shapes or when a cell size in a tilemap is different for other tilemaps (in your case you could decide to use the same cell size for all the tilemaps so it would be easier to implement).
     
  22. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore Yea, I have spent all weekend trying to figure out how to get this performant but I just can't. Either I am not grasping some technique games like Terraria / Starbound use or they using some technique(s) that is highly specific to that world style (2d blocky sandbox).

    Thanks for your help anyways.
     
  23. Qzia

    Qzia

    Joined:
    Jan 25, 2015
    Posts:
    55
    Hey,
    since I've been asked, I did my asset support for Super Tilemap Editor.
    I'm still improving it, but it has quite a lot features already!

    You can find Lighting2D asset here
    Smart Lighting 2D Thread

    Untitled (2).png

    Untitled (1).png
    Untitled1.png
     
  24. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore

    So I think I have made a pretty big breakthrough in getting performance much better however there is just one slight issue with it.

    First, what I tried was instead of rendering all 77 16x16 chunks of tiles that I was generating in 1 tilemap, I just rendered each chunk in their own tilemap (so 77 16x16 tilemaps) and just placed them next to each other in the correct order. I basically pre-allocate a pool of 100 tilemap game objects and just recycle through them as the player moves around.

    When I was just using 1 tilemap I averaged about 1400 FPS when moving across all 5920 tiles width wise at a max supported character speed however the map was mostly lagging behind where the edge of the screen where the character was moving towards was blank as the rendering was trying to catch up to the movement and the FPS dropped to or below 30 FPS 352 times, the lowest was 5 FPS (over a total time of ~31 seconds)

    With using multiple tile maps, I averaged about 2100 FPS but more importantly the map never lagged behind and the FPS only dropped to or below 30 FPS 3 times, the lowest was 27 FPS (over a total time of ~31 seconds).

    You can correct me if I am wrong but I am assuming the reason the performance is better and more consistent is that it is more efficient to update several smaller meshes / many smaller colliders instead of trying to update 1 large mesh / fewer larger colliders when only a small part of the tilemap changes (with the 77 tilemaps, only 17 of them can possibly change at once at any given time).

    Now the issue I run into with this is that brushes don't really work with this setup:

    STE-multiple-maps.png

    You can see where the 16x16 tilemaps are just by looking for the solid dirt lines that repeat.

    This is not a surprise since using multiple tilemaps means the tilemaps next to each other don't know about the tiles next to them on the edges (at least not from the tilemap data itself, the data I am generating to populate the tilemaps does have access to that data).

    I was wondering if there was a way built into Super Tilemap Editor to be able either have multiple tilemaps know about each other / be able to be given extra data that would help enable brushes in this kind of setup or if there was a way to tell Super Tilemap Editor to render multiple chunks / meshes instead of just 1 big mesh / as few colliders as possible (I know there is chunking already at some level but it seems like colliders cross over the chunks and I assume the mesh does as well) or would I have to basically write my own code that generated the tile ids from the full set of data that I am generating and using to render the tilemap and basically re-implement brushing that way for my own needs?
     
  25. ryanzec

    ryanzec

    Joined:
    Jun 10, 2008
    Posts:
    648
    @CreativeSpore I decided to do a few more benchmarks this morning just to try to see what might be causing more of the issue, the rendering of the mesh or the colliders and also test examples with multiple layers since I will be needing that anyways. All tests were done on a map of 5920x3040 tiles but only rendering 176x112 at a time with 7 16x16 chunks loading and 7 16x16 chunks unloading when the map updates (same parameters were used for the tests I mentioned above). I move the character at the maximum support speed across all 5920 wide tiles from right to left over the coarse of 31 seconds.

    2 Layers (neither with colliders)

    The first additional test was to add another layer (so +1 tilemap for the 1 tilemap per layer group and +100 tilemaps for the 1 tilemap per chunk group) and have neither layer have colliders:

    2 Total Tilemaps, no colliders:
    • Average FPS: 1650
    • Minimum FPS: 13
    • Number of frames under 30 FPS: 312
    200 Total Tilemaps, no colliders:
    • Average FPS: 2050
    • Minimum FPS: 27
    • Number of frames under 30 FPS: 4
    2 Layers (1 w/ colliders | 1 w/o colliders)

    The first additional test was to add another layer (so +1 tilemap for the 1 tilemap per layer group and +100 tilemaps for the 1 tilemap per chunk group) and have 1 layer with colliders and 1 layer without colliders:

    2 Total Tilemaps, 1 will colliders and 1 without collider:
    • Average FPS: 770
    • Minimum FPS: 4
    • Number of frames under 30 FPS: 315
    200 Total Tilemaps, 100 will colliders and 100 without colliders:
    • Average FPS: 1830
    • Minimum FPS: 20
    • Number of frames under 30 FPS: 20
    2 Layers (both layers with colliders)

    The first additional test was to add another layer (so +1 tilemap for the 1 tilemap per layer group and +100 tilemaps for the 1 tilemap per chunk group) and have both layers with colliders:

    2 Total Tilemaps, both with colliders:
    • Average FPS: 5
    • Minimum FPS: 4
    • Number of frames under 30 FPS: 305
    200 Total Tilemaps, all wwithil colliders:
    • Average FPS: 5
    • Minimum FPS: 4
    • Number of frames under 30 FPS: 302
    Based on this it seems that even though just the mesh alone does cause slowness and jankyness in the game, the colliders are taking up a lot of the time.

    Not sure if this is useful for you but figured I would share the results.