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
    Take a look at the Building Prefab from Tile System section of the user guide.

    The benefit is that you can combine the meshes of tiles which have been painted using a "static" brush (i.e. a brush with the static flag ticked). This is much like static batching.
     
  2. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    I have a use case that is a bit odd.

    I have a floor that is like BITGEM but instead of being square/rectangular, the floor design is round. So the tiles are arranged in a circular format instead of square. If not all tiles can be arranged in a circular format, the inner tiles can be laid out in the normal rectangular format and the towards that outer edge of the circle, the tiles start to conform to the circle format.

    Is this something that can be done with Rotorz?
     
    Last edited: Apr 29, 2013
  3. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Your tiles could form a circle at 2x2 but then it would change to a rounded rectangle.

    If you wanted to have larger circles then you would probably need to place these without automatic orientations. Alternatively you could create several different circle meshes (larger than the span of a single tile) and then just place it wherever you want. This strategy will only work for 3D tiles.
     
  4. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    389
    Hi All,

    I've been working on a Unity + Rotorz extension (since I'm no graphic designer) to proceduraly generate 2.5D oriented brushes/tiles. It's not quite ready yet since I want to add a few more features but it's already quite usable for prototyping at minimum although I've created a few scenes which don't look bad at all with what's there already.

    I've created a short video showing it's use if anyone's interested.

     
  5. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Wow! Amazing!!
     
  6. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243
    Agreed! Awesome addon!
     
  7. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I've started messing around with this pack and it is very impressive. For adding details at offsets like rocks, trees, flowers, etc instead of manually adjusting the offsets on a sideways tile system is there anything wrong with just adding extra upward tile systems for detailing? That seems simpler if your height doesn't change radically very often, but I wanted to make sure I wasn't missing something.
     
  8. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Hi Fuzzy_Slippers!

    You can 'fix' the offset of rocks/trees with the "Use as Prefab Offset" function so that in the future you do not need to manually offset upon painting. Alternatively yeah it is absolutely fine to create extra tile systems for detailing.

    I hope this helps!
     
  9. elec²ron

    elec²ron

    Joined:
    Nov 19, 2012
    Posts:
    6
    I am considering a purchase, this looks like a solid system. I am wondering about how height is dealt with in a top down tile system? Is it possible to have a ledge or stair tile to be placed instead of a wall if there is a height difference? This would he a deal breaker for me as I will rarely be creating flat levels.
     
  10. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Each tile system has just two axis of tiles. However, you can create and stack multiple tile systems to achieve the third axis.

    I am not entirely sure what you are asking, but if it helps, 3D tiles are literally just instances of prefabs which are automatically aligned into the tile system upon being painted. Your tile prefabs can be physically larger than the designated tile size allowing some tiles to be taller/wider/longer than others.

    And of course, you can still place and position objects that do not conform to a grid type layout using the regular Unity tools.

    I hope that this helps with your question, please let me know if you have further questions and I will do my best to assist :)
     
  11. elec²ron

    elec²ron

    Joined:
    Nov 19, 2012
    Posts:
    6
    Thanks for the information numberkruncher. All i mean is a different rule for tile placement when there is a height difference at tile borders.

    Essentially i am looking for something like the old NWN toolset or starcraft 2 level editor, like this https://www.youtube.com/watch?v=wEPFlZ_QKVg
    I believe they both operate on the vert and effect the four tiles around them rather than the middle tile and effect the nine tiles around them. This means less possible combinations which allows them to have rules for every possible tile placement including height up or down.

    i can see from the documentation that working with different heights is entirely possible with your current system in conjunction with the normal unity tools. However, what i really need is to pass my assets off to level designers and for it just to work, so they dont have to worry about the actual construction and can concentrate on the flow and aesthetic of the level. The great strength of a system like this is the freeform nature of level building, where if something doesn't work then it can quickly be deleted and painted out differently. If the process has manual tweaking and set up for different heights then i see that as a hindrance and the benefits of an automated system like this begin to disappear.

    So i am wondering if you believe its possible for your tile system to be extended in this way? So it could deal with height in a similar way to the starcraft 2 editor. I would consider paying someone to extend this system or perhaps ask a colleague to look at it.

    Cheers,
    Gordon.
     
  12. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I haven't used the starcraft 2 level editor, but from the video that you provided, it appears to be procedurally generating the terrain upon painting.

    Rotorz Tile System is an object placement system which places instances of tile prefabs. The placement of objects can be influenced by their surrounding tiles, though each tile combination is a separate prefab.

    I think that you are going to want an entirely procedural solution to achieve an editor like the one in the video. So in this scenario, Rotorz Tile System is probably not the best choice for your needs.
     
  13. elec²ron

    elec²ron

    Joined:
    Nov 19, 2012
    Posts:
    6
    No its not procedural, it just places tiling meshes based on a set of rules as does the NWN editor. They are both very similar in function to yours.
     
  14. elec²ron

    elec²ron

    Joined:
    Nov 19, 2012
    Posts:
    6
  15. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  16. Bando

    Bando

    Joined:
    May 12, 2013
    Posts:
    4
  17. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  18. subone

    subone

    Joined:
    Feb 27, 2013
    Posts:
    26
    I am trying to drag tiles to a tile system in my scene, but it's not working.

    How can I do it?
     
  19. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Hi Subone

    Just as follows:
    1. Create a tile system.
    2. Select the tile system.
    3. Select a brush.
    4. Select the "Paint" tool.
    5. Draw on tile system as you would paint in a paint program.
    Please let me know if you are still stuck and I will do my best to assist :)
     
  20. subone

    subone

    Joined:
    Feb 27, 2013
    Posts:
    26
    Thanks, now it worked!
     
  21. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    I forgot to tell you I have found an annoying bug that deselects gameobjects when play/pause is pushed. Can you look into this please?
     
  22. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    When switching between play/edit mode Unity clears and regenerates everything which causes object references to be lost. In the case of the brushes palette, the designer window and the scene palette the currently selected brush, tileset and tile system will usually be retained.

    Q1. Do you have the "Scene" palette window open?

    Q2. Which game object is being deselected?

    Q3. Could you please provide a list of steps which I can follow to reproduce the problem?

    Please send your invoice number and E-mail address via PM if you would like to have access to pre-release versions of Rotorz Tile System. If you are interested, I would be very interested to know whether you experience the same issue in the upcoming version.

    Many thanks!

    Added: After switching to/from play mode you may notice that your tile system has become deselected in the scene hierarchy, but it will still be selected in the scene window (even if the scene window is not displayed). So if you just select the paint tool, the previously selected tile system should automatically "reselect". I have just tested this with the current version and this is working as intended.
     
    Last edited: May 12, 2013
  23. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    hello NumberKruncher

    ive just updated to the latest version and im getting this compile error,
    Assets/Rotorz/Tile System/Editor/RtsBrushPropertyDrawer.cs(22,65): error CS1502: The best overloaded method match for `Rotorz.Tile.Editor.RotorzEditorGUI.BrushInspectorField(UnityEngine.Rect, string, Rotorz.Tile.Brush, bool, bool)' has some invalid arguments

    ive tried deleting and reinstalling rotorz fresh but its still coming up , any idea whats going wrong ?
     
  24. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Q1. Are you installing from the asset store or the new BETA release?

    Q2. Are any other scripts failing to compile when you check the console window?

    Q3. Does the error occur if you create a blank project and then import the latest version of RTS?
     
  25. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    1 installing from asset store
    2 this is the only error in console
    3 not tried that yet
     
  26. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I have just tested a clean install from the asset store using both Unity 3.5.7 and Unity 4.1.2 and no such errors are occurring for me.

    Are you sure that you imported and overwrote all of package assets upon importing package?
     
  27. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    hmm yep i just tried a new project and it compiled ok

    i didnt change any options on import i just used defaults will check this now

    edit
    yeh definately imported the file

    its also giving this error

    Assets/Rotorz/Tile System/Editor/RtsBrushPropertyDrawer.cs(22,65): error CS1503: Argument `#3' cannot convert `Brush' expression to type `Rotorz.Tile.Brush'
     
    Last edited: May 12, 2013
  28. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Okay, this indicates the true cause of the problem. Another script in your project has defined a class in the global space called `Brush` which is conflicting with the Rotorz one. Our class is placed in a namespace, but the current release of GameDraw has theirs in the global namespace which causes this problem.

    If you are using GameDraw you should contact the developers since they tell me that they have a fix for this. Please let me know if you are using GameDraw.
     
  29. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    yep ive got gamedraw installed ok cool ill remove it now not doing art atm, thanks for the help ;)
     
  30. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Cool, like I said, just let the GameDraw developers know that you have the problem also. I had one other customer report this issue and the developers said that they would provide a fixed version immediately via E-mail since the asset store one will of course take a while to approve.

    Another resolution is to avoid "using Rotorz.Tile" in any scripts in your project, but instead, to use explicit references or aliases.
    Code (csharp):
    1.  
    2. // Example of alias, at top of script
    3. using Rotorz.Tile.Brush as RtsBrush;
    4.  
    5. RtsBrush someBrush;
    6.  
    7. // Example of explicit reference
    8. Rotorz.Tile.Brush someBrush;
    9.  
    Perhaps this will be of use to you :)
     
  31. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    ok cool yep all good now , and ill try that alias out as a "brush" might be quite a common class in addons

    oh i had another question while your about

    when creating a tilesystem by script how do i set its facing to upwards ? (tilefacing)

    many thanks
     
  32. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    When creating a tile system via the window, selecting "Upwards" for "Tiles Facing" will automatically initialise the property below it, though this can be overridden in the window as desired. When it comes to creating a tile system manually this is a two stage process. Set the tiles facing property so that tiles are placed correctly, rotate tile system so that it faces upwards:
    Code (csharp):
    1.  
    2. // Create and initialise tile system.
    3. TileSystem system = gameObject.AddComponent<TileSystem>();
    4. system.CreateSystem(1f, 1f, 1f, 10, 15, 30, 30);
    5.  
    6. // Rotate tile system so that it faces upwards using its transform component.
    7. system.transform.localPosition = Vector3.zero;
    8. system.transform.localRotation = Quaternion.Euler(90, 0, 0);
    9.  
    10. // Adjust "Tiles Facing":
    11. system.TilesFacing = TileFacing.Upwards;
    12.  
    Warning: I didn't test the above since I do not have access to Unity at the moment. Please let me know if this doesn't work and I will take another look for you later tonight.
     
    Last edited: May 12, 2013
  33. x_ming_x

    x_ming_x

    Joined:
    Jan 1, 2013
    Posts:
    46
    that gives me

    Assets/Plugins/Map Factory/Scripts/ceMapFactory.cs(853,38): error CS0103: The name `TilesFacing' does not exist in the current context

    i have to go offline now so no rush, when you get back to unity please post an example, thanks again for your excellent help :)
     
  34. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    Sorry that was a typo above, I will update the above example for you :)
     
  35. subone

    subone

    Joined:
    Feb 27, 2013
    Posts:
    26
    @numberkruncher,
    From where can I get FREE characters like HatGuy ?
     
  36. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    There are some cool models in the asset store, even some free ones! Take a look at Toon Baby Dragons for example!

    TurboSquid is also often a good resource for both free and commercial models.

    I hope that this is of help to you!
     
  37. subone

    subone

    Joined:
    Feb 27, 2013
    Posts:
    26
    Thanks! ;)
     
  38. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    The RtsPlayMakerActions have been updated to work with PlayMaker 1.6.0 and now allow you to select brushes more easily using the brush selector interface!

    $playmaker-action-editor.png
     
  39. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    1. New Title System ( Tile Facing - Upwards, Initial Direction - Up )
    2. Paint using auto tileset brush
     
    Last edited: May 21, 2013
  40. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I am not sure exactly what you are asking, but "Tile Facing" has no baring on 2D tiles (though it does affect prefab attachments). The tile facing property allows you to specify whether 3D tiles face upwards or sideways which is useful since it makes assigning prefab offsets considerably easier for users.

    Could you please explain in what you are attempting to achieve with this option? or perhaps provide an illustration?
     
  41. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
  42. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
  43. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    This is not I want, I think the sprite should face upward.
     
  44. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    I have sent you a private message requesting that you send me an example via E-mail so that I can take a closer look at what is going on for you.
     
  45. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In the autotile brush's extended properties, if I checked Attach Prefab, it create a prefab while painting. Can you add a feature that only create a empty gameobject for the tile to be painted ?
     
  46. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    You can just create a blank prefab and associate that using "Attach Prefab" if necessary.

    Why do you want to add blank game objects to your scene?
     
  47. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Actually, It is used for path finding. I want to be more flexible but performance wise, adding prefab is too much. I want to create a gameobject (tile) with specific tag or layer or adding component while painting.
     
  48. numberkruncher

    numberkruncher

    Joined:
    Feb 18, 2012
    Posts:
    953
    The performance difference between instantiating a blank prefab and creating a blank GO shouldn't be a lot different since the prefab is kept in memory once it has been instantiated once. A blank prefab has one component (Transform) as does a blank game object!

    Alternatively, you could manually create the blank game object from within your painter script (if this is for runtime). First paint the tile, then associate the empty game object, and then calculate its position using:
    Code (csharp):
    1.  
    2. // Paint tile using brush.
    3. TileData newTile = yourBrush.Paint(tileSystem, 5, 5);
    4.  
    5. // Attach a blank game object.
    6. newTile.gameObject = new GameObject("blank");
    7. // Position within tile system.
    8. newTile.gameObject.position = tileSystem.WorldPositionFromTileIndex(5, 5);
    9.  
    If your tiles are painted within the Unity editor, then the empty game objects will already exist at runtime, so the performance different is no different.

    I hope that this helps, but please let me know if you have any questions about this approach?
     
  49. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    The approach by script is what I need, thank a lot.
     
  50. GREBENOTS

    GREBENOTS

    Joined:
    Jan 24, 2013
    Posts:
    44
    Your hat guy movement script works great. How did you alleviate the bouncing that happens when you apply force to rigidbodies sliding over box colliders? I can't get my custom movement script to operate very well at all, but yours works amazing.