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

TurnBased-Toolkit (TBTK)

Discussion in 'Assets and Asset Store' started by Song_Tan, Aug 11, 2013.

  1. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I dont understand, are you saying the size are different from what you have in editor when you build an actual game?
     
  2. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    Simply try it out. (Square Grid)
    In the Editor, the Tiles appear larger and the space smaller.
    If i start the game, the tile size is smaller and the space between the tiles seems larger.
     
    Last edited: Oct 29, 2014
  3. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I've tried it on a stand-alone build. And I dont see any different in the tile size.

    What I dont understand is are you experiencing the problem within the editor between play and edit mode, or in an actual game build (webplayer or .exe).

    From the sound of it, seems like something has resize the individual tile object. Are you using a your own custom tile? Does it has any script or animation component on it that could have trigger that.
     
  4. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    No, i dont change the Tilesize myself.
    The Problem is in the Editor and the Game Mode. I will post a picture later on.
     
  5. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    here you can see it in the game:


    and the Scene View


    Gridsize 1.4, Ratio 1.25
     
  6. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I just cant replicate it. And I've never come across this. Have you try other value combination then 1.4 and 1.25? Consider that the tiled only get rescaled during runtime (once you start playing), there's only two possibility, either there's an animation component on the tiles that reset the scale, or there's a line of code somewhere that changed the scale.

    I cant find out without access to your project. You'll need to send it to me so I can figure out what's wrong. I dont need the full project. Just the scripts and the tile prefabs.
     
  7. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    Thanks, shame on me, i found the Problem, there was a script attached to the tile prefab, that resizes an icon but actually resized the tile.:oops:
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Problem solved! :)
     
  9. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    I found a small Bug.
    If you set up a Grid with size 1 and GridToTileSizeRatio of 2, then the Neighbouring Tiles cannot be found.
    In Tile.cs->SetupNeighbours() i've had to change:
    Collider[] cols = Physics.OverlapSphere (poss, tileSize * 0.6f);
    from 0.6f to 1.0f
    To make this working for all sort of combinations, GridToTileSizeRatio have to be used for calculation too, i guess.
    I dont know why you use 0.6f there, so you may provide a solution for it.
     
  10. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    You are right, 0.6f needs to be changed to 1f. Not sure why I've used 0.6f in the first place.

    There's no need to use GridToTileSizeRatio in the calculation. GridManager.GetTileSize() has already taken that into account
     
  11. Someonelse812

    Someonelse812

    Joined:
    Oct 26, 2014
    Posts:
    9
    So, I have an idea for what basically amounts to an X-Com clone, would this kit allow me to pull that off?
    I'm curious how to map the levels. I would like to have maps more details than those in your example, is there some way to just have a regular map and designate the grid spaces? Or does the entire map have to be built as a grid from the ground up? If so does it have to be tile based? How does that work?
    I'm going to want to swap out the little tanks with people and give them various melee and ranged attacks and special abilities, is it simple enough to change the exact nature of all the special abilities and how they all work?
    Also, is there a level system or XP system in place? and item system? If so could you please elaborate (or if you've already explained that in this 17 page thread could you please give me some idea what page it's on)?
    Another fun part of X-Com was items, weapons and other devices, which you had to research. I haven't seen anyplace where you mention anything like that so I assume that isn't part of this package?
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Let me just say up front that this is a generic framework for design to making a turn-based game. Therefore it tries to accomodate as much frequently seen mechanic in turn-based game as possible. While it's in some part heavily inspired by X-Com, it's by no mean a framework for X-Com. You will have to modify and add some components to achieve that.

    To answer your specific question.

    It sort of works both way. Yes it's entirely tile-based. In most case you will have to build your map as a grid (which is also the case for X-Com I believe). But the grid can be customized to fit your map. Tiles can be disabled and used as obstacle if need. Any background environment object can be placed on the map for visual purpose without intefering the gameplay

    Swapping out the default unit asset is fairly easy. The kit is designed for that purpose. The abilities can be customized to a certain extent. But consider it's a generic framework it does has it's limit. If you want some unique abilities, you will most likely need to code it yourself.

    Unfortunately none of these is included. These are pretty much meta system, not the core component of a turn-based mechanic. Such system are often very specific and unique to each game. Not to mentioned they are oftern heavily tied to UI. There's no way that can be done in generic way

    If you havent seen this video, I would suggest you do so. While it may not be up to date with the later addition such as perk system and cover system, it should give you a fairly good idea of what the framework is about.

    Hope this answer your question.
     
  13. Someonelse812

    Someonelse812

    Joined:
    Oct 26, 2014
    Posts:
    9
    Thanks a bunch!
     
  14. moliver

    moliver

    Joined:
    Nov 6, 2014
    Posts:
    5
    How customizable is the underlying grids? How modular are the components of each turn? Do you have documentation on the scripts used? Have you seen the grid framework here: https://www.assetstore.unity3d.com/en/#!/content/9968
    and would you consider your toolkit to be able to intregrate well with grids created by that system?
     
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Here are how the grid in TBTK can be customized.
    • You can move the position of the grid as a whole.
    • You can change the tile appearance as it uses prefab as individual tiles.
    • You can change the size and spacing of the tiles via the editor.
    • You can change the general shape of the grid, using an editor and "paint" the grid in scene view. 11.30
    I would suggest you to take a look at this video. Specifically at 6:00(grid generation) and 11:30(grid editing). Keep in mind that this is an old video so the work-flow has been improved in current editor.

    I've seen the grid framework you mentioned. I dont know much about the inner working of it. But from what I can gather from looking at the AssetStore page and the video, the first 3 points that I mentioned works pretty much like the grid framework. However the grid system in TBTK is a lot more limiting of course. The tiles are expected to looks the same across the grid so thing such as coloured pattern across the grid are not supported. The editor is not as powerful so most of the customization have to be done by hand.

    Not knowing the code for the grid framework means that I can't say for sure how easy/difficult is the integration. From my experience, getting two set of code that developed separately to work together is rarely a straightforward. I'm not even sure if the framework is open-source. I suppose you are considering using the turn-based module on the grid framework. I'm afraid that won't be straight-forward. See most of the component such as path-finding, gameplay interaction, unit positioning and tracking, etc. are very much grid dependent. Therefore the grid are made to support those feature in the first place. You will need to modify any 3rd party grid framework so support all that, as well as changing the existing code in other component to work with the new code.
     
  16. moliver

    moliver

    Joined:
    Nov 6, 2014
    Posts:
    5
    Thank you for taking the time to answer some of my questions I really appreciate the prompt response.

    The grid framework I linked does give you all the source code for the main package. They have some API documentation here for reference http://www.gamelogic.co.za/documentation/grids/

    I think both your toolkits would have very cool applications if they were easy to integrate with a framework such as provided by grids, it would be something to keep in mind for future updates perhaps? I am not trying to advertise for them, it's just two frameworks which seem naturally aligned in my opinion.

    So for the project I'm prototyping I wanted to have easily configurable grids, procedurally generated and of different sizes and formats, which is why I'm using that grids package. In terms of tile design that won't actually be too complicated as my prototype is space focused, so they'll primarily be transparent with borders (similar to yours). I am considering getting your package to see how much time it will save me in writing my own turn based code to go on top things, but it is hard to gauge because I'm not able to see much documentation for your kit beyond a video or two. It looks powerful but primarily editor facing, so it is hard to judge how much work would need to be done to port functionality to a grid system thats not in your kit. Thankfully, I think most of the areas of my prototype which are turn based are on a hexagonal grid. When you say alot of your tool's functionality is grid dependent, do you mean tied to a hexagonal grid logic, or how you've designed your grids and their custom behaviors?
     
    Last edited: Nov 6, 2014
  17. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I took a quick look at the link you sent me. At a glance, I have to say, mine is a lot simpler perhaps but it doesnt have any documentation near that level. Anyway I dont think it will be straight-forward to do any integration. You will end up having to modify most of the code in TBTK to do that. This is again due to the fact that most of the game logic are grid-dependent.

    The reason why most of the code are grid dependent because there are a lot of search algorithms which involve the grid in the game logic. For instance, when a unit selected, the tile which are walkable needs to be determined and shown on screen. Same goes for any hostile unit in attack range. And when an AI makes a turn, it needs to scan the grid, doing a lot more searching. Most of these searches depends on the position of the unit in question on the grid, their action range, and the status of each tiles within range. Furthermore to make things easier, the grid in TBTK are not just a set of coordinated tiles, they stored addtional information such as unit's position, hostile within range etc.. In short, they are built to to accomodate the framework right from the start.

    I can send you the documentation(mind you it doesnt list the API) and a few sample scripts to let you see for yourself. Thins is, I'm currently working on a new version which is what I would recommend you to use if you want to go for it. It has got better, cleaner code structure and easier to modify in general. Problem is it's very much a wip and not finished (it's almost there). Anyway, if you want to, please send me an email. I'll see what I can do to give you a clear idea of what's what.
     
  18. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Would you mind looking over this code and tell me if there might be issues with other parts of code in the kit? It's my "wait" function. The idea is if a player unit does nothing on their turn, they can wait until the next AI unit goes and then decide if they want to go or wait again. Once all AI units have gone, they will have no choice but to act or end their turn. I had to make some minor changes to OnNewRound and have included only the code I wrote and not the original code you provided.

    I've tested it a couple of dozen times and it works exactly how I expect it to but I'm not sure if what I have done will screw up other things in the code. I already know that it messes up with the cool down on abilities, but since none of my abilities will have a cool down so I don't really mind.

    Anyway, here is the code. It's triggered by a new NGUI button.

    Thanks!

    Code (CSharp):
    1. public static void OnNewRound(){
    2.  
    3.         UnitControl.instance.allUnits=UnitControl.instance.allUnits.Distinct().ToList();
    4.         foreach (UnitTB unit in UnitControl.instance.allUnits)
    5.         {
    6.             unit.hasWaited=false;
    7.         }
    8.    
    9.     }
    10.  
    11.  
    12.  
    13.  
    14. public static void OnWait()
    15.     {
    16.         if(!UnitControl.selectedUnit.moved && !UnitControl.selectedUnit.attacked && !UnitControl.selectedUnit.abilityTriggered)
    17.         {
    18.             instance.WaitTurn(UnitControl.selectedUnit);
    19.         }
    20.     }
    21.     public void WaitTurn(UnitTB unit)
    22.     {
    23.         SetWaitSpot(unit);
    24.         //UnitControl.instance.allUnits.Remove(unit);
    25.         //UnitControl.instance.allUnits.Add(unit);
    26.         //unit.hasWaited=true;
    27.         instance.StartCoroutine(instance.OnNextTurn());
    28.         //UnitControl.instance.allUnits.Remove(unit);
    29.     }
    30.     void SetWaitSpot(UnitTB unit)
    31.     {
    32.         int myIndex = UnitControl.instance.allUnits.LastIndexOf(unit);
    33.         int myFaction = unit.factionID;
    34.         foreach (UnitTB uU in UnitControl.instance.allUnits)
    35.         {
    36.             int AIindex=UnitControl.instance.allUnits.LastIndexOf(uU);
    37.             if(uU.factionID!=myFaction )
    38.             {
    39.                 if(AIindex>myIndex)
    40.                 {
    41.                       print (myIndex);
    42.                     print (uU.name);
    43.                     print (UnitControl.instance.allUnits.LastIndexOf(uU));
    44.                     UnitControl.instance.allUnits.Insert(AIindex+1, unit);
    45.                     return;
    46.                 }
    47.                 else
    48.                 {
    49.                     UnitControl.instance.allUnits.Add(unit);
    50.                     unit.hasWaited=true;
    51.                     return;
    52.                 }
    53.             }
    54.         }
    55.     }
     
  19. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hey guys,

    I feel like I may have asked this already but is there any way to stop units from shooting through walls in this game? I'm using this for a dungeon crawl and it's going really nicely except that units are able to shoot targets that are around corners and such because they can shoot through walls. I turn the fog of war system off because I find that spawning new enemy units in the game during a battle with fog of war on causes issues. Is it possible with fog of war enabled?
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Apart from messing up the ability cooldown, you might have mess up the duration tracking of any buff/debuff. I can't say for sure since I cant remember it all on top of my head.

    I'm going to assume that you are using SingleUnitPerTurn and this is all the modification you made in term of the turn logic? The problem with your code is, if I understand it correctly, that you are constantly adding to the allUnits list without removing element from it. Therefore you end up having multiple elements of the same unit instance in the list. Now the tracking of the duration, even the turn logic in general expecting the list to be the same length of total unit in game, with each unit only occupy one of the list element. So while I cant tell what is going break down the line, I wouldnt tempt my luck with it. Also, I dont see where unit.hasWaited is used anywhere.

    I would try something like this:
    Code (csharp):
    1.  
    2.   void SetWaitSpot(UnitTB unit){
    3.      int myIndex = UnitControl.instance.allUnits.LastIndexOf(unit);
    4.      int myFaction = unit.factionID;
    5.      int unitInTurnIndex=UnitControl.currentUnitTurnID+1;   //get the index of the next unit in the list
    6.  
    7.      //starting from current index, loop thru the list and look for next hostile unit
    8.      for(int i=unitInTurnIndex; i<UnitControl.instance.allUnits.Count; i++){
    9.        if(UnitControl.instance.allUnits[i].faction!=myFaction){
    10.          //insert current unit to the list, just after the hostile unit
    11.          UnitControl.instance.allUnits.Insert(i+1, unit);
    12.          //now we remove the element which the unit was originally in
    13.          UnitControl.instance.allUnits.RemoveAt(unitInTurnIndex);
    14.          break;
    15.        }
    16.      }
    17.  
    18.      //reduce the currentUnitTurnID by 1
    19.      //when you switch to the next unit, it value will increase by 1 again and therefore the unit in the same index get selected again
    20.      //but since you have shuffle the current unit down the list, the supposely next unit will get selected instead.
    21.      UnitControl.currentUnitTurnID-=1;
    22.    }
    23.  

    Note that while I put the unit to the back of the list, I remove the element which the unit occupied in the first place, retaining the list length and avoid duplication. I have to say I didnt try this to make sure it's error free, so just use that as a reference. You may have to tweaks things further.
     
  21. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Thanks! I tried removing it, but that caused problems and skipped the next unit's turn. Of course that was way back five or six attempts ago so who perhaps I can get it to work. I get rid of them all at the start of the next round. I use hasWaited to turn off the wait button. It also gets turned off if the player unit does anything, even moves.
     
  22. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I only had to make two changes and it seems to work.
    line numbers in your post:
    9 was changed to "if(UnitControl.instance.allUnits.factionID!=myFaction){" (you left of the "ID" and it told me it couldn't convert)

    13 was changed to " UnitControl.instance.allUnits.RemoveAt( UnitControl.currentUnitTurnID);" The other way, it never changed units.
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    @Rajmahal, sorry I didnt saw your message last night.

    There are two possble solution to your problem. If your problem is simply unit shooting at target behind a corner, you can tweak the code slightly so that it no longer fires around a corner. Simply change the value of posOffset in IsInLOS() in GridManager.cs to something small, like 0.1. Or just disable the second and thrid raycast in the function. Doing so will stop the unit from "seeing" target from a corner. Alternatively you can add another raycast yourself as a final check to determine if a wall is between 2 unit before attack. You can do that in ResetHostileList() in GridManager.

    Is the spawning new unit with fog-of-war turn on/off a separate issue? Can you let me know what went wrong when you try to do that with fog-of-war turn on/off?
     
  24. moliver

    moliver

    Joined:
    Nov 6, 2014
    Posts:
    5
    Thanks, I will email you now.
     
  25. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hi Songtan,

    thanks for the clarification. I'll give that a shot ... though I wonder if I'm just not setting up my walls properly. If they don't serve to block line of sight, I don't really understand what their purpose is.

    Anyway, regarding my issue with adding new units during the game and fog of war, what I find happens is that if I enable fog of war, then enemy units that are added to the game during the battle do not become visible to the player until after the player selects one of his units and completes a move. Then they become visible ... until he does that, they can't be seen even if one of his units is standing right next to that enemy unit.

    Here's the code I'm using. Basically I have a script that does the following to create a new unit in a specified tile:

    Code (CSharp):
    1. if (entryTile1.unit == null){
    2.  
    3.  
    4.                     UnitControl.InsertUnit(patrolMembers[(int) Random.Range(0,2)],entryTile1,patrolFactionID,0);
    5.                     GridManager.hostileList.Add (entryTile1);
    6.  
    7.  
    8.  
    9.                     entryTile1.unit.SetSpawnInGameFlag(true);
    10.                     UnitControl.GetAllUnit().Add(entryTile1.unit);
    11.  
    12.  
    13.                     GameObject.Instantiate(Resources.Load("InstantiatedEffects/sacredGround"), entryTile1.pos, Quaternion.identity);
    14.  
    15.                 }
    Then I try to make the unit visible with the following code that runs almost immediately after the above. I iterate the above a few times to create units on different tiles.

    Code (CSharp):
    1.  
    2.  
    3. if(GameControlTB.EnableFogOfWar()){
    4.  
    5.                     foreach(UnitTB unit in UnitControl.GetAllUnit())
    6.                     {
    7.                        
    8.                         if(unit.factionID == GameControlTB.GetPlayerFactionID())
    9.                         {
    10.                            
    11.                             unit.CheckForPatrols();
    12.  
    13.                         }
    14.                                                 }
    15.                 }
    Check for Patrols is a function I created with the following code:

    Code (CSharp):
    1.  
    2.  
    3. public void CheckForPatrols()
    4.     {
    5.         onNewPositionE(this);
    6.  
    7.         //for fog of war
    8.         if (GameControlTB.EnableFogOfWar())
    9.         {
    10.             if (factionID == GameControlTB.GetPlayerFactionID())
    11.             {
    12.                 //let all other unit check their respective LOS against this unit
    13.                 if (onNewPositionE != null) onNewPositionE(this);
    14.             }
    15.             else
    16.             {
    17.                 //call to check LOS against all player unit
    18.                 AIUnitCheckFogOfWar();
    19.             }
    20.         }
    21.     }
    I'll be honest, after trying various things to make this work ... I gave up and just switched off fog of war. So I haven't looked at this code in a while. But if you could give me your thoughts, I'd really appreciate it.
     
  26. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    By the way, I noticed that the same issue happens when you enable fog of war and use a teleport ability. if your character teleports to a position that should reveal new enemies, you can't actually see those enemies until that unit moves to a new tile.
     
  27. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    When you create a new unit, try insert this line:
    Code (csharp):
    1.  
    2.   UnitControl.GetAllUnit().Add(entryTile1.unit);
    3.   entryTile1.unit.AIUnitCheckFogOfWar();     //added line
    4.   GameObject.Instantiate(Resources.Load("InstantiatedEffects/sacredGround"), entryTile1.pos, Quaternion.identity);
    5.  
    Also, on the issue of teleport doesnt reveal hostile unit. Try add this to the line1460 in UnitTB.cs. Like this:
    Code (csharp):
    1.  
    2. if(unitAbility.effectAttrs[i].type==_EffectAttrType.Teleport){
    3.    thisT.position=tileList[0].pos;
    4.    occupiedTile.unit=null;
    5.    occupiedTile=tileList[0];
    6.    tileList[0].unit=this;
    7.  
    8.    if(onNewPositionE!=null) onNewPositionE(this);    //added line
    9. }
    10.  
    Try compare your wall prefab to the default one, especially on the collider size and positioning. That may be the reason why your wall doesnt block los. Also note that only a full row of full cover wall/obstacle block los, half cover wall wont do, and the unit can peak through neighbouring tile with no cover.

    Hope this help.
     
    Last edited: Nov 7, 2014
  28. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    That's fantastic ... thank you. I'm actually using the default invisible wall in the grid manager. This is the one that just paints a red line in the grid manager view between two tiles. What I'm doing is making tiles invisible / hex full cover and then putting an invisible wall on top of them. Not sure if this is right not. However, it does seem to block line of sight when fog of war is enabled so that's probably fine. If the fixes you mention above work then I have no issue enabling fog of war. Thanks again, Songtan!
     
  29. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hi Songtan,

    I tried that code change that you suggested but unfortunately, it doesn't work. Units appear at the start of the turn ... I see the special particle effect that I instantiate in the code above. However, the unit's aren't visible until I select one of my units and have him complete a move. Any ideas what else could be needed?
     
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Ok, I missed something. You will need to call that AIUnitCheckFogOfWar(); in a coroutine. It should goes like this:
    Code (csharp):
    1. StartCoroutine(DelayAICheckFogOfWar(entryTile1.unit));    //replace the original added code with this
    2.  
    3. //add this function into the script
    4. IEnumerator DelayAICheckFogOfWar(UnitTB unit){
    5.    yield return null;
    6.    unit.AIUnitCheckFogOfWar();
    7. }
    8.  
     
  31. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    It is possible but (in my case and with my game design) it also need a lot of code editing, which is not too hard if you are an experienced programmer.
    There is no Inventory System, so you also have to do this yourself.

     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Thanks for the clarification Thoreandon. When is your game ready? I would very much like to see try it and see what you have done.
     
  33. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    Still a lot of things to do, but i will put it an Steam Greenlight around 6-8 Weeks, hopefully, to get some feedback.
    If noone is interessted i dont have to put a lot more work in it to get it polished.
     
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Well then, all the best!
     
  35. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Hi songtan,

    Is it possible to put hex on structures such as house roof and tower and make them selectable and walkable?

    I wanted to make my gameplay similar to final fantasy tactics, where units can climb to certain building and either shoot arrows from there or cast their magic from a safe place.
     
  36. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Yes, vertical component in the grid is supported, at least in current version. Please refer to this link for more information.

    However I dropping the feature in the upcoming update (which will be up when the beta for Unity4.6 is over) in favor of a bigger grid size. I might addd the support for the feature again but not in a foreseeable future.
     
  37. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Ah, that's great.

    When you release the next update (which I believe will be even more awesome), is it possible for me to keep that vertical component feature? Which script would I need to modify?
     
  38. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I'm afraid not. You see the next update is going to be a total rebuild to the framework. Some of the code/algorithm/method used are completely different. So it's not going to be backward compatible. For a start, in current version, each tile is a individual gameObject with collider used to detect cursor input position so you can simply raise it's position in y-axis. But in the next version, this is going to tracked universally using a single collider that assumes the grid is flat.

    You can still do modification to add verticality if you want. I imagine it's not too difficult to do if you have a specific setting that you want to do. But It's hard to specify which script you will need to modify as there are multiple solution to add a vertical component. You can either rever to the old method which is a collider for every single tile, or add another set of grid which take place at a different height. Then it's just a matter of determing the rules of connection of grid/tile across different height and set them up.
     
  39. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Okay. I see.

    I think adding another set of grid at different heights is the more realistic way, considering you are rebuilding the whole framework.

    So would the logic be something like this?
    set a ground grid for all objects on the scene
    set a floating grid for some objects which are of certain height and which can be climbed (roof, tower)
    when a player click on an object on the scene:
    if the object has only one grid associated with it, then it is a flat ground, therefore show the hex selection on the ground
    however, if the object has two grids associated with it, pick the one located at higher level (e.g. roof), and show the hex selection on that level (roof).
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    More or less. But it's more grid-oriented. Each grid has a collider which it's associate with. So when a click is detected, you only need to detect which collider has been clicked on and from there, which grid and which tile.
     
  41. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Right. Okay.

    Btw, when are you expecting to release the new version of TBTK?
     
  42. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    It's still very much work in progress at the moment, although most of the core component is done. I plan to release it as soon as beta for Unity4.6 ends. The UI are based on the new Unity UI so the minimum version required for Unity is 4.6.
     
  43. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Okay. Thanks!
     
  44. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    How about a Script that can save and load the Tile states?
    Sometimes i have to recreate the grid and then, all my changes i have made are gone (like walkable, walls etc).
    I have writen something myself but only for a few things.
    Maybe you allready have something, if not perhaps you can provide one that saves states like walkable, obstacles, walls, height level. I dont care how it is saved, can be a textfile.
    The restore Script would then load the saved states and setup the tiles.
     
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I dont quite get it. From where I'm, having a script that save all those information and regenerate the grid again based exactly on those information would just create the exact same grid.

    That is just pointless unless what you really intend is to retain certain information and reset certain information. At any rate I think that is either pointless or a bit of a niche so forgive me that that is not going to be on the priority list.
     
  46. Thoreandon

    Thoreandon

    Joined:
    Aug 21, 2014
    Posts:
    37
    Seems like you dont get it.
    If i generate a grid and edit it afterwards, i.e. make tiles unwalkable, add walls etc, it can be a lot of work.
    Sometimes, i have to generate the grid again becouse of some errors (i.e.units walk and dont stop), i have to edit all the information again becouse the grid is blank new and all info i edited before is gone. Its annoying.
    Saving states of Tiles could be (imho) a simple but good function. Anyway, i will create it myself then, it doesnt seem as complicated as i thought.
    And since i have added a lot of fields to Tile.cs, i would have to edit the savescript (if you would provide one) anyway.
     
  47. Morlok

    Morlok

    Joined:
    Sep 9, 2012
    Posts:
    5
    This asset may actually be able to do some of the stuff you need : https://www.assetstore.unity3d.com/en/#!/content/3675

    Note: If you need to use it at runtime, there are a few things you need to pay attention to.
    1. you need to make sure that all fields are serialized (else they will not be saved/stored).
    2. you need to replace the coroutines in the project (or modifiy the base class for coroutines in unity).
     
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I'm assuming you are editing the grid (edit unwalkable, add walls) in edit mode, not runtime. In that case, the grid will reset itself to initial state as soon as the play stops. So if something something breaks in runtime, just stop the play. If the error is inherent from the grid itself even before the play start, regenerating the same grid is going to give you the same problem. And you can always save a backup scene containing the grid in case you break something while trying some extensive modification. That's why I dont understand why it's needed.

    Unless you are doing some editing in runtime which prevent you from saving any editing you have done. But then I dont think that's a very safe way to do any grid editing.
     
  49. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    i'am TurnBased fan if it's possible to get change log than'ks
     
  50. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Change log? I dont understand. I havent done any update recently. Do you mean change log for the coming update? There isn't one yet as it isn't done. If you mean the change log for the released version, you can find the it on the AssetStore page here - https://www.assetstore.unity3d.com/en/#!/content/10686 if you click on the version number.