Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

TurnBased-Toolkit (TBTK)

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

  1. copperrobot

    copperrobot

    Joined:
    May 22, 2013
    Posts:
    61
    Hey @songtan, I'm hoping to be able to use this asset for a game. A couple of questions regarding customisability during play:

    -It would be useful to have quite a lot of variety in the grids. What would be good is to not have to make dozens of individual maps, but to perhaps have some preset layouts (a corridor or open area or battlefield), but then be able to customise them to add variety. So perhaps there's a type of location like a city street, but I want to change the contents in the scene depending on the situation. Perhaps there are more walls, or more chatic obstacles. Is it possible to make those sorts of changes, or are maps unchangable (position of walls, collectables etc) once they are saved in a scene?

    -Does each grid need to have a unique scene? Is there perhaps a way to save a map and then load it into a scene, including the placement of walls etc?

    -Perhaps I want to alter the visual style but keep the layout of the grid. Is it possible to change what prefabs (like walls, units, obstacles) for different ones before the scene starts?

    -If I have a party of units, which might increase or alter over time (along with add different weapons/abilities), is it possible to specify which units will be used in a scene upon loading it? Perhaps I have 12 different possible party members and I bring 4 into the scene with me?

    -Same with the enemies. I can procedurally spawn them it seems, but is it possible to alter the types of units spawned before the battle starts?
     
    Stexe likes this.
  2. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,730
    There's the 'Generate Grid On Start' option which force the grid to regenerate itself when the game start. So you start a scene with different grid layout every time. That said, these are totally random, you have no control over the placement. Other than that, once a scene is saved, that's pretty much it. To your point of having some preset layout, you will need to a procedural generator that are purpose for that. One where you can lock certain feature on the layout while randomized/regenerate the rest. The default generator doesn't support that I'm afraid. The closet thing I can probably do is to instead of regenerate the grid and everything on it, having a separate option for the obstacles and wall. So you can still keep the grid layout, but things on it will be different.


    The only way to do this (probably) is to set the whole TBTK gameobject into a prefab. You can load the prefab into any scene (different background, same grid setup).


    I'm afraid there's no easy way to do this at the moment. Referring back to your earlier question where you want a preset layout, you will need a script that scan the grid at the start of the scene, and replace all the objects on it with the specific sets of object prefab you want.


    You can look into the persistent demo scene and how you can set the starting unit for a particular faction in the next TBTK scene (Check the documentation too, look for the section 'Integrating TBTK with your game'). You can do this for both player units and the enemies.
     
    Last edited: May 2, 2021
    copperrobot and Stexe like this.
  3. copperrobot

    copperrobot

    Joined:
    May 22, 2013
    Posts:
    61
    @songtan thanks for all that! I think that there's a way there to achieve all I want to.

    Thanks!
     
  4. dc774

    dc774

    Joined:
    Feb 14, 2021
    Posts:
    2
    Hi Songtan,
    just wondering how can I customize an unit's attack range, not just the distance but I want to make it into a specific grid shape and having a fixed direction. Is it posible?
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,730
    Well it's possible as long as you can code it. The code in question is GetAttackableList() in GridManager.cs. That's the function that determine which tile the selected unit can attack based on its attack range and other factors. You can always modify that function yourself to give your unit a custom attack area.
     
  6. dc774

    dc774

    Joined:
    Feb 14, 2021
    Posts:
    2
    Thanks for the help!
     
  7. bangoo

    bangoo

    Joined:
    Apr 25, 2015
    Posts:
    12
    Is it possible to set various AP cost depending on type of the hex (forest, road) with the asset settings?
    If there is an option to move through friendly units?
     
    Stexe likes this.
  8. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,730
    Unfortunately no. All hex share the same AP cost.

    Yes, there's settings for each unit prefab in UnitEditor that allow you to set if a unit can move pass friendly unit, hostile unit, obstacle.
     
  9. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    Yeah, I was surprised about the lack of that option too a while ago. Most node based games have that in it. Doesn't really apply to what I'm working on so I never looked into how to modify it, but it was odd.
     
  10. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,730
    Well, I hope you are please to know that I'll be adding support for node based movement ap cost in the coming update.
     
    Stexe likes this.
unityunity