A UAV swarm network is a network formed by aggregating a large number of UAVs and coordinate them to execute a specific mission, especially in areas where human intervention is not physically possible or economically viable. The process of coordinating and maintaining a UAV swarm network has various phases. The pattern formation phase is one of the important phases and is highly significant in missions where geography is an important aspect of the mission. For the purpose of automating the pattern generation process, this paper proposes the dynamic polygon generation (DPGen) algorithm that can generate convex polygonal pattern with any number of vertices in linear time. The DPGen algorithm generates a pattern dynamically for any number of drones which increases the scalability of the UAV swarm networks, increasing the magnitude of use-cases of the swarm. The DPGen algorithm contains a mechanism to use this algorithm in a decentralized manner while balancing the load on all the UAVs in the network. The usage of DPGen algorithm reduces the network traffic in the UAV swarm network by 78.26% and decreases the power requirement of the leader drone by 74.39%.