Search Unity

Rotorz Tile System for painting 2D and 3D tiles!

Discussion in 'Assets and Asset Store' started by numberkruncher, May 10, 2012.

  1. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Yes this would be absolutely fine!

    Please send me a private message with your invoice number and E-mail address and I will provide you with the BETA :)
     
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I sent this as a PM, but thought I'd post here just incase.

    I downloaded the BETA and began working with it. I noticed when clicking on the button that says Designer Window, the Designer Window does not seem to appear. Is this a known bug, and is there a workaround?
     
  3. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Please send messages regarding the BETA via E-mail since this is easier to track. Many thanks.
     
  4. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In runtime, any efficient function that I know the tile that is not surrounded by other tile ?
     
  5. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    The most efficient way is to examine the value stored within tile data since this is pre-determined:
    TileData.orientationMask

    There are a number of utility functions which may be of use when analysing orientation masks, though the bit structure is fairly straightforward. The next release of Rotorz Tile System includes additional utility functions for rotational symmetry.

    If you want to determine whether a tile is fully surrounded by tiles then the orientation will be "11111111". To clarify the meaning it is useful to know how this value is constructed "111-1X1-111" which would look something like:
    Code (csharp):
    1.  
    2. 111
    3. 1X1
    4. 111
    5.  
    And in bit terms this is constructed as:
    Code (csharp):
    1.  
    2.   1 << 0 | 1 << 1 | 1 << 2
    3. | 1 << 3          | 1 << 4
    4. | 1 << 5 | 1 << 6 | 1 << 7
    5.  
    So if you wanted to determine whether a tile is entirely surrounded by tiles then you could use the following:
    Code (csharp):
    1.  
    2. if (tile.orientationMask == 255) {
    3.     // Tile is entirely surrounded by other tiles.
    4. }
    5.  
    If you wanted to find out whether there was a tile to both the left and right:
    Code (csharp):
    1.  
    2. if ((tile.orientationMask  (1 << 3 | 1 << 4)) == (1 << 3 | 1 << 4)) {
    3.     // There is a tile to both the left and right
    4. }
    5.  
    The C# compiler will evaluate many of the above bit operations at compile-time and so is efficient at runtime. For readability you might want to declare some constants to make your code easier to understand:
    Code (csharp):
    1.  
    2. public const int Mask_LeftAndRight = 1 << 3 | 1 << 4;
    3.  
    4. ...
    5.  
    6. if ((tile.orientationMask  Mask_LeftAndRight) == Mask_LeftAndRight) {
    7.     // There is a tile to both the left and right.
    8. }
    9.  
    I hope that this helps :)
     
  6. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I should clarify, that this will only detect tiles which coalesce with the sampled tile. To determine whether other tiles surround then you will need to use something like the following:
    Code (csharp):
    1.  
    2. if (system.GetTile(row - 1, column - 1) != null  system.GetTile(row - 1, column) != null  etc...) {
    3. }
    4.  
    5. // or, for tiles which are flagged as "Solid":
    6. if (system.IsSolid(row - 1, column - 1)  system.IsSolid(row - 1, column)  etc...) {
    7. }
    8.  
    You could of course implement a simple utility function to ease this process.

    If you require frequent access to such information, then you could generate and maintain a cached data structure which instantly indicates which tiles are surrounded and those which are not. As you will appreciate, this is a fairly straightforward thing to do.
     
  7. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    IMPORTANT NOTICE:
    The current release of Rotorz Tile System does not work properly with Unity 4.3.

    Please send me a private message and I would be happy to provide early access to the next release of Rotorz Tile System.
     
  8. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  9. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Hello,

    In Editor you have a preview of your Tiles while painting. Is there a way to activate that at runtime too? Don't find anything related to the Tile preview at runtime in the doc/forum.

    Thanks
     
  10. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  11. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Thanks for your fast answer, that is exactly what i wanted. It works exactly as expected :)
     
  12. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    I like how the cave platform has multiple mesh variants to remove hidden verts. I'd like to do the same thing to my optimized cube mesh (I don't want the rounded corners and the cave platform UV mapping doesn't match my needs). Would it be possible to extend Rotorz to be able to remove hidden verts and generate a tile like the cave platform from a mesh? I know I could make the 20+ something variants by hand, but that seams like it takes forever to accomplish and would be awesome to have a tool to automate it.

    Edit: Nevermind I just went ahead and made all the variants by removing faces with gamedraw. Worked out pretty well!
     
    Last edited: Nov 18, 2013
  13. TrentSterling

    TrentSterling

    Joined:
    Jan 4, 2013
    Posts:
    99
    Any chance on getting a plops system so you can place prefabs off-grid? Making a grid specifically to place items isn't so great, and the Unity workflow of manual placement is very slow.

    If that system were implemented, could it also be used with the batching setup that is currently used? Mesh Baker doesn't have any sort of 'chunk' system, and I like the idea of being able to merge meshes in a certain area.

    Lastly, when stacking multiple tile systems with the same dimensions, could we also get batching/merging to work vertically?
     
  14. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Would you be able to explain this in greater detail please? What specifically isn't so great about placing items onto a grid?

    I would imagine that you could hook into the tile system optimisation feature to perform something like this with a couple of custom scripts. Here is a skeleton of how I imagine such a thing might be implemented. In order for the following to work you would need to disable automatic tile system stripping since the data is useful whilst performing this optimisation.
    Code (csharp):
    1.  
    2. // Assets/Scripts/VerticalTileMeshSystemCombiner.cs
    3. using UnityEngine;
    4. using Rotorz.Tile;
    5.  
    6. // Attach this behaviour to the LAST tile system as shown in the "RTS: Scene" palette for each
    7. // group of stacked tile systems. Tile systems can be reordered in the scene palette using drag
    8. // and drop.
    9. public class VerticalTileMeshSystemCombiner : MonoBehaviour {
    10.     // Reference to related tile systems (obviously not including self).
    11.     public TileSystem[] relatedTileSystems;
    12. }
    13.  
    14. // Assets/Editor/Scripts/VerticalTileMeshSystemCombinerHook.cs
    15. using UnityEngine;
    16. using UnityEditor;
    17. using Rotorz.Tile;
    18. using Rotorz.Tile.Editor;
    19.  
    20. [InitializeOnLoad]
    21. static class VerticalTileMeshSystemCombinerHook {
    22.     static VerticalTileMeshSystemCombinerHook() {
    23.         // Hook this custom script into the tile system optimisation feature.
    24.         BuildUtility.FinalizeTileSystem += OnFinalizeTileSystem;
    25.     }
    26.  
    27.     static void OnFinalizeTileSystem(IBuildContext context) {
    28.         var verticalCombiner = context.TileSystemGameObject.GetComponent<VerticalTileMeshSystemCombiner>();
    29.  
    30.         // Note: context.TileSystem is null if stripping was specified.
    31.         //       context.TileSystemGameObject is always available.
    32.  
    33.         var system = context.TileSystem;
    34.         var relatedSystems = verticalCombiner.relatedTileSystems;
    35.  
    36.         // First ensure that all related tile systems have the same basic chunk configuration.
    37.         ValidateChunkConfiguration(system, relatedSystems);
    38.  
    39.         // Enumerate through chunks and combine using the Unity API (see Mesh.CombineMeshes)
    40.         // https://docs.unity3d.com/Documentation/ScriptReference/Mesh.CombineMeshes.html
    41.         foreach (var chunk in system.Chunks) {
    42.             foreach (var relatedSystem in relatedSystems) {
    43.                 var relatedChunk = relatedSystem.GetChunkFromTileIndex(chunk.First);
    44.                 if (relatedChunk == null) // Chunk might not exist if there are no tiles within that region!
    45.                     continue;
    46.  
    47.                 //!TODO: Combine meshes here.
    48.  
    49.                 // You could configure and strip related tile system now if desired.
    50.                 StripTileSystem(relatedSystem);
    51.             }
    52.         }
    53.  
    54.         // You could configure and strip tile system now if desired.
    55.         StripTileSystem(system);
    56.     }
    57.  
    58.     static void ValidateChunkConfiguration(TileSystem system, TileSystem[] relatedSystems) {
    59.         foreach (var related in relatedSystems)
    60.             if (related.ChunkWidth != system.ChunkWidth || related.ChunkHeight != system.ChunkHeight)
    61.                 throw new System.Exception(string.Format("Related tile system '{0}' has an incompatible chunk size.", related.name));
    62.     }
    63.  
    64.     static void StripTileSystem(TileSystem system) {
    65.         system.StrippingPreset = StrippingPreset.StripRuntime;
    66.         StrippingUtility.ApplyStripping(system);
    67.     }
    68. }
    69.  
    The above script is incomplete and has not been tested. i.e. You would need to implement the actual mesh combination using the Unity documentation as a guide.

    Note: When combining chunks vertically like this be careful not to exceed the Unity maximum of 64K vertices per mesh.

    I hope that this is of help for you :)
     
    Last edited: Nov 26, 2013
  15. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Hi again,

    Is there a way to create custom dimension tiles (ie a 1x2 tile, to prevent painting in the 2 coordinates, informing the tileSystem that the 2 tiles are used).
    for example a door with a height of 2 tiles and a width of 1 tile.

    Thanks !
     
  16. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Hello there!

    There are currently no special features for multi-part tiles; though tiles that are created from prefabs can indeed exceed the size of a tile cell thus allowing them to span across multiple cells. This feature has been requested in the past, so I have added a tally next to it for you :)

    If you just wanted to fill the "tail" cells of your door with non-empty tiles then you might want to try one of the following:
    • Implement a custom editor and/or runtime script to automatically paint tiles using an "Empty Brush".
    • Add empty orientations for the "tail" of your door.
    Obviously the empty tiles will not be "glued" to the anchor tile but it might be a useful starting point.

    If you wanted to erase obscured tiles upon painting a door then you might want to try implementing a custom editor and/or runtime script to automatically erase tiles which fill the area of the door.

    I hope that this helps; let me know how you get on!!
     
  17. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Thanks for your answer, that is what we was thinking if the answer was no.

    I still have one question : I have an OrientedBrush, using a tileset, correctly set with all the ~50 orientations, all correctly set with/without collider, some orientations linked to some prefab. Is there a way to "duplicate" this Oriented brush, but only using a different tileset, without having to reconfigure all the ~50 orientations, collider/prefab configuration ?

    Thanks !
     
  18. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    In order to use a different tileset you would need to associate the different brushes.

    You could create a custom editor script to automate this, however:
    • Create a custom editor window allowing you to select a tileset asset.
    • Duplicate oriented brush asset (see http://rotorz.com/tilesystem/api?ref=60F41A17).
    • Loop through each orientation within the oriented brush (see http://rotorz.com/tilesystem/api?ref=6B6EE56F).
    • For each variation which is a TilesetBrush, cast to a TilesetBrush, lookup the tileIndex, and then lookup tileset brush from other tileset (selected in window).
    • Mark brush asset as dirty with EditorUtility.SetDirty to ensure that changes are saved.

    This should be fairly straightforward. Let me know if you get stuck and I will do my best to assist :)

    Also, please let me know if I have misunderstood your question :)
     
  19. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Hello again,
    duplicating a brush, looping through his orientations and variations to get their Tileset index is ok. But how can I "link/change" these variations to use the same index on another Tileset?

    On my custom Window, I have the base brush that will be duplicated, the new brush name, and the new Tileset object to use. But I can't figure a way to retrieve Tileset Brushes from the new Tileset. A TilesetBrush object contains a reference to its Tileset. But a Tileset Object don't seems to keep a list of its Tileset Brushes.

    What did I miss?

    Thanks
     
  20. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Brushes which are associated with a particular tileset can be accessed via the brush database:
    Code (csharp):
    1.  
    2. public static TilesetBrush FindTilesetBrushFromIndex(Tileset tileset, int tileIndex) {
    3.     // Lookup record for your tileset using the brush database.
    4.     TilesetAssetRecord otherTilesetRecord = BrushDatabase.Instance.FindTilesetRecord(yourOtherTileset);
    5.  
    6.     // Find first brush in tileset for specified tile index.
    7.     // Note: Whilst not common, you can actually have multiple brushes for the same tile.
    8.     foreach (var record in otherTilesetRecord.BrushRecords) {
    9.         var brush = record.Brush as TilesetBrush;
    10.         if (brush == null)
    11.             continue;
    12.         if (brush.tileIndex == tileIndex)
    13.             return brush;
    14.     }
    15.     return null;
    16. }
    17.  
    The above function could then be consumed as follows:
    Code (csharp):
    1.  
    2. // Lookup current tileset brush from orientation.
    3. var tilesetBrush = orientation.variations[0] as TilesetBrush;
    4. if (tilesetBrush != null) {
    5.     var otherTilesetBrush = FindTilesetBrushFromIndex(otherTileset, tilesetBrush.tileIndex);
    6.  
    7.     // Add some error checking just in case you are missing the brush ;)
    8.     if (otherTilesetBrush == null)
    9.         throw new System.NullReferenceException(string.Format("Could not find brush for index {0} in tileset '{1}'.", tileIndex, otherTileset.DisplayName));
    10.  
    11.     orientation.variations[0] = otherTilesetBrush;
    12. }
    13.  
    Disclaimer: I haven't tested the above. Let me know if you get stuck :)
     
  21. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    Many thanks, i missed the static FindTilesetBrushFromIndex. :)

    I'll try that tomorrow
     
  22. jlevet

    jlevet

    Joined:
    Sep 9, 2013
    Posts:
    34
    It works perfectly :)
     
  23. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Rotorz Tile System version 2.2.2 is now available from the Unity asset store!

    This release addresses some workflow issues with Unity 4.3 sprites by adjusting the behaviour of tile systems with "Sideways" facing tiles.

    By default, existing brushes in your projects will continue to assume the legacy "Sideways" behaviour. The legacy behaviour can also be manually forced for new brushes by setting the extended property Force Legacy Sideways.

    For more information please refer to the release notes:
    http://rotorz.com/tilesystem/release-notes?ver=2.2.2
     
  24. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Hi,

    This system has been great so far.

    How do I detect the coordinates of a mouseclick?

    I'm creating a 2D Isometric game, and I want to enable mouse-click based movement (think Age of Empires). But I'm having a lot of trouble detecting when and where the mouse is clicked. I've tried searching, but answers generally don't work with Rotorz (they work with the Unity terrain objects and such).

    Thanks!
     
  25. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    You can determine the location of the mouse within the tile system using the following:
    Code (csharp):
    1.  
    2. // Find mouse position in world space
    3. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    4. // Nearest point where ray intersects tile system
    5. TileIndex ti = tileSystem.ClosestTileIndexFromRay(ray);
    6.  
    See the following section of the User Guide and API Reference for further information:
    You might also want to take a look at the included demonstration scene within the "Hat Guy" folder which contains an example of painting tiles onto tile systems using mouse input.

    I hope that this helps :)
     
  26. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Thank you! Answered my question perfectly, and thanks for pointing me to the demo.
     
  27. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Do you know of any resources/demos/pages I could read to learn more about using Rotorz for a top-down/isometric game? For example, I want to be able to make a raised cliff tile that is impassable by units.

    Would this functionality be implemented via tiles, or would the tiles be purely aesthetic, and I would have some entirely different game object to handle the path-blocking?

    I have other questions, too, which is why it'd be great if I could find any additional demos or projects to explore and play around with that aren't platformers.
     
  28. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    There are no Rotorz specific resources/demos/pages for the implementation of a top-down/isometric game. There are some fantastic resources on the web though which relate generally to these type of games which may be of interest.

    To achieve pathfinding you could:
    • Use a generic A-star pathfinding solution - I believe that there are some solutions in the asset store!
    • Implement a custom pathfinding solution using the "Solid" tile flag to distinguish between passable and non-passable tiles. Again you could implement an A-star pathfinding solution if desired.
    • Utilise the navigation mesh functionality provided by Unity. You could probably automate the creation of your navigation mesh by scanning through your tiles checking for the "Solid" flag.
    • Or even perform old-school tile based collision detection using functions like TileSystem.IsSolid, TileSystem.TileTraceSolid, TileSystem.TileTrace, etc.
    I hope that this helps a little to get you started!
     
  29. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Thank you very much. That helps plenty! I was approaching the issue with the wrong mindset--trying to define obstructions outside of the pathfinding system. Rather, it seems more correct to define obstructions only in the context of the pathfinding system.

    I will probably go with the second suggestion--implement a custom pathfinding solution. I've implemented A* search before, but it might not even be necessary. I'm designing a tower-defense type of game, with a pre-determined, pretty simplistic path with no mazing. The pathfinding is mainly needed to restrict the tower builder to his playing area, as well as make sure that enemies keep to their path and don't jump over walls.
     
  30. jeremiasz

    jeremiasz

    Joined:
    Feb 17, 2013
    Posts:
    53
    Hello!
    I have Rotorz and Playmaker. My project requires random room generator with rooms lying in a stright line. Additional restriction is that there is a pool of unique rooms which can not appear twice. Is it possible with Rotorz and what should be done in order to achive this?
     
  31. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Randomly fill large tile system with rooms:
    You should be able to use any random room generation algorithm to generate your maps. Be sure to use bulk edit mode when painting lots of tiles to improve performance. You can see examples of this in the user guide.

    Pools of pre-composed tile systems (one per room) - one reusable and one disposable:
    You could perform the following logic (pseudo-code):
    Code (csharp):
    1.  
    2. // Remove current room, put it back into pool or destroy it?
    3. if (currentRoomPool == reusablePool)
    4.    reusablePool.Despawn(currentRoom);
    5. else
    6.    Destroy(currentRoom);
    7.  
    8. // Spawn next room!
    9. currentRoomPool = RandomlyPickBetweenReusablePoolAndOneOffPool();
    10. currentRoom = currentRoomPool.Spawn();
    11.  
    Pool precomposed tile data with reusable tile systems by pooling and reusing tile game objects (3D):
    Another option might be to have a pool of precomposed tile data (rather than actual tile systems) along with pools of tile prefabs (if your game is 3D) and then compose your tile systems on demand. You could use PoolManager by Path-o-logical Games to achieve this since there is already an integration script to paint tiles with pooling capabilities (https://bitbucket.org/rotorz/rtspoolmanagerobjectfactory).

    I hope that this helps to get you started. There is a wealth of information on the web about random map generation including rooms, mazes, etc.
     
  32. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Hi again,

    Is it possible to get the exact mouse position of the click, rather than merely the closest tile?

    Been stuck on this for a while now. :sad:

    Thanks!
     
  33. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Position of click in screen space:
    Code (csharp):
    1.  
    2. Vector2 clickPosition = Input.mousePosition;
    3.  
    4. // Do what you need with clickPosition ...
    5.  
    Position of click on plane of tile system in world space:
    Code (csharp):
    1.  
    2. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    3. float rayDistance;
    4. if (tileSystem.Plane.Raycast(ray, out rayDistance)) {
    5.     Vector3 worldClickPosition = ray.GetPoint(rayDistance);
    6.  
    7.     // Do what you need with worldClickPosition...
    8. }
    9.  
    Position of click on plane of tile system in space local to tile system:
    Code (csharp):
    1.  
    2. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    3. float rayDistance;
    4. if (tileSystem.Plane.Raycast(ray, out rayDistance)) {
    5.     Vector3 worldClickPosition = ray.GetPoint(rayDistance);
    6.     Vector3 localClickPosition = tileSystem.transform.worldToLocalMatrix.MultiplyPoint3x4(worldClickPosition);
    7.  
    8.     // Do what you need with localClickPosition...
    9. }
    10.  
    I hope that this helps!
     
  34. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    My goodness you are amazing. Thanks for the perfect answer again!

    Once I get good enough I would like to help answer questions, too.
     
  35. Dunkelheit

    Dunkelheit

    Joined:
    Sep 3, 2013
    Posts:
    81
    I have some questions:

    - Can I integrate RTS with the brand new 2D features that came with Unity 4.3? I mean, If I only use 2D sprites (not a 3D one even with 2D look), If I want to use the new 2D components like rigidbody2D, collision2D, etc. won't it be a problem?

    - Can I use the new Sprite Editor with RTS as well or RTS have a similar way to grid up your spritesheet?

    - Is there some easy way provided by RTS to make your sprites or prefabs be automatically loaded via XML, JSON or another kind of meta data?

    Thanks for your time!
     
  36. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I have reordered your questions so that my answers flow nicer :)

    A sprite is essentially a game object with several components attached. You can save your sprites objects as prefabs and then associate them with an oriented brush so that they can be painted onto your tile systems.

    Absolutely, you can attach any component or behaviour to your sprite prefabs including the various 2D ones.

    I feel that there are some useful distinctions to be made between the concept of a sprite and that of a tile:

    Unity 4.3 Sprite
    • Sprites are very dynamic and can be moved freely within your scene.
    • One game object per sprite with at the minimum a transform component and a sprite renderer component.
    • Sprite textures can be packed (Pro-only) to improve batching capabilities.
    • The process of painting/erasing sprites is slower than that of procedural tiles.
    • Limited control over edge bleeding in your resulting tile map.
    Procedural Tile
    • Tiles are static by nature and cannot be moved within your scene.
    • Tile is rendered on a per-chunk basis meaning that there are no per-tile game objects (unless of course you have attached a collider or prefab).
    • Tiles are already part of the artist designed tileset and so can already exhibit good batching characteristics.
    • The process of painting/erasing simple tiles (without attachments) is extremely fast.
    • Two very common methods of counteracting edge bleeding are provided including UV Inset (easy) or border (a little harder, but better).
    From a performance perspective I think that the concepts of tiles and sprites work well when used together.

    RTS does not provide any serialization functionality for tile systems since this is a highly specialized requirement on a per project basis. Please refer to the following earlier posts in this thread for some advice on serialization which people have found useful in the past:
    I hope that this answers your questions :)
     
  37. jeremiasz

    jeremiasz

    Joined:
    Feb 17, 2013
    Posts:
    53
    Thanks for replies! :) Found some useful.
     
  38. Dunkelheit

    Dunkelheit

    Joined:
    Sep 3, 2013
    Posts:
    81
    Thank you so much for reply, Rotorz

    I'm still considering the buying of this asset. It's sounds so good for me so far, but I have more questions to do.

    Sorry I know the difference between a sprite and a tileset I was thinking all the time about tiles, maybe just because english is not my native language I just didn't realize it, however thanks for explanation. Now for the questions:

    - I have a tileset to be used to paint my scene. This tileset is assembled only into a file. Can I easily paint my scene without have to cut off my tiles from this tileset in different files?

    - I was looking at the official site and I've checked two amazing features, very impressive:

    "Reduce number of box colliders by combining static tiles NEW!"
    "Paint tiles at runtime using API (ideal for an in-game level designer!)"

    The first one makes RTS fit all tiles into a "unique file" like a bitmap of these painted tiles? If I'm thinking right it's an amazing feature, it can be very helpful to even simulate parallax background layer.

    The second one, RTS on the fly allow me to create an editor for my tileset, thus my game simple can assign this feature and allow the player customize the maps? Is it? If right it's also so awesome.

    Thanks again for your patience and good job.
     
  39. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    In order to paint tiles you will need to assemble your tiles into an atlas texture where tiles are uniformly sized and placed.

    This does not mean combine into a bitmap file...
    This means to combine adjacent box colliders into a fewer number of colliders for tiles painted using a static brush.

    2D tiles are presented as a procedurally rendered mesh of 2-triangle quads which are mapped directly onto your tileset atlas.

    Yes. But please remember that no level persistence is provided. You will need to formulate your own way to save and load maps at runtime.

    I hope that this helps. Let me know if you have further questions regarding the capabilities :)
     
  40. Dunkelheit

    Dunkelheit

    Joined:
    Sep 3, 2013
    Posts:
    81
    Thanks again!

    It's OK for me, at least so far. If I'll get some new question will be about its usage!

    Regards!
     
  41. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    Is it possible to implement multi-group coalesce in a future release? I've for example 4 groups. 1 is normal tiles categories like dirt, rocks, grass, etc.. they all coalesce with each other. Another is tools like bridges, ramps, boxes, etc.. and they all coalesce with each other. Next I have water, which only coalesces with it self. Then finally I have traps which coalesce with nothing. One of my traps is a spike trap. This spike trap has spikes that stick out from it. So 1 spike trap actually takes up 1 box left, 1 box up, 1 box right, and 1 box below it self due to its spikes. Now what I want is for it to coalesce with tools AND normal tiles (but not water, and tools should not coalesce with normal tiles) so I can have multiple versions of the spike block that show/hide the spikes as needed (I don't want them to coalesce with water as they should show spikes in water). This means it needs to coalesce with Group 1 AND Group 2, but there's no option to do this. I could use coalesce with own and group, but that limits to 2 groups and I have more than that. What do you think?
     
    Last edited: Dec 15, 2013
  42. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Would you be able to send me a screenshot to illustrate this via a PM? I am curious to see your setup.

    Do you think that the following two rules would help in this particular instance?
    • Other except those in the specified group.
    • Any except those in the specified group.
     
  43. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    I'm not sure what to show. I've group 1, which is for the majority of the levels normal terrain (dirt, rocks, grass, etc..). I then have several other groups for things like lava, water, acid, tools, and traps. Traps only needs to coalesce with tools and default (group 1) as I could place a Box (wood box) tool next to a spike trap and that removes the spikes danger. Currently the spikes are just inside of the box, which works, but it's ideal and makes more sense to coalesce so I know something is there and just flat out remove that side of the spike trap.

    No, I would need to be able to specifically select what groups it should coalesce with. Maybe it's possible to to add support for array of group ids?
     
  44. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    A visual image would be useful to illustrate your intention since I am not 100% clear on what you are attempting to achieve. With an illustration perhaps I might see a different way to go about this? I am not sure...

    Quoting from above:
    So setting the coalesce mode for "spikes" to Any except water wouldn't do the trick?

    Would introducing another tile system into your scene help matters? like perhaps for your "tools"?
     
    Last edited: Dec 16, 2013
  45. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    No, because I have more groups than that. That was simply an example.

    No, I need to be able to detect if there is a tile next to the spike block from 2 different groups so I can determine what version to display.

    I think I've changed my mind about coalescing with tools though. So I'm just going to move it to default and have it coalesce with default. Basically nevermind, lol. Thanks for the feedback as made me realize after looking at my tools that coalescing with them won't work too great.

    I'd like to pick your brain regarding another topic though. I'm trying to figure out the best way to have cool looking water tiles. Right now I've a block that's properly coalesced with a Flow shader and Flow system on it and it looks "ok", but I'm curious if you've explored water tiles any and what your outcome/suggestions are.
     
  46. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I would be tempted to create a procedural solution where:
    • Water is virtually generated using something like 2D perlin noise (across the entire tile system).
    • Attach a procedural renderer component to either the tile system or on a per chunk basis (WaterTileRenderer).
    • On `WaterTileRenderer.Awake` scan through the tile system to find tiles which were painted using some "Water" brush (or perhaps even empty tiles). Store these results within the renderer so that it doesn't need to perform searches in the future.
    • Mark the mesh as procedural (Mesh.SetDynamic) and then animate the mesh within the renderer as needed using the 2D perlin noise for your initial bump. You might find 3D perlin noise more appropriate for the animation, though you could certainly achieve something with 2D perlin noise.
    I haven't implemented something like this myself before, but I think that it could work quite well if done properly.
     
  47. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Quick question- is it possible to 'undo' when painting tiles?
     
  48. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Not at the moment.
     
  49. Lisk

    Lisk

    Joined:
    Oct 23, 2013
    Posts:
    99
    Okay, thanks for confirming.

    A quick question about tiles. I tried placing a few tiles as follows, and they appear fine in the editor, but in-game, they are missing the rocky "cliff" portion, and also the grass is poorly blended together.

    Editor screenshot:
    $rotorhelp1.png

    In-game screenshot:
    $rotorhelp2.png

    How can I fix these issues?

    Edit: one more issue I'm running into. Tiles appear very distorted and glitchy when another tile is placed above them. See the image:
    $rotorhelp3.png
     
    Last edited: Dec 16, 2013
  50. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    I looked into use mesh deformation, but the problem with that is you lose entirely static batching from what I've seen as the vertices can no longer be edited. I suppose this isn't a big deal if it's used on only a few tiles though, but then you'd issues with coalescing and faces being missing on certain sides so it'd have to merge the vertices together with other water tiles so it animates properly. I need to look into it more as I think this will produce significantly better results than just a flow shader.