Starting with 20:10, the Torah describes the way the Jewish Nation goes out to war. It delineates how we fight, the terms we offer for peace, and how we settle things properly.
In 20:10 the Torah says “When you come to a city to wage war upon it, you first offer it peace.” Fighting is never meant to be the ideal solution to our problems. We are meant to first look for peaceful resolutions to our disputes.
In 20:11 the Torah continues by letting us know what peace is: “If they respond for peace, all the residents of the city will pay taxes to you and will have to serve you”. Peace is not a fictitious set of achievements that allow situations to continue and let resentment fester and build up. Peace is a method of achieving a situation without having to kill all sorts of innocent people. The only way to have peace with our enemy is by having them be subservient to us.
In 20:12, 13, 14 the Torah continues: “If they reject the peace with you, you shall wage war upon the city. You should kill every male by sword. Only allow the women children and cattle to live. All that is in the city will be yours as spoils of war, etc.”
The Torah tells us how to fight and it tells us how to make peace. The prerequisite for this to happen is that we must be coming from a position of strength, not weakness. If our goals are clear and the opposing people are in fear of our strength and unity, then we will be able to achieve our goals, even peacefully. If we are weak, they will not accept our terms and we will not resort to the appropriate methods of warfare, and we will end up paying the cost in lives of our soldiers and more.