Search Unity

SpriteTile, a fast dynamic tile system (RELEASED)

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

  1. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Alright, thanks man.
     
  2. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    SpriteTile did unfortunately not live up to my expectation.

    It takes about 2-4 minutes to load (I can't do anything in Unity during this time), and the map does not even load properly after I see my player. It does not provide me with any error. After this point Unity slows down which makes it impossible to edit or do anything I want to do. (I can interact with Unity, but it is literally slowed down so that I have to wait for anything to register before doing something else).

    I did follow the instructions given in the manual provided in setting up the scripts needed to load the map, as well as setting up the layers in Unity.

    Know what could be causing this?
     
  3. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That doesn't sound at all normal. By "takes about 2-4 minutes to load", are you talking about the TileEditor? The first time it launches, it takes Unity a second or two to display it, which seems to have to do with caching dynamic fonts. After that it's instant. I've never seen SpriteTile slow the editor down though; the only way I can think of where that might happen is if you had a huge level that was zoomed way out, so you had many thousands of tiles visible at once. Did you try running the demos?

    --Eric
     
  4. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    The map is not that big. Only 64x64 Tiles - 32x32 Size. Starting the editor is practically instant, however when I load the map (in the game, not the editor) it takes 2-4 min. I will double check by using the demo tomorrow and report the result :)
     
  5. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yeah, something is messed up somewhere. There are a number of demos; all of them start probably within 2-4 milliseconds, not minutes.

    --Eric
     
  6. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    I have tested the demos, and the ones I have tried worked fine after having to manually add the layers and set spritetile sorting layers. The same goes for my test project, works fine besides a few edge clipping. Most reduced by disabling antialiasing - just some [edge clipping] when I move (very little). I am going to be testing the program further.

    I must admit that I am not a big fan of not being able to interact with the map environment, such as placing the player at the correct coordinates. Noticed in one of the demos I inspected that you manually added a vector position for the spawn location.

    Some demos are strictly in JavaScript, not C#.



    Where may I suggest improvements to SpriteTile?
    There are several "shortcuts" that would increase workflow tremendously, and some functions missing altogether (I am unable to find them).

    Z - Rotate item 90 degrees
    Hold R - Place tiles in a rectangle shape (drag to shape)
    X - Flip tile X direction
    Y - Flip tile Y direction

    I would also recommend you replace text and turn them into icons such as the "Fill Area" with a simple paint bucket, as us humans can more easily recognize shapes/objects than plain text. This will also increase the workflow by making it easier to find the tools you are looking for. The same goes for the rest where applicable.

    It should also be possible for the editor to make the sorting layers for you, instead of having to press manually add layers and press "Set SpriteTile... " button over and over again after changes.


    I am unable to find any current list of shortcuts, if there are any.



    I have discovered an editor bug.
    At Layer 1 this seems fine, I am able to see the layer below it just fine as well. (Layer 0 is just ground)


    At Layer 2 everything is messed up and does not display the tiles that I have rotated properly. Can this be fixed?
    Work is close to impossible at this point. I have no way of knowing what goes where when building upon them!
     
    Last edited: Apr 7, 2015
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If you check the keyboard shortcut document (called "TileEditor keyboard shortcuts"), you can see that 90° rotation is included. Tile flipping isn't supported. Not quite sure what you mean by "place in a rectangular shape"...is that like right-click drag-selecting, then hitting F to fill? You can use the preview function to check the level interactively in the scene view. I actually started replacing text buttons with icons at one point, but personally found it worse for quick recognition, oddly enough, so I abandoned that. (Although it would probably be beneficial for non-English speakers.) It's sadly not possible for the editor to make sorting layers, since the Unity API doesn't allow for it, or I would have done that long ago.

    You're right about the not showing rotation bug...not sure how I missed that. I'll fix it.

    --Eric
     
    Ivanskodje likes this.
  8. Ivanskodje

    Ivanskodje

    Joined:
    Mar 29, 2015
    Posts:
    57
    Isn't supported - is difficult to implement that? One would think it would be just as easy as flipping an sprite in Unity (inverting the face axis). Not only would it make work easier, but it would also save space as we can recycle same textures instead of having to add two equal textures that are mirrored :)

    I have discovered the right click drag and fill, but it can be cumbersome. A simple button to click+drag which places them at once would go a long way.
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    As I recall Unity had some issues with flipped sprites early on (the colliders maybe?). Not sure if that's been resolved, but I ended up finding it simpler to just have flipped tile textures. At first it seems like that wouldn't be the case, but it's typically actually less resources (no need to store bits for flipped tiles), unless you use lots of flipped tiles I suppose; and a little simpler API (no need for get/set flipped tile functions).

    --Eric
     
  10. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Is it possible to update the terrain group to support single tile row/column? This will make SpriteTile capable of auto-selecting tiles for a basic 2d platformer layout.

    The image will probably be a better explanation
     
    tddaniels likes this.
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, I can add different layouts for different types of terrain groups.

    --Eric
     
  12. jutemachine

    jutemachine

    Joined:
    Apr 8, 2015
    Posts:
    2
    Hello!

    I just bought SpriteTile yesterday, and I must say I am very pleased with it. It works very well, and is super fast!

    I just have a small problem, must be something I just don't see. I have my tile set which are 16x16 pixels tiles. I want my tiles to be 1x1 in Unity units and I use physics colliders for the tiles. When I set my new Level up with : "Tile.NewLevel (new Int2(levelSize), 0, tileSize, 0f, LayerLock.None);" with tileSize = 1, the tiles are still 0.16x0.16 but there is space between them so I use "Tile.SetTileScale (1f / 0.16f);" so the tiles are 1x1. The problem is that the auto physics colliders generated for each tile are still squares of 0.16x0.16 (in unity units) while the tiles are 1x1. Here is an image of what I mean:
    upload_2015-4-8_23-6-13.png

    Is there a way to make the size of the colliders automatically scale with the tileSize I use other than setting a custom collider manually for each Tile?

    Hope it makes sense and thanks!
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, I'm glad you're pleased with it! Have you set the pixels to units ratio (in the texture import settings) for your tiles to 16? Then you can use a tile size of 1, and not scale anything.

    --Eric
     
  14. jutemachine

    jutemachine

    Joined:
    Apr 8, 2015
    Posts:
    2
    Thanks a lot, works perfectly!

    Did not know about this pixels per unit thing, and was wondering why it was 100 pixels per unit!
     
  15. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Then can we do something a bit more complex?


    With this layout can be created every possible shape that doesn't involve slopes. If you want i can create a table with each tile from the images and a grid for each tile with which surrounding tiles are free and which are occupied. Then you can insert all the cases into SpriteTile. Its as simple as white lines are non occupied tile next to the line and its diagonals. White square is non occupied diagonal tile.
     
    Ivanskodje likes this.
  16. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's primarily data-driven, so as far as I know that's possible. However not everybody is going to want something that complex, so I'd probably have several simpler layouts that you can choose from (or use all of together), rather than one complex layout.

    --Eric
     
  17. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    This is what is already in SpriteTile, plus single tile line mixed together. I just played a bit and if you add just a single line to what you have already you will need every single one of those tiles to make 'em both layouts work together.
    Several smaller layouts that work together will be better because it will be easier for people to understand layouts.
    As i said if you just add single line. It will be enough(needed?) for all those additional tiles to be included "in the background" - the image shows it. The problem is that there is no way to cover all the tiles with a coherent layout. The tiles are a lot even if the layout itself is not something fancy and just a standard full 2d platformer layout without slopes.

    edited for clarity, yes my English sucks

     
    Last edited: Apr 9, 2015
  18. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Excuse me. I recently contacted SpriteTile, which is a perfect tool to make 2d games. However, I have some other request. Currently, I am involved with developing an online game and I need to generate levels on the server side. But SpriteTile is deeply integrated with Unity, So I can not use SpriteTile on server side directly.

    Fortunately, I find there is a solution. I can generate TMX file on the server side. SpriteTile provide an option to import TMX file in the editor but it does not provide an exposed function to import TMX file via script. However, I find there is a function named BuildTMXMap in FileIO.js. so, Can I expose this function to the client to load TMX file if I can specify the Tile Set correctly via some parameters?
     
  19. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There isn't any support for loading TMX files at runtime, nor will there ever be any (it's not feasible since there is some manual setup required), but you can run Unity on the server (headless). FileIO is an editor script, which can only run in the editor.

    Another possibility is generating SpriteTile levels without Unity. I asked earlier if there was any interest in me posting the SpriteTile level specs, and there didn't seem to be any at the time, but if there is now, then I can still do that.

    --Eric
     
    JayJennings likes this.
  20. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Please provide the specification of SpriteTile level format. If I fully understand the specification, Can I generate SpriteTile level file via script on the server, such as Python?
     
  21. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sure; it's just data.

    --Eric
     
  22. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Thank! Where can I find the specification of SpriteTile level format?
     
  23. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I would have to write it first. If you don't want to wait, you can look at the source code for saving levels; it's fairly straightforward.

    --Eric
     
  24. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Waiting for you! Could you post it here or anywhere when you complete? Thanks!
     
  25. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    SpriteTile 2.9 is out! Submitting to the asset store next.

    Additions:
    • Tile.UseRandomGroup function, which will cause SetTile and SetTileBlock to use the specified random group (using the groups loaded with LoadGroups).
    • Tile.UseTerrainGroup function, which likewise will use the specified terrain groups.

    Fixes:
    • Tile.CopyGroupToPosition sets physics colliders for any tiles in the group that should have them.

    TileEditor Additions:
    • The "Import" button for TMX files has a "Make tiles with the Collider option checked have colliders in the map after import" option, which does exactly that.

    TileEditor Changes:
    • Custom colliders work with multi-selected tiles, so the same custom collider will be applied to all selected tiles. (Also multi-selected tiles can be changed to auto colliders.)
    • When creating a new level, the size of the current level is used rather than defaulting to 50x50.

    TileEditor Fixes:
    • When other layers besides the current layer are visible, tile rotation is drawn correctly for those layers.

    --Eric
     
  26. Drapes81

    Drapes81

    Joined:
    Nov 22, 2014
    Posts:
    1
    Hey, this might have been asked/answered already but it's a pretty quick question - how do I use UI components (buttons etc) in conjunction with SpriteTile? Fairly new to Unity and trying to add some buttons at the bottom of my screen but they get hidden behind the level when it loads in and the map no longer loads when I move my camera.
     
  27. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use sorting layers for that. Also the UI should be in world space if you want it to interact with other objects in the scene.

    --Eric
     
  28. Neroir

    Neroir

    Joined:
    Feb 2, 2015
    Posts:
    7
    Oh, great to see you added it! Time for an update ;)
     
  29. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    Is right clicking the only way to set a selection? It's pretty hard to do with a mac trackpad and/or a stylus.
     
  30. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Currently it is, but if you have a suggestion for a different way, I can implement that.

    --Eric
     
  31. Jay-Pavlina

    Jay-Pavlina

    Joined:
    Feb 19, 2012
    Posts:
    195
    Holding a modifier key is probably easiest. It could also be a separate tool with a keyboard shortcut.

    Some questions...
    1. What's the recommending workflow for placing prefabs, like enemies?
    2. How do you modify properties for a single tile? For example, how would you make a tile slippery?
     
  32. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, I implemented Command-click for selection; let me know if you want the updated TileEditor file.

    1. It depends on how you want to handle it, but a couple of common ways are to use the preview function in the TileEditor and place prefabs in the scene view, or else programmatically place things by using triggers or tile values along with GetTriggerPositions/GetTilePositions.

    2. Again it depends on what you're doing exactly, but if you're using physics colliders, one way is to use SetColliderMaterial and put slippery tiles on a different layer. You could also use triggers to indicate different properties, and use SetColliderMaterial based on the trigger value.

    --Eric
     
  33. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The file format specs are now online, here.

    --Eric
     
  34. Neroir

    Neroir

    Joined:
    Feb 2, 2015
    Posts:
    7
    Hi.

    What do you think about being able to add a name/description for the triggers, and assign a trigger to a cell using a dropdown list that shows the trigger number and the name of the trigger, instead of just entering a number?
     
  35. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That seems reasonable.

    --Eric
     
  36. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    2. IMO unity's 2d physics are bad for 2d platformer so I use them as little as possible and my characters don't have colliders, only tiles have. Characters instead use Raycast/RaycastHit2D. I would do it based on tile's tag with Tile.SetColliderTag and then check with rayBottomHit.collider.tag .
     
  37. Neroir

    Neroir

    Joined:
    Feb 2, 2015
    Posts:
    7
    Hi.

    When editing the level in the editor, it looks ok, but when running the game, I'm having a lot of edge clipping problems. Any suggestion for avoiding them or for finding what's causing them?
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hi, can you explain what you mean by edge clipping problems? (Probably screenshots would help.)

    --Eric
     
  39. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I had an idea brewing in my head for a while, and I've finally decided to leave it here. How about being able to place prefabs you made within the tile editor? Would that be possible or no? Now that I think about it, this has probably been suggested before. . _.
     
  40. tddaniels

    tddaniels

    Joined:
    Mar 19, 2013
    Posts:
    5
    Also interested in seeing different terrain group layouts - not sure if this helps or if its depressing but technically this is a chart of all possible tileset orientations: http://opengameart.org/content/seamless-tileset-template-ii
     
  41. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, that's on the to-do list.

    Well, as I mentioned earlier, I think a few different small layouts is easier to deal with than one mega-layout, particularly since it's common to not use them all.

    --Eric
     
  42. Neroir

    Neroir

    Joined:
    Feb 2, 2015
    Posts:
    7
    Right now I'm behind a proxy and cannot upload any image, but in a previous post Ivanskodje uploaded an example:

    I have the same problem, but much worse, because artifacts appear in every tile when I'm moving the camera (sometimes even without moving the camera). I suppose it's not a SpriteTile problem but something I'm doing wrong with the tiles, but I really don't know what....
     
  43. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    If it's the background showing through between tiles, scale the tiles up very slightly, i.e. Tile.SetTileScale (1.001).

    --Eric
     
  44. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    I can give you or anyone else source changes you need to make to import the tileset template below - its essentially the same (as the one you linked) just arranged in a way that made most sense to me.

    Or I can privately send 3 changed source files as long as Eric agrees and confirms that the person who want them owns SpriteTile.

     
  45. Blue-Wolf

    Blue-Wolf

    Joined:
    May 27, 2014
    Posts:
    20
    Eric, does SpriteTile work with Unity 5.0?

    Also, would it or its API allow for runtime procedural level generation?

    Thanks!

    Edit: Nevermind, I see the answer is yes to both. I was reading the Asset Store description, not the forum one. Cheers!
     
    Last edited: Apr 27, 2015
  46. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    That sounds reasonable.

    --Eric
     
  47. G0sub

    G0sub

    Joined:
    Apr 28, 2015
    Posts:
    10
    First off, thanks for SpriteTile! I ran into an odd issue with SetMapBlock and collision that I wanted to bring up.

    I'm creating levels dynamically by stitching together small SpriteTile levels using SetMapBlock. Each level represents a "room" in the overall level. Here's an example of how I'm using SetMapBlock:

    Code (CSharp):
    1. Tile.NewLevel(new Int2(mapWidth, mapHeight), 0, 1f, 0, LayerLock.None);
    2.  
    3. // In a loop, I'll load and set blocks of data into the map
    4. TextAsset data = Resources.Load("Data/Rooms/Room1") as TextAsset;
    5. MapData chunk = Tile.LoadMapBlock(data.bytes);
    6. Tile.SetMapBlock(new Int2(roomOffsetX, roomOffsetY), 0, chunk);
    However, using this method causes the collision not to function correctly even though the tiles have "Collider" and "Physics collider" options set.

    I found a workaround by iterating over the map and resetting the collision flags using SetCollider which appears to fix the issue:

    Code (CSharp):
    1. for (int y = 0; y < mapHeight; ++y) {
    2.   for (int x = 0; x < mapWidth; ++x) {
    3.     Int2 pos = new Int2(x, y);
    4.     Tile.SetCollider(pos, Tile.GetCollider(pos));
    5.   }
    6. }
    Unless I'm using SetMapBlock in an unintended way, I'd expect that the collision should function as if the level was loaded using LoadLevel. Not a huge issue since there's an easy workaround, but just FYI.
     
  48. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Sorry about that; I fixed the same problem for Tile.CopyGroupToPosition last update, but overlooked SetMapBlock. I've fixed it for the next version, so let me know if you want the updated Tile.cs script.

    --Eric
     
  49. tddaniels

    tddaniels

    Joined:
    Mar 19, 2013
    Posts:
    5
    I'm interested in getting the changes! That would be awesome thanks!
     
  50. Neroir

    Neroir

    Joined:
    Feb 2, 2015
    Posts:
    7
    Thanks for your support Eric. It's not the background showing between tiles... changing Scale didn't helped. I think it's something related with the way I created or imported the tiles, because I've tried to use some of the tiles provided in the GemHunt project and the problem did not happened.