So I've updated TBTK a few days ago. With this update the vertical component for the grid is finally in place. let me explain what is it all about.
The grid can now be fit to a terrain/scene that has height variation. The system is pretty flexible imo, any collider with the designated layer can act as the terrain. The tile will adjust itself so it fits just above the terrain, in a perfectly horizontal manner. You can specify the minimum height difference required across the tiles to be considered of different level. I've design the system with XCom:EnemyUnknown in mind. So it works best when the level has a very well defined height level without too much slope. It still works with slope of course, but unless the tile size is relatively small compare to the elevation, the tile may seems partially sink into the terrain. In that case, some manually adjustment might be needed.
The height difference across different tiles will affect the gameplay in the sense that moving across tiles with different height will cost movement point. The bigger the height difference is, the bigger the cost. Also unit attack from higher ground will gain a bonus in hit-chance. On the other hand, any attack made from lower ground will suffer a hit penalty. The value of the movement cost and the hit bonus/penalty can be configured of course.
You can probably tell from the image that all the existing feature work with the new height element. Terrain can be used as cover if desired (just slap a Obstacle component on it) and will block line of sight when fog-of-war is enabled. Obstacle object can be place on any tile of any height. Walls can be used to block of adjacent tiles with height difference to create a cliff face.
The only thing I might left out is the movement and animation. There's no special animation movement pattern support for movement. The way I see it, there's no one size fits all solution for this due to the fact that the model of the unit can be anything and each can require a very different movement pattern and animation code. I'll just wait and see what's the user comment on this.
Apart from the vertical component, I've also tweak quite a lot of the internal working in hope of optimizing/improving the framework, and the bug fixes of course. They full change log is as follow:
Version Change – v1.0.7
addition/change
- change the way grid info is serialized which should improve grid generation time and grid limit
- added height component to the grid (see example scene – ExHeightComponent)
- optimized the AI code so it's more modular and easy to work with.
- improve a few things about how ShootObject works
- added effect type 'damage reduction' to unit ability
bug fix
- spawn unit will now work with ability that “shoots”
- ability with shootObject will now shoot towards their target (both unit or tile) instead of just tile
- using ability no longer reduce the attack count available on a unit in the turn
- fix bug where AI unit with movement disabled will not attack
- fix bug where all attack never missed