Disclaimer: This answer is focused on Europe
That’s probably exactly what you’re trying to do. It’s not like you send letters back and forth saying “meet at Agincourt on Oct 25 at 10 am”
If you’re an invading arming you’re moving through enemy territory and they have scouts tracking your movement, or trying to, at least. (And you likely have scouts tracking theirs)
Some examples- at Agincourt the English were trying to run away, but the French army caught up with them, so Henry was forced to meet them in combat. At Gettysburg the armies were within only a few miles of each other and almost no one realized. And it’s lucky too because Lee was trying to out maneuver the Union army to attack DC in exactly the manner you describe.
So it’s not that there were specific times and places battles were scheduled (usually, at least, I’m sure there are least some examples of this) but that part of being a good commander was 1) knowing where the enemy’s army was by using scouts 2) being able to maneuver your army to an advantageous position compared to the enemy and 3) knowing what an “advantageous position” was. As you said maybe this was defending a town, maybe it was on a hill so they’d be attacking downhill, or with the sun to their backs.
Also- remember that any town of decent size would likely have been walled, also to protect against an attack. This leads to other strategies, such as using siege equipment or trying to starve the town into surrender.
Hope this helps I’ll try to answer follow up questions if you have them