Like a Counter-Strike bot

I want to use emptys to make my NPC’s do like an CS-bot: walk only where it has an empty.
But, in my mind, the work to do this is manual, and is too hard.
For example:
I have a character walking forward. When he gets near to one of these emptys, it makes he turn to another random empty, which is “adjacent” to the first one (there isn’t any emptys or obstacles between them).
So, what’s the problem? There are two problems:
1st: The “Track to” is bugged. If the pivo is behind the character, the character gets crazy.
2nd: I only know to make this manually. I can’t make the computer counts the number of valid emptys, I can’t make the computer knows what emptys are valids. Is there any way to make the computer knows by itself these things?

Yeah, directly behind. So add an empty off to the right or left before he goes to the one behind.
I can’t really understand the second part of your question. If you use invisible planes instead of empties, you can use the near sensor and get properties from the plane from near.getHitObject().property.

Let me explain better the second question:
A “valid” empty is an empty which is adjacent to the empty you are now. “Adjacent” means that there aren’t any other emptys or obstacles (like walls) between the two emptys.
Did you get it now?