• Subcribe to Our RSS Feed

HexTactics: Prototype Build 1

Jan 29, 2012   //   by Josh   //   Unity3D  //  3 Comments

Another 4 hours into HexTactics and I have a playable prototype build ready!

Click here or on the image below to try it out! http://redclovergames.com/blog/?page_id=565

 

For the technically inclined, here’s a quick list of features implemented so far:

  • Basic path finding (using A* of course, thank you Aron Granberg!)
  • Controllable Wizard Unit w/Fireball spell
  • Collapsible bridges
  • Walls and Castle structures

I think I’m going to like this project…

3 Comments

  • Great work as usual. Can you tell me more about A*, did you use the free version of Aron Granberg?

  • By the way, any chance to post some code and explain how to select with the mouse the hex you want?

  • I did use the free version of A* from Aron Granberg… incredible A* toolkit if you ask me. Maybe I can work up a tutorial to explain how I used it… but if you want to dabble, my approach was to add an empty game object to every tile called “NavPoint” in the center of the tile. I created a new Tag in Unity called “NavPointTag” and set the Tag of the NavPoint object to “NavPointTag”. Then, using his getting started docs (http://www.arongranberg.com/astar/docs/getstarted.php), created an A* object and used a ListGraph, set the Tag to “NavPointTag”, set the max range to an appropriate size and clicked Scan. This generated a perfect path graph for a hexagonal map. Then I use a Seeker object (http://www.arongranberg.com/astar/docs/calling-pathfinding.php) to find nodes given a starting location (the current unit) and the ending location (the tile that the user clicked on).

    Now, regarding the mouse tile selection. My technique is similar to this (http://answers.unity3d.com/questions/134412/selecting-and-unselecting-objects-with-raycast.html), but I’m sure there are other ways to manage it. Each tile has a MeshCollider attached to it, so I use a Physics.RayCast from the camera through the mouse cursor and if the object I clicked on is a Hex Tile (by looking at a component on the raycast hit object), then I’ve selected a tile!

Leave a comment