PX4 multiple vehicle simulation help

Hi everyone. I am new to PX4. I am trying to perform some simulations with drone swarm. I need to simulate multiple drones (20 for example) with PX4 and gazebo. I am using WSL, Ubuntu 22.04, gazebo harmonic. I followed guide for multiple vehicles and everything works fine for nine vehicles (i can connect and control using python mavsdk). Using following command, changing instance and pose for every model

PX4_GZ_STANDALONE=1 PX4_GZ_MODEL_POSE="0,0" PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1

If 10+ vehicles are created can’t connect to vehicles 10+. I believe it happens because 9 and following vehicles are using udp://:14549. How can i change this behavior and use unique port for each new vehicle? What ports will be safe to use? Thanks for the help in advance.

I was able to figure this out.
File ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink should be updated to support more than 9 instances. Specifically, this part

udp_offboard_port_local=$((14580+px4_instance))
udp_offboard_port_remote=$((10540+px4_instance))
# udp_offboard_port_remote=$((14540+px4_instance))
# [ "$px4_instance" -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps
udp_onboard_payload_port_local=$((14280+px4_instance))
udp_onboard_payload_port_remote=$((14030+px4_instance))
udp_onboard_gimbal_port_local=$((13030+px4_instance))
udp_onboard_gimbal_port_remote=$((13280+px4_instance))
udp_gcs_port_local=$((18570+px4_instance))