Search Unity

SpriteTile, a fast dynamic tile system (RELEASED)

Discussion in 'Assets and Asset Store' started by Eric5h5, Dec 11, 2013.

  1. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    Eric, a question on sorting groups; I’ve attached a couple of screenshots showing a guard in front and behind a group of tiles (a pillar). I wonder how one goes about and achieves this kind of group sorting in SpriteTile at runtime. Is there a way to set the order-in-layer for a group?

    More specifically, the use case is that the player character, or other NPCs, need to properly draw themselves in front of or behind SpriteTile groups (trees, structures, etc.) as they move around a large world. In a pre-built level, I can go into each tile and set their order-in-layer value. In a procedural one created at run-time, however, I’m unsure as to how to easily achieve the same effect. Would appreciate your advice!

    Also, noticed a small but workflow slowing bug where right-click-and-drag selections on the Tiles section (top-right of editor) results in picking the wrong tiles, specifically one tile row down from the intended selection. I’ve included a screenshot; currently using SpriteTile 2.10 with Unity 5.0.
     

    Attached Files:

  2. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    I'm getting the grey lines bug. I tried 1 pixel of transparent padding but no luck.
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use the SetOrder or SetOrderBlock functions.

    Sorry about that, looks like that happens when there are more than 8 sets.

    Try using point filtering, or turn off mipmaps, or pad by extending the edge colors rather than using transparency, whichever is most appropriate for your usage.

    --Eric
     
  4. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    Thanks for the prompt response Eric. I’m familiar with SetOrder and SetOrderBlock, however, I need guidance on how to apply them to a group. For example, I introduce a group of tiles (a tree from my previous screenshots) into the procedural level via CopyGroupToPosition. Next I’d like to set the order of all tiles in that group only. Where would I be able to extract the information on that group’s tile positions, aside from the initial Int2 I gave CopyGroupToPosition as an argument?

    I’ve used GetMapSize at run-time to get similar info but on the level loaded, then I would loop through all of its rows and columns with SetOrder to create a general order layout. Is there an equivalent method to get the “size” structure of groups I’ve loaded so I can set their draw order, or another way to go about this?

    Alternatively, I would need to manually record each group’s tile dimensions into a data structure every time I create a group, pair it to a set/group key, and access those at run-time. I’m afraid that would be tedious and time consuming to create or maintain manually for a project with a large tileset. Would appreciate your advice on how to solve this.

    Lastly, is there a way in SpriteTile to have multiple tiles reside in one cell in the same layer, differentiated by z-order draw sorting, thus removing the need for layers? On a top-down view procedural game with a large amount of tilesets and groups, a small block of cells can have many overlapping tiles decided at runtime. Navigating draw order through that with your player character while using layers and order-in-layer based sorting can be a quite challenging, whereas z-order sorting should be much simpler.

    Thanks in advance Eric!
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    In the new Tile.GetGroupSize function in SpriteTile 2.11, which is released...now.

    SpriteTile 2.11

    Additions:
    • Tile.GetGroupSize function, which returns an Int2 with the specified group's X and Y dimensions.

    TileEditor fixes:
    • Attempting to drag a tile into one of the empty corner slots in a Terrain group no longer causes an error.
    • Right-click multi-selecting in the Tiles section works properly when there are more than 8 tilesets (and is more accurate in general).

    No, each map cell can contain only one tile. If you have the layers arranged in the same order as z positioning (which would be the default anyway), there shouldn't be any particular difficulty.

    --Eric
     
  6. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    I’ve been quite impressed with SpriteTile’s performance, thorough documentation, and prompt support, but a same-day feature release? You’ve certainly made our studio a fan Eric, I’ll say that much.

    I’ll test 2.11 and advise if anything comes up, then take some time to review the plugin and let folks know of our experience with SpriteTile.

    Many thanks and cheers!
     
  7. JayJennings

    JayJennings

    Joined:
    Jun 24, 2013
    Posts:
    184
    I've been looking at SpriteTile for a while and finally decided to grab it. My first impression is not great because it's making me feel stupid. I imported it and read the first page of the docs, but I'm enough of a newbie to Unity (although not to programming/game dev) that I'm stuck.

    ST comes as DLLs or source code. Okay, except as a Mac guy DLL says to me, Windows. Does the Mac version of Unity actually use DLLs?

    First page of the docs say I shouldn't use both -- just DLLs or source code. But where do those things live? Where do I find one to delete? I found something called TileEditor.dll, but as it's not called SpriteTile.dll I don't think that's what I'm looking for.

    And I found a unitypackage called SpriteTileSource, but as it's a package it's not installed, right? But the DLLs should be enough anyway, right?

    I searched all 17 pages of this thread and found NOBODY who had trouble installing, so that really makes me feel dumb. But I want to use it, so I'm hanging my ignorance out where it can be seen by all.

    Any help?

    Jay
     
  8. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Yes, because they do not contain OS specific code.
     
    JayJennings likes this.
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As a Mac guy, I'm the one creating the DLLs, so I'd say the first thing is to get rid of the association that "DLL = Windows". All DLL means is Dynamic Link Library; not a Windows-only concept.

    By default, with the Unity Asset Store version, you don't need to do anything special after you import SpriteTile from the asset store window. The DLLs are the default. You don't need to delete anything, although you can get rid of the SpriteTileSource package if you don't think you'll use it (you can re-import it later if desired). If you haven't imported it (by double-clicking it), then it's just sitting there doing nothing, and it will have no effect.

    If you bought from my site, then you get a folder with several Unitypackages: SpriteTileDLL-Unity4, SpriteTileDLL-Unity5, and SpriteTileSource. You'd import one of them into your project, either by using Assets -> Import Package -> Custom Package..., or by drag-n-drop from the desktop.

    --Eric
     
  10. Skullbot

    Skullbot

    Joined:
    Jul 12, 2014
    Posts:
    15
    I've got some issues with sprite importing (even those unrelated to SpriteTile).
    I'm using the last Assets Store version (even though I got some errors during import, related to Plugins folder meta)

    Import settings never applies and throw this error :
    2015-07-13_232542.png
     
    Last edited: Jul 13, 2015
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's not related to SpriteTile, so unfortunately I don't really know what to advise. I'd suggest starting a topic about it.

    --Eric
     
  12. JayJennings

    JayJennings

    Joined:
    Jun 24, 2013
    Posts:
    184
    Eric - I'm not sure what happened last night, but today I ditched everything, imported again, expanded the demos, and ran several of them with no problems. Last night I couldn't get any of them to run (not even the ones that didn't need any layer help). So your magical tech support gets 5 stars. :)

    Really looking forward to getting fluent with SpriteTile -- I have partial projects that will be helped by using your tool.

    Jay
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Excellent—so the sacrifice I made to the tech gods (it was an old SCSI cable) worked just as I expected. All praise the tech gods!

    --Eric
     
    Blue-Wolf and JayJennings like this.
  14. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    I did use point filtering and turned off mipmaps, but extending the edge colours would require an external tool. Then again, I could maybe make a second layer in Photoshop, which I blur and then move to the background.
     
  15. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Feature Request:
    • Ability to manage animation tiles in the TileEditor without using script.
    • Ability to attach a gameObject or MonoBehavior script to certain tiles in TileEditor.
     
  16. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    I could use something like this. In particular, while it's nice to use tiles just as "markers" that are not actually displayed, this is not enough. I need a way to customize it even further without getting into an exploding mess of different markers. For example, say you want a marker for "moving platform." This needs to be configured as to its shape, sprite, size, speed, and so on. Using different markers for different types of moving platforms can spiral out of control quickly.
     
  17. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    While preparing a procedural demo for my team for this Friday I’ve run into an error when using the CopyGroupToPosition method. I’ve tried to rule out anything local to my environment to the best I can.

    NullReferenceException: Object reference not set to an instance of an object
    SpriteTile.Tile.SetColliderBlockUpdates(Int2 p, Int32 layer, Int32 rowWidth, Int32 yEnd)


    If it doesn't indicate anything obvious, would you be able to kindly advise Eric whether it is working for you in 2.10 or 2.11? I’m calling SetCamera, followed by NewLevel, then SetTileBlock, LoadGroups, and lastly CopyGroupToPosition. The group is copied to the level, however, the error prevents using CopyGroupToPosition further again during that runtime.

    After ruling out what I could, I imported the 2.11 source code and did a line-by-line debug. CopyGroupToPosition calls the SetColliderBlockUpdates method, however, the latter tries to access colliderBlockUpdates which seems to be null. The error gets thrown in Assets/Plugins/SpriteTile/Tile.cs, line 2068.

    I've gotten around it by skipping SetColliderBlockUpdates but I would think that's bound to cause issues with our collisions and pathfinding. This issue doesn't show up in one of my older projects with file versions being a mix of SpriteTile 2.8 and 2.9, though I can't say the version difference is the problem. Lastly, I should point out that the changelog mentions a CopyGroupToPosition fix related to colliders being added in 2.9.

    Am I missing something silly? Would appreciate your help in resolving this Eric. Cheers!
     
  18. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sorry about that; it's a bug that happens if none of the tiles have a physics colliders default. As a work-around, you can make a tile have a physics collider default—the tile can be unused in the level, it just has to exist in the Tiles list in the TileEditor.

    --Eric
     
  19. Skullbot

    Skullbot

    Joined:
    Jul 12, 2014
    Posts:
    15
    It seems to happens when I have the Sprite Editor Window still opened in one tab while applying changes.
    Closing the tab solves the problem.
    I used to keep it on my other screen tabbed with SpriteTile Editor, that's why I though it was a SpriteTile issue ;)

    Besides, any new about auto 3D colliders generation from Tiles 2D Colliders ?
     
  20. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Hi, I'm really liking SpriteTile so far, and I'm still learning to use it fully. I have a few questions, though. The main one being: How do I use markers to place prefabs in my levels? I see people talking about markers, but I don't see anything about that in the documentation. I would really appreciate any help in this area. Again, thanks for the plug-in.
     
  21. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    They are just regular tiles. I place them on a level layer that is made invisible in script. Then, I get all the positions in that layer where the tile exists, and place my objects at the corresponding world positions.
     
  22. BadViking

    BadViking

    Joined:
    Jul 16, 2015
    Posts:
    15
    When reading through the documentation before buying this I was under the impression I would have excellent control over animations but I'm now finding this is not the case. As far as I can tell there is no way to animate individual tile instances separately, in response to a trigger say (e.g. play the animation when you walk over a specific tile). Why can we not do this? I would have thought this would be highly desirable behaviour. Reading the posts just above this I suppose I will be able to achieve a similar result using prefabs but to my mind that eats into the benefit of using SpriteTile in the first place.

    Additionally I can't help feeling that the triggers system sounded a lot more interesting in the sales pitch than it is in reality. You can only set a single number which doesn't exactly allow you to convey much information. That means that I will have to store extra information using my own system so again SpriteTile's usefulness takes a hit.
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I can't get the error to occur regardless of the TileEditor being open. In any case the error is for UnityEditor.SpriteEditorWindow, not the SpriteTile editor.

    Not at this time, sorry.

    I use triggers, along with Tile.GetTriggerPositions.

    You can; it's fairly trivial to do that sort of animation with the existing functions. For example:

    Code (csharp):
    1. function Start () {
    2.     Tile.SetCamera();
    3.     Tile.NewLevel (Int2(30, 30), 0, 1.0, 0.0, LayerLock.None);
    4.     AnimateATile (Int2(5, 5), 0, [TileInfo(4, 27), TileInfo(4, 28), TileInfo(4, 29), TileInfo(4, 30)], 10, 0.25);
    5. }
    6.  
    7. function AnimateATile (pos : Int2, layer : int, tiles : TileInfo[], loopCount : int, frameTime : float) : IEnumerator {
    8.     var i = 0;
    9.     var count = 0;
    10.     while (count < loopCount) {
    11.         Tile.SetTile (pos, layer, tiles[i]);
    12.         if (++i == tiles.Length) {
    13.             i = 0;
    14.             count++;
    15.         }
    16.         yield WaitForSeconds (frameTime);
    17.     }
    18. }
    --Eric
     
  24. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    I'm using this method now, and I've run into the issue of not being able to convert the vector 2 provided by Int2 into the vector 3 used by transform.position. What is the solution here?

    "player.transform.position = triggerPositions;" doesn't work, as you can imagine, what should I do to place the objects in the right positions?
     
  25. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    I believe Vector2 can implicitly be cast into a Vector3, so you need to do really nothing here. Just assign it to transform.position.
     
    Chibwemwn likes this.
  26. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    have you tried: player.transform.position = new Vector3(triggerPositions[itemNumber].x, triggerPositions[itemNumber].y, tranform.position.z);
    or
    player.transform.position = new Vector2(triggerPositions[itemNumber].x, triggerPositions[itemNumber].y);


    itemNumber must be between 0 and triggerPositions.Count
     
    Chibwemwn likes this.
  27. sanpats

    sanpats

    Joined:
    Aug 24, 2011
    Posts:
    343
    Use MapToWorldPosition() or something
     
  28. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Thanks so much for the quick responses guys! Using player.transform.position = new Vector3(triggerPositions[itemNumber].x, triggerPositions[itemNumber].y, tranform.position.z);
    and
    player.transform.position = new Vector2(triggerPositions[itemNumber].x, triggerPositions[itemNumber].y);

    both worked for me. The issue now is that there is an offset compared to the map. The objects aren't being placed where they are expected, in relation to the tile map I made.


    Screen Shot 2015-07-22 at 8.27.35 AM.png Screen Shot 2015-07-22 at 8.28.05 AM.png
     
  29. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Use Tile.MapToWorldPosition.

    Code (csharp):
    1. player.transform.position = Tile.MapToWorldPosition (triggerPositions[i]);
    --Eric
     
    Chibwemwn likes this.
  30. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Awesome! Thanks so much Eric, this works as expected.
     
  31. G0sub

    G0sub

    Joined:
    Apr 28, 2015
    Posts:
    10
    I'm loading a chunk of level data containing multiple layers using LoadMapBlock. When inserting this data using SetMapBlock, only the first layer is set.

    I tried making another SetMapBlock call using layer 1, but all that does is take the source layer 0 and set those tiles in layer 1.

    Is there a way to use Load/SetMapBlock with multiple layers?
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Currently, you'd need the multiple layers saved as separate levels.

    --Eric
     
  33. G0sub

    G0sub

    Joined:
    Apr 28, 2015
    Posts:
    10
    Thanks for the reply. Consider this a feature request then. I'd really like to be able to take advantage of the built-in layer management.
     
  34. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    How would I go about assigning specific values to objects, using SpriteTile Editor? I can now place objects in the scene using the editor and a few lines of code, but I want to be able to assign certain values to objects at the same time. For example, I have switches and checkpoints. Each object type has an ID int value. I want to have a way to assign the int values of the object types to my liking, when they are instantiated as the level is being loaded. What is the best solution to achieve this goal?

    The issue I'm having is that since there's likely to be more than one of each object type per level, I can't just set the values of the objects anyhow, I'd have to specify what objects gets assigned what values.

    I have some potential solutions of my own, but I'd like to know if there are proper ways of doing this. hope this question isn't too confusing.
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You could add another layer, that has trigger values for the object IDs in the appropriate tiles.

    --Eric
     
    Chibwemwn likes this.
  36. Skullbot

    Skullbot

    Joined:
    Jul 12, 2014
    Posts:
    15
    Hey Eric, something went through my mind today.

    I know it's already possible to change Z value based on layer, but as I use an othographic camera, background layers are lit the same way as foregound layers (with directional light).
    It would be cool to be able to set some sort of color tint to all tiles, per-layer, in the editor.
    This way we could make background layer tiles darker, without having to make a different tileset (or a darker version).

    I don't know if it's possible to change color tint of one layer without impacting others though.
    Maybe with a runtime-created material per layer ?

    Anyway, this feature would be very useful ;)
     
  37. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, you can do this using Tile.SetColorBlock.

    --Eric
     
  38. beit

    beit

    Joined:
    Mar 5, 2015
    Posts:
    24
    Hello Eric and hello to all of you guys,

    I would like to know from you guys which are good Tiled alternatives to create tile maps that can be imported into SpriteTile. Especially I'm looking for a tool that allow, like SpriteTile does, to place "tiles" that are bigger then the normal size (like tho rock door on the spritetile documentation example). Do anyone of you know a tool that allow this?

    Best,

    Enrico
     
  39. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I don't know of any, but how about just using the SpriteTile editor?

    --Eric
     
  40. Rick-

    Rick-

    Joined:
    Oct 13, 2014
    Posts:
    78
    Hi,
    Does SpriteTile support 3d tiles?If not,do you plan on adding this feature?
    I mean,i'm trying to achieve this kind of terrain:



    And i'm searching for a tile map tool that is able to paint 3d tiles for achieving this kind of effect.
    Thx in advance!
     
  41. beit

    beit

    Joined:
    Mar 5, 2015
    Posts:
    24
    Hey Eric,

    you know that is a possible solution but I'm scared about the scale of the map we want to create. Do not misunderstood your tool is amazing and I personally LOVE IT, but I would prefer to have something external to draw the map, if there is anything the market offers.
    It's strange to me that nothing exist(apart of Tiled and a couple more I found), I'm starting to think I could do this differently, but I'm not sure how. How the industry do normally solve this kind of problem? I imagine they "simply" build the tool they need for the job but again, this is a supposition :)
    Thanks anyway for your help
     
  42. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It doesn't do 3D tiles and it never will, sorry. It's just not designed for that.

    --Eric
     
  43. Rick-

    Rick-

    Joined:
    Oct 13, 2014
    Posts:
    78
    Ok,thx anyway.
     
  44. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    So I'm Using this to seth the specific IDs of objects using triggers on a new layer, but it doesn't seem to be working. What am I doing wrong here?

    Code (csharp):
    1.  
    2. Tile.GetTriggerPositions (6, 2, reftriggerPositions);
    3. for (vari = 0; i < triggerPositions.Count; i++)
    4.  {
    5.  
    6. if(checkPointSpawnPos.position == Tile.MapToWorldPosition (triggerPositions[i]))
    7.  {
    8. Debug.Log ("CheckPoint 1");
    9. checkPointSpawnPos.GetComponent<CheckPoint>().checkpointID = 1;
    10.  }
    11.  
    12. }
    13.  
     
  45. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You didn't say what's not working or what you're trying to do, but doing direct float comparisons is generally a bad idea, so maybe you should use WorldToMapPosition for the spawn position, so you're doing integer comparisons instead.

    --Eric
     
  46. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    Oh no! OK, so setting the IDs isn't working, I know this because the debug message isn't being logged. Also, the checkpoint is already being spawned, so all I'm doing is using the triggers on this layer to help me locate and customize a given object in the scene. It looks like I can't match the positions of the triggers and gameobjects. I hope that helps clarify the issues I'm having.
     
  47. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Well, as I said, direct float comparisons aren't the way to go, so use WorldToMapPosition so you can compare ints instead.

    --Eric
     
  48. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    I'm not sure how to compare ints using WorldToMapPosition. I'm looking and the reference guide and this is what I have so far. It's still not working.

    Code (csharp):
    1.  
    2. Tile.GetTriggerPositions (6, 2, reftriggerPositions);
    3. for (vari = 0; i < triggerPositions.Count; i++)
    4. {
    5. varcheckPntPos = Tile.WorldToMapPosition (transform.position, 2);
    6. if(checkPntPos == triggerPositions[i])
    7. {
    8. Debug.Log ("CheckPoint 1");
    9. checkPointSpawnPos.GetComponent<CheckPoint>().checkpointID = 1;
    10. }
    11. }
    12.  
     
  49. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Put in debug statements so you know what you're actually working with.

    --Eric
     
  50. Chibwemwn

    Chibwemwn

    Joined:
    Feb 6, 2013
    Posts:
    129
    But I already am, in the code above. It isn't being logged. This is more confusing than I hoped it would be. I'm pretty lost with this.