RTS Grid and Pathfinding

I’m making an RTS game, but I don’t know how to make a grid for building objects. How would I go about doing that?

Also, I really have no idea where to start on my AI pathfinding. I’ve seen something about A*; What is that?

I’m pretty new to Unity and only know some very, VERY basic crappy scripting (but I want to learn), so try not to use too much fancy lingo, and if you do, please explain it.

All help is appreciated!

If you’re that new to Unity, pathfinding might be a bit of a stretch. A* is the name of the algorithm used for most path finding. I think it’s about nodes, finding the closest neighboor etc. Anyway, if you still want to go for it, try AngryAnt or AronGranberg’s packages.

About the grid, if you need only the visual part, projectors are great for that (see the unity package about projectors). If you need it for positionning stuff, that’s another matter. There is some assets on the assetstore that could interest you, or you could do your own.

I must agree with Berenger, A* pathfinding is quite a jump for someone new to unity, however to make a grid, here is a simple code :

var length : int;
var width : int;
var nodeSize : int;
var gridArray : new Array();

function Generate () {
   for(var x = 0; x < width; x++){
      for(var z = 0; z < length; z++){
         gridArray.Add(Vector3(x*nodeSize, 0, z*nodeSize));
      }
    }
}