Crescent-shaped barchan dunes are highly mobile dunes which are ubiquitous on Earth and other solar system bodies. Although they are unstable when considered separately, they form large assemblies in deserts and spatially organize in narrow corridors that extend in the wind direction. Collision of barchans has been proposed as a mechanism to redistribute sand between dunes and prevent the formation of very large dunes. Here we use an agent-based model with elementary rules of sand redistribution during collisions to access the full dynamics of very large barchan fields. We tune the dune field density by changing the sand load/lost ratio and follow the transition between dilute fields, where barchans barely interact, and dense fields, where dune collisions control and stabilize the dune field. In this dense regime, barchans have a small, well-selected size and form flocks: the dune field self-organizes in narrow corridors of dunes, as it is observed in real dense barchan deserts.