Mod discretion. ;) Basically, it comes down to a combination of official agreements (Celtic Reformed Bloc alliance, Chagatai-Lahore alliance, East Asian tributary systems, royal marriages, and the like), past relations (such as who was on what side of the German War of Religion), and various...