The other important factors are the stress the animal is under at time of death and how well it is able to be bled.
Domesticated animals are at rest when they are killed, and they are bled while they are still alive and the heart is still beating. That means the muscles have plenty of glycogen reserves and there is very little blood left in the tissues.
In contrast game animals are often running/flying when they are killed so they are full of adrenaline and have depleted adrenaline stores. They are also only normally bled after they dead, and in the case of birds they often aren’t bled at all. All of that results in chemical changes in the meat (that I won’t go into here because I only half remember it) that contribute to the gamey taste. That;s also the reason why abattoirs go to such lengths to avoid those factors
So it’s not entirely diet, though diet’s a large part of it.