Cannons were really effective from a fairly early point (see conquest of Constantinople/Byzantium), and in a lot of universes with magic it’s still much easier to make a cannon than a wizard.
You can assume that a city on the level of Constantinople would have magic-reinforced walls if that’s possible, but only if that magic system actually has spells for that, which isn’t a given. In some fantasy universes, guns are specifically useful for piercing a wizard’s protection spells.
Though really, it comes down to how common it is to have people who have whatever is needed for magic, and how long it takes to train them until they are more likely to blow up the enemy than themselves. And whether the author(s) want(s) to make guns useful in their world.
Cannons were really effective from a fairly early point (see conquest of Constantinople/Byzantium), and in a lot of universes with magic it’s still much easier to make a cannon than a wizard.
You can assume that a city on the level of Constantinople would have magic-reinforced walls if that’s possible, but only if that magic system actually has spells for that, which isn’t a given. In some fantasy universes, guns are specifically useful for piercing a wizard’s protection spells.
Though really, it comes down to how common it is to have people who have whatever is needed for magic, and how long it takes to train them until they are more likely to blow up the enemy than themselves. And whether the author(s) want(s) to make guns useful in their world.