Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] RPG Map Editor

Discussion in 'Assets and Asset Store' started by CreativeSpore, Nov 6, 2014.

  1. LarryWP

    LarryWP

    Joined:
    Oct 31, 2014
    Posts:
    57
    I purchased this asset tonight, and when I paint a few tiles and then play the map, I get 329 of these Assertions:

    Assertion failed on expression: '!performAutorepaint || GetApplication().MayUpdate()'
    UnityEditor.AssetDatabase:SaveAssets()
    CreativeSpore.RpgMapEditor.AutoTileMap:SaveMap(Int32, Int32) (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMap.cs:469)
    CreativeSpore.RpgMapEditor.AutoTileMapEditor:OnDisable() (at Assets/CreativeSpore/RpgMapEditor/Scripts/Editor/AutoTileMapEditor.cs:137)
    UnityEditor.AssetDatabase:SaveAssets()
    CreativeSpore.RpgMapEditor.AutoTileMap:SaveMap(Int32, Int32) (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMap.cs:469)
    CreativeSpore.RpgMapEditor.AutoTileMapEditor:OnDisable() (at Assets/CreativeSpore/RpgMapEditor/Scripts/Editor/AutoTileMapEditor.cs:137)

    I'm painting on the Big Map demo scene.
     
  2. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    I couldn't replicate this error. Could you tell me what version of Unity are you using?
    I found this searching in google, but not sure if it's related:
    https://issuetracker.unity3d.com/is...update-log-appears-when-usiln-lighting-window
     
  3. LarryWP

    LarryWP

    Joined:
    Oct 31, 2014
    Posts:
    57
    5.5.0f3. Dang, your'e good! I do have the lighting window open in the Inspector. I thought it was related to the asset. I will be working again in a bit and I will find out if this is the problem. I will disable the window.

    This asset has a ton of features. I am very pleased to see all that it can do. Thank you!

    Update: Looks like that was the issue. It is not giving that assertion anymore since disabling the Lighting tab.

    One question... If I want to use one of your demo scenes to use as a foundation for my scene (since they have so many neat items installed), what procedure do I take to keep the original demo scene from changing also? I'm stuck on this simple issue and I can't believe it. I don't want future asset updates to erase my work. Probably will just have to start from scratch, and I like your tilesets.
     
    Last edited: Jan 15, 2017
  4. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I'm glad that was the issue :)
    If you are going to start working from one the of the demo scenes, you should make a copy of these things:
    • Demo scene
    • Map Data: ex: AutoTilemapData1, then change this data in the copied scene tilemap.
    • Autotileset.asset
    • Autotileset.png, this is the atlas, and you should change the atlas of the copied autotileset for the copy of the atlas
     
  5. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    Thanks! All bugs fixed (and animation bug)
     
    CreativeSpore likes this.
  6. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    Is it possible to do a 2.5D effect like in Diablo II/Conquer Online?




     
  7. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    You can create the terrain using RPG Map Editor, and rotate it or the camera to make it look with an isometric view.
    Also, you can place 3D object over the terrain.
    It would be more like the Conquer2 screen.
    But you cannot create higher areas, like in diablo, using the tilemap editor. Everything will be in a place and you can change only the Z position of the tiles perpendicular to the tilemap surface.
     
    MrIconic likes this.
  8. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    When I change the cameras rotation the sprites/3d characters, perceived mouse cursor position (when I click the map to change it)... everything's position is off by the cameras rotation. Am I doing something wrong?

    Another photo from Conquer where there is a tiled floor that shows what the view of the grid would be.

     
  9. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Try changing the rotation of the AutoTileMap Data gameObject:
    upload_2017-1-24_18-57-20.png
    upload_2017-1-24_18-57-31.png

    Anyway, the asset is not thought to work in this way. You can draw a map and then rotate it to look like an isometric map, but some subsystems won't work in this layout and should be modified.
     
    gferrari likes this.
  10. DBarlok

    DBarlok

    Joined:
    Apr 24, 2013
    Posts:
    268
    @CreativeSpore: Congrats! Just amazing. Im planning on buying the asset. A question friend, how can i do oblique proyection, like Ultima 7, for example? Im scratching my head to solve this one for a demo...
     
  11. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    For a top-down or Oblique projection you don't need to change anything. The asset is already prepared for that.
    For an isometric view, as I said, you can only change the tilemap rotation to make it look isometric, but as you see, it's a trick and not everything will work perfectly so you would need to make some changes to adapt it to the new perspective.
     
  12. hyperiums

    hyperiums

    Joined:
    Oct 1, 2016
    Posts:
    4
    @CreativeSpore I just purchased this asset and I'm sure I'm doing something wrong. I imported it and then loaded the scene for demo2 - Farm House and was met with the following error
    Code (csharp):
    1.  
    2. FormatException: Input string was not in the correct format
    3. System.Int32.Parse (System.String s) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:629)
    4. System.Convert.ToInt32 (System.String value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Convert.cs:1270)
    5. CreativeSpore.RpgMapEditor.AutoTileMapSerializeData+MetadataChunk.IsVersionAboveOrEqual (System.String versionToCompare) (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMapSerializeData.cs:31)
    6. CreativeSpore.RpgMapEditor.AutoTileMapSerializeData+<LoadToMap>c__Iterator0.MoveNext () (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMapSerializeData.cs:215)
    7. CreativeSpore.RpgMapEditor.AutoTileMap+<LoadMapAsync>c__Iterator0.MoveNext () (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMap.cs:414)
    8. CreativeSpore.RpgMapEditor.AutoTileMap.LoadMap () (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMap.cs:392)
    9. CreativeSpore.RpgMapEditor.AutoTileMap.Awake () (at Assets/CreativeSpore/RpgMapEditor/Scripts/AutoTileMap/AutoTileMap.cs:224)
    10.  
    Any idea what I did wrong? I closed unity, loaded the scene fresh again and met the same error. Once I try running the scene just to see if it does anything I see
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. CreativeSpore.RpgMapEditor.IsoSpriteController.OnMapLoaded (CreativeSpore.RpgMapEditor.AutoTileMap autoTileMap) (at Assets/CreativeSpore/RpgMapEditor/Scripts/RpgFramework/Controllers/IsoSpriteController.cs:34)
    4. CreativeSpore.RpgMapEditor.IsoSpriteController.Start () (at Assets/CreativeSpore/RpgMapEditor/Scripts/RpgFramework/Controllers/IsoSpriteController.cs:28)
    5.  
    Thanks for your help. If there's a more appropriate place to ask these question please let me know.

    Edit: Did a bit of digging in AutoTileMapSerializeData.cs and I see
    Code (csharp):
    1.  
    2. if (System.Convert.ToInt32(curVersion) < System.Convert.ToInt32(compareVersion))
    3. which curVersion comes from
    4. string[] curVersion = version.Split('.');
    5. which comes from
    6. public string version = k_version;
    7. and k_version is a constant string of 1.2.4
    8.  
    9. I put a break point on the if statement and it claims k_version is undefined which leads curVersion to be
    10.         [0]    "312e322e34"    System.String
    11.  
    Hopefully that helps you're debugging process some.
     
    Last edited: Feb 5, 2017
  13. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    It looks like a problem with serialization. What version of unity are you using?
    I'm not sure what is causing this, unless you downloaded the unity 5.5 version and try to use it in a lower version.
    Also, it could happens if you use serialization in Text mode, instead of binary. Could you check the Asset Serialization mode in Editor Settings?
     
  14. lookx2

    lookx2

    Joined:
    Jun 24, 2016
    Posts:
    20
    Hi,

    Is it possible to use advanced lighting in map? I'd try to change the sprite/default to diffuse and add a point light,
    but the map only accept lighting on the back. How can i achieve the map and the character to receieve point light and shadow?
    Thank you!
     
  15. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    You need to un-comment this line:
    upload_2017-2-6_9-14-52.png
    I don't remember why it was commented, it shouldn't.
    To enable shadows, just change the Shadow mode here:
    upload_2017-2-6_9-16-39.png

    I have attached a fix for the lights.
     

    Attached Files:

  16. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I have created a patch to fix the issue when using the tool in a project with serialization mode set to Force Text.
    Apply the attached package and let me know if it's fixed.
     

    Attached Files:

  17. lookx2

    lookx2

    Joined:
    Jun 24, 2016
    Posts:
    20
    Thank you for you reply, the map can receieve light now, But i still cannot get it receive show.
    What shader should I use for the map to receieve shadow? It's find when use Mobile/Diffuse, But the transparency has gone if I don't use sprite's shader
    Thank you
     
  18. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Digging a little I found you need to use a special shader for that.
    https://forum.unity3d.com/threads/why-cant-sprites-gameobjects-cast-shadows.215461/
    Maybe you can modify the Sprite/Default shader to enable shadow casting
     
  19. lookx2

    lookx2

    Joined:
    Jun 24, 2016
    Posts:
    20
    CreativeSpore likes this.
  20. hyperiums

    hyperiums

    Joined:
    Oct 1, 2016
    Posts:
    4
    @CreativeSpore
    Sorry for the late reply. I only work on this on Saturdays. The patch seems to have done the trick! Thank you.
     
    CreativeSpore likes this.
  21. HotkangChen

    HotkangChen

    Joined:
    Mar 18, 2017
    Posts:
    9
    why there are too many black line?
    English is not my first language..so My expression maybe very strange.so sorry for that EC5C7807-F045-4F51-9BC3-61CF46EA9455.jpg
     
    Last edited: Mar 18, 2017
  22. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    The black lines between tiles appear when you are not using a pixel perfect camera. They shouldn't appear in the GameView when using the provided pixel perfect camera called PlayerCamera.
     
  23. HotkangChen

    HotkangChen

    Joined:
    Mar 18, 2017
    Posts:
    9
    thanks for reply,I don't changed anythings about the Camera and it actually have used the PlayerCamera, but When I use the windows, it performs well, but black lines appear when Mac.
     
  24. Aeolun

    Aeolun

    Joined:
    Feb 14, 2014
    Posts:
    4
    I've just started working on my game again, and updated to Unity 5.5. And for the life of me, I cannot figure out why I cannot load any tilemap any more with my current code. I also updated all libraries I had in the game to the latest version.

    Code to load a map from XML is this:

    Code (CSharp):
    1. AutoTileMap.ClearMap();
    2.   AutoTileMapSerializeData.LoadFromFile(Application.dataPath + "\\maps\\" + NextLevel + "\\map.xml").LoadToMap(this.AutoTileMap);
    3.   AutoTileMap.LoadMap();
    4.   AutoTileMap.RefreshAllTiles();
    But while I can see AutoTileMap is doing everything in regards to putting the data in with LoadToMap, it doesn't seem to actually wish to display it.

    Looking at the actual gameobjects, it seems that none of the loaded tiles actually translate into chunks in the Object Tree.
     
    Last edited: Mar 22, 2017
  25. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Are the black lines appearing in the game view? They sometimes appear in the scene view and in the gameview only if you are using a free aspect ratio with an odd number of horizontal pixels. Also if the zoom level of the camera is not an integer could affect.
     
  26. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The problem with the serialization is caused when the project is using a Text Serialization mode and when the project is opened with an old version of Unity. In Unity 5.5 there is a compatibility issue when the project is opened with a lower version. The autotilemap.asset files could become corrupted.

    Use serialization mode Binary and try to remove the Library folder when opening the project again.
     
  27. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    Hi there,

    I was looking at the support for 8-directional animation in the kit and comparing it against an asset called the Customizable Pixel Art Character Kit (CPACK). They have a stand pose for each direction which is nice (as I don't often see that with the usual 8 direction poses). Just wondering how/if that would work with the DirectionalAnimationController. I don't see how it would use the 8 poses for the animations then switch to the first frame when standing. Below is a sample sheet from CPACK so you can see how they have it setup, first frame on each row is the standing pose while the other 8 are the animated ones. Would you have to modify the controller to handle this or would you consider adding support for this in the future (if it's not already there). Thanks!

     
  28. mikedodgerstout

    mikedodgerstout

    Joined:
    Oct 14, 2015
    Posts:
    5
    I think I found a bug in the collision detection, and I wanted to let you know.

    In AutoTileMap.cs, lines 1117-1128 there's code that loops through all the layers to see if there is collision, and returns the first bit it finds.

    Code (CSharp):
    1.  
    2. for( int iLayer = MapLayers.Count - 1; iLayer >= 0; --iLayer )
    3. {
    4.     if (MapLayers[iLayer].LayerType == eLayerType.Ground)
    5.     {
    6.         eTileCollisionType tileCollType = GetAutotileCollision(tile_x, tile_y, iLayer, vTileOffset);
    7.         if (tileCollType != eTileCollisionType.EMPTY && tileCollType != eTileCollisionType.OVERLAY) //remove Overlay check???
    8.         {
    9.             return tileCollType;
    10.         }
    11.     }
    12. }
    13. return eTileCollisionType.PASSABLE;
    14.  
    The problem I was having is that this would look at the first layer in the pile, call GetAutotileCollision and that function would return eCollisionType.PASSABLE. It then wouldn't look at any other layers. So the only layer that could have collision was the first one it checked.

    I changed the inside if statement to:

    Code (CSharp):
    1.  
    2. if (tileCollType != eTileCollisionType.PASSABLE && tileCollType != eTileCollisionType.EMPTY && tileCollType != eTileCollisionType.OVERLAY)
    3.  
    Basically I told it to ignore "PASSABLE" in addition to EMPTY and OVERLAY results that it got, so it'd keep looking for collision if it didn't find it on the first layer. Once i did that, it started finding all the collision again.
     
    CreativeSpore and zenGarden like this.
  29. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Could this become an update of the plugin ? Or it is too much work ?

    About AI attacking the player, can we have the AI not overlapping each other keeping some square collision on foots ?
    Something like obstacle avoidance, or must we code it ourselves ?
     
  30. mikedodgerstout

    mikedodgerstout

    Joined:
    Oct 14, 2015
    Posts:
    5
    I've been trying to get tile-based movement working, and found an issue in GetAutoTile.

    In AutoTileMap.cs, lines 723-748:

    Code (CSharp):
    1.  
    2. private AutoTile m_emptyAutoTile = new AutoTile() { Id = k_emptyTileId };
    3.        
    4. /// <summary>
    5. /// Return the AutoTile data for a tile in the provided tile position and layer
    6. /// </summary>
    7. /// <param name="gridX">Tile x position of the map</param>
    8. /// <param name="gridY">Tile y position of the map</param>
    9. /// <param name="iLayer">Tile layer, see eTileLayer </param>
    10. /// <returns></returns>
    11. public AutoTile GetAutoTile( int gridX, int gridY, int iLayer )
    12. {
    13.     m_emptyAutoTile.TileX = gridX;
    14.     m_emptyAutoTile.TileY = gridY;
    15.  
    16.     if (IsValidAutoTilePos(gridX, gridY) && iLayer < MapLayers.Count)
    17.     {
    18.         m_emptyAutoTile.Id = k_emptyTileId;
    19.         AutoTile autoTile = TileLayers[MapLayers[iLayer].TileLayerIdx][gridX + gridY * MapTileWidth];
    20.         return (MapLayers == null || autoTile == null) ? m_emptyAutoTile : autoTile;
    21.     }
    22.     else
    23.     {
    24.         m_emptyAutoTile.Id = k_outofboundsTileId;
    25.         return m_emptyAutoTile;
    26.     }
    27. }
    At the top, a global variable m_emptyAutoTile is created and points to an empty tile. This tile gets changed and then a reference to it is returned at the bottom of the function.

    The problem is this, TileMovementBehavior.c uses GetAutoTileByPosition to set m_CurTile. Then, when you do a collision check later (line 82) to check another cell with GetCellAutotilecollision, it overwrites m_emptyAutoTile. However, m_CurTile is still referencing that memory, and so it gets changed to point at that new cell, not the original cell. The result is that no movement ever happens.

    I fixed this by adding one line into AutoTileMap.cs

    Code (CSharp):
    1. public AutoTile GetAutoTile( int gridX, int gridY, int iLayer )
    2. {
    3.    //MY NEW LINE
    4.     m_emptyAutoTile = new AutoTile() { Id = k_emptyTileId };
    5.  
    6.     m_emptyAutoTile.TileX = gridX;
    7.     m_emptyAutoTile.TileY = gridY;
    8.  
    9.     if (IsValidAutoTilePos(gridX, gridY) && iLayer < MapLayers.Count)
    10.     {
    11.         m_emptyAutoTile.Id = k_emptyTileId;
    12.         AutoTile autoTile = TileLayers[MapLayers[iLayer].TileLayerIdx][gridX + gridY * MapTileWidth];
    13.         return (MapLayers == null || autoTile == null) ? m_emptyAutoTile : autoTile;
    14.     }
    15.     else
    16.     {
    17.         m_emptyAutoTile.Id = k_outofboundsTileId;
    18.         return m_emptyAutoTile;
    19.     }
    20. }
    This points the m_emptyAutoTile reference at a new object, so it doesn't change any of the variables it returned before. That way m_CurTile doesn't get overwritten in TileMovementBehavior.

    I hope that makes sense, let me know if it doesn't and I can explain it better.
     
    CreativeSpore likes this.
  31. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Thanks, and i only hope all your bug fixes will be integrated in the plugin lol
     
    CreativeSpore likes this.
  32. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Right now, the only way to achieve that is by adding an idle animation or stopping the animation and setting one of the frames as idle frame.
     
  33. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    Thanks for posting the fix. I really appreciate it.
    The idea to stop looking for other tile if a passable tile is found is, for example, if you place a bridge tile over the water. You are able to walk over non passable tiles if you place a passable tile above.
    Wouldn't this fix break that functionality?
     
  34. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,
    I think it would be a lot of work, this probably won't be included.
    About the AI overlapping, you can attach a sphere collider or a circle2D collider (if you change the rigidBody for a rigidbody2D) to avoid them to touch each other.
     
    zenGarden likes this.
  35. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    I see. Thanks for pointing into this. The reason of this was to make an optimization, but I see it was not a good idea.
    I have added this fix to the current version and will be included in the next release.
    Thanks for that ;)
     
  36. mikedodgerstout

    mikedodgerstout

    Joined:
    Oct 14, 2015
    Posts:
    5
    I think you're right. Maybe what I'm seeing is another issue. Empty tiles (where I don't place anything) are showing up as Passable instead. I haven't looked into why that is, I was assuming it was by design, but now I'm guessing it wasn't.
     
  37. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Well, I think this was a design choice. This could be different for each user. For example, if you want to avoid the use to move outside the map, the empty tiles should be non passable. Or force to place a blocked tile in the edges.
     
  38. mikedodgerstout

    mikedodgerstout

    Joined:
    Oct 14, 2015
    Posts:
    5
    Ok, I think I might just be using it in a way that wasn't intended then.
     
  39. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    I read through the docs but the system seems to be designed for a single player character with the camera following them. Just wondering how hard is to use this with something where the camera is free (based on the users mouse or keyboard input) and not following a character. The videos look like it's fixed on one player object both for the camera and the camera attached to the map. Thanks.
     
  40. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    The camera used in the demos has a FollowObjectBehaviour used to follow any gameObject using it's transform and the target property of this component.
    There are some parts in the code where this Target property is set, for example, the PlayerController set this target in the OnStart method and in the Update method (when the player is moving). This is used to allow moving the camera dragging with the middle mouse and go back to the player when it is moved again.
    Also the Camera2DController is setting this Target to the player transform if there is any PlayerController in the scene, but only during the OnStart method.
    And the AutoTilemapGUI component, used to allow editing the map while playing is changing this Target, but you can disable this by unchecking the Show Map Editor On Play setting.
    If you comment the line setting the camera target in the PlayerController Update method and disable the editing whlie playing, you should be able to change the target to anything else without any problem.
     
  41. mikedodgerstout

    mikedodgerstout

    Joined:
    Oct 14, 2015
    Posts:
    5
    I'm having a problem where I select a tile from the tileset to draw, and the brush gizmo is showing up very tiny.

    I think it's because I changed the default Cell Size to 2x2, instead of 0.32x0.32, and so the brush shows up still at 0.32 even though the tiles are 2 wide and tall.

    Is there a way for me to fix it so that it scales to the correct cell size?

    Thanks.
     
  42. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    You need to copy any tile right right click to refresh it to the new cell size.
     
  43. LoDx

    LoDx

    Joined:
    Feb 13, 2013
    Posts:
    67
    Hi @CreativeSpore ,
    I've been looking at your this great asset.

    Questions :-
    1. Does the assetpack has/include some demo scene(s) for mobile (with mobile control already intergrated ) ?
    ( I do understand that 'mobile control' sound 'easy' to integrate for some, but in-actual, it really do helps to reduce the headaches for non-technical ( or not-so technical incline ) .

    *I've watched the demo video (https://forum.unity3d.com/threads/released-rpg-map-editor.278604/page-9#post-2570000), I really impress with the asset.
    *I read on https://forum.unity3d.com/threads/released-rpg-map-editor.278604/page-9#post-2648083 that it has demo scene, just to be sure if it's also works on mobile so I can test it & have a starting point to build-on.
    *I read on page1 of this thread that it works/tested on smartphones , just to be sure if the assetpack comes with mobile control integrated *
    * I read on (https://forum.unity3d.com/threads/released-rpg-map-editor.278604/page-5#post-2138724) that we need to do some modifications


    Thanks & Keep Up the good works!
    James
     
  44. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi James,

    Thanks for taking your time to look at this tool.

    About your questions:
    It doesn't includes a mobile controller, but it includes a TouchPlayerController to move the player to the touched position.

    Adding a controller and connect it to the included PlayerController should be easy, but if you need any help let me know and I will help you.

    About the support with mobiles, it should work fine. I have tested it with an LG G2 and it worked fine with the demo level.

    Here I have an apk made for the LG G2 with a previous version of the tool in case you want to check it.

    https://www.dropbox.com/s/p0wrelwrefjlnjb/rpgMapEditorV140.apk?dl=0
     
  45. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    Hey guys,

    Here's a little mod I did to the AutoTileMapGui.cs script because I found seeing alpha tiles in the editor was difficult. I wrote a couple of methods to build an alpha checkerboard texture and draw it behind the alpha tiles (this is similar to what RPG Maker looks like).

    Just add these two methods to the end of the AutoTileMapGui.cs file:

    Code (CSharp):
    1.  
    2. private void DrawAlphaBackground(Vector2 offset)
    3. {
    4.     // texture to draw behind any alpha tiles
    5.     var thumbnailBackground = MakeTileTex(32, 32);
    6.     var thumbIdx = 0;
    7.     for (var y = 0; thumbIdx < 256; ++y) //256 number of tileset for each tileset group
    8.     {
    9.         for (var x = 0; x < m_autoTileMap.Tileset.AutoTilesPerRow; ++x, ++thumbIdx)
    10.         {
    11.             var rDst = new Rect(x * k_visualTileWidth, y * k_visualTileHeight, k_visualTileWidth,
    12.                 k_visualTileHeight);
    13.             rDst.position += offset;
    14.             if (m_autoTileMap.IsAutoTileHasAlpha(thumbIdx))
    15.             {
    16.                 GUI.DrawTexture(rDst, thumbnailBackground);
    17.             }
    18.         }
    19.     }
    20. }
    21.  
    22. private static Texture2D MakeTileTex(int width, int height)
    23. {
    24.     // checkerboard pixel colors
    25.     var darkTile = new Color32(220, 220, 220, 255);
    26.     var lightTile = new Color(1f, 1f, 1f);
    27.  
    28.     // color array for entire texture
    29.     Color[] pix = new Color[width * height];
    30.  
    31.     // create a checkboard pattern using our dark and light colors
    32.     for (var y = 0; y < height; y++)
    33.     {
    34.         for (var x = 0; x < width; x++)
    35.         {
    36.             var index = (y * height) + x;
    37.  
    38.             if (y < height / 2)
    39.             {
    40.                 if (x < width / 2)
    41.                 {
    42.                     pix[index] = darkTile;
    43.                 }
    44.                 else
    45.                 {
    46.                     pix[index] = lightTile;
    47.                 }
    48.             }
    49.             else
    50.             {
    51.                 if (x < width / 2)
    52.                 {
    53.                     pix[index] = lightTile;
    54.                 }
    55.                 else
    56.                 {
    57.                     pix[index] = darkTile;
    58.                 }
    59.             }
    60.         }
    61.     }
    62.  
    63.     var result = new Texture2D(width, height);
    64.     result.SetPixels(pix);
    65.     result.Apply();
    66.  
    67.     return result;
    68. }
    69.  
    The first method just iterates over the areas that the tiles will be drawn in, checks to see if the tile in the tileset is an alpha tile or not, and draws the texture. The texture is created by the MakeTileTex method.

    To use it just insert this line right above the GUI.DrawTexture(vRectTemp, m_thumbnailTextures[m_subTilesetIdx]) call in the OnGui method:

    Code (CSharp):
    1.  
    2. DrawAlphaBackground(vRectTemp.position);
    3. GUI.DrawTexture(vRectTemp, m_thumbnailTextures[m_subTilesetIdx]);
    4.  
    The result will be this:



    I just find it easier to see the alpha textures this way. You can even create a boolean to toggle it if you want.

    Enjoy!
     
    CreativeSpore likes this.
  46. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Hi there,

    Thanks for sharing this. It's really cool and a good addition. If you give me permission to add this to the tool I will add this in the next release.
     
  47. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    For sure, please do.

    Also for more clarity don't do the if(m_authoTIleMap.IsAutoTileHasAlpha(thumbIdx)). For some tiles I find they have alpha in part of the image but this return true only if the top corner is transparent. Just remove the check and all tiles will have the background added.
     
    Last edited: Apr 23, 2017
    CreativeSpore likes this.
  48. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    There seems to be a bug (or at least a behavior that I didn't expect). My game scene loads from a menu and I've got the editor disabled on start (Show Map Editor on Play is unchecked) but when I load the game both inside the editor and in my .exe the map editor shows. There's something in the AutoTileMap script (maybe the dependency on AutoTileMapGui script?) that's turning this back on when your scene is loaded separately. Just wondering what's triggering this to be enabled so I can turn it off in my runtime.
     
  49. CreativeSpore

    CreativeSpore

    Joined:
    Nov 6, 2014
    Posts:
    1,190
    Yes, it looks like a bug or unexpected behaviour. The check box only enables/disables the attached script AutoTilemapGui. This enable state should be saved.

    What version of Unity are you using?
     
  50. OccularMalice

    OccularMalice

    Joined:
    Sep 8, 2014
    Posts:
    169
    5.5.2f1 (64-bit)