"By Heracles, this is the end of man's valour!"As cool as gun fights can be, they just can't accomplish the level of intensity of a one-on-one duel with swords. If a hero has a gun, he can just shoot the villain from afar. But with swords, they can get up close and personal, engage in witty banter, look each other in the eye, and, if one gets that fatal cut or thrust in, engage in the drama of watching the other die. This is why even modern-day Action Movies will often have their final showdown be a hand to hand confrontation between the hero and the villain rather than a gun fight. The reason may also be that guns are too modern. They're the primary weapon of choice in the real world. If fantasy authors want to achieve that escapist, ancient feel in their story, they have to use ancient weapons. Guns don't have that level of romance. This could also be the reason why Automatic Crossbows are excused despite being functionally similar to guns. There is also the widespread perception that guns take all the "skill" or "honor" out of fighting and make the heroes look cheaper: no intensive training with ancient masters, just "BANG! He's dead." This is also the reason for the Gun Fu trope as authors mix hand-to-hand combat tropes with gunplay in an attempt to capture the choreography lost from using a gun instead of a sword. One is only left to wonder if some long time in the future, where they fight with yet-unimaginable weapons, it's going to be guns that carry the "oldie but goodie" flavor of cold steel in today's fiction. Ready, aim... fireball! May or may not be justified in Magitek settings. Why bother with explosives when you can blow somebody up with a fireball? Because anyone can use a gun, but not everyone can throw fireballs. This is a common issue of technology versus magic: technology works for people who haven't spent years studying the sacred mysteries. (The same problem exists for longbows.) But if the magic trinket can be activated by anyone, why bother with explosives when you can blow somebody up with a fireball from a wand? 'Point, say the command' is just as simple as 'point, pull the trigger' assuming a wand doesn't just need a thought to activate which in itself is advantageous. With greater power and availability of magic this becomes less and less of a problem. In other words why bother with a gun that's heavy, has limited ammunition and chances of jamming when you can use a little inconspicuous stick that has limitless shots and can be used for a variety of functions aside from killing. Especially true if the setting can have small wands or similar magical trinkets capable of mass destruction. The same can't always be said of guns unless they're some kind of Magitek. This is the reason that, for the most part, guns aren't used in the Eberron setting of D&D (although they do exist).
—King Archidamus of Sparta (IV century B.C.), according to Plutarch, on seeing the missile shot by a catapult. (Thirty Years' War-era writers thought the same.)
- In a lot of settings, even ones that don't deal with magic vs technology or Magitek, magic is rarely that easy or practical. Activating trinkets might require a large degree of knowledge or skill (for example, D&D, these types of items can only be used by classes that generally would be capable of casting the spell in the item, in many cases better than the item does, or has specialized training specifically in activating these types of items), the items are prone to backfiring (Warhammer loves this, even people with training often can end up killing themselves or allies with these types of items), these items are almost always incredibly expensive, these items tend to have limited charges, and anti-magic defenses are frequently much more efficient than anti-bullet defenses.
Despite all of this, there are writers who are talented enough to make guns work in their fantasy settings and even have them achieve a level of coolness equal to medieval weaponry. Perhaps it's understandable why guns aren't seen much in fantasy settings, but it's still nice (if you like guns in your fantasy) when authors manage to do it. After all, there were not only loosely historical The Three Musketeers, but Baron Munchausen himself used a firearm and it didn't make his stories any less of... what, Heroic Fantasy? Of course, it could just be that guns scare children and therefore are never, ever to be in a children's show... even if magic is just used as a stand-in for guns instead. Conversely, assuming that gunpowder must automatically exist once reaching a certain level of advancement is to fall into a logical fallacy; development can happen at different rates in different fields, especially in a world that already has Functional Magic to make long-ranged destructive attacks. This is particularly the case if the functional magic and/or setting results in tactics differing greatly from the setting in which early guns found their first use in real history: firing in volleys using soldiers marching in ranks on battlefields. Guns present their own set of logistical issues in the form of supplies of gunpowder, as well as the cost of munitions (which severely curtailed the number of rounds of ammunition that gunpowder armies could use in training until the second half of the 19th century). Or maybe the author outright despises guns and wants to create a world where they - and whatever other technologies the author may think are ruinous - do not exist for that purpose alone. One historical note apt to be ignored is that the discovery of gunpowder was a major fluke in human history, perhaps the most major one. Unlike many other technologies— unlike metalworking, stone-cutting, carpentry, writing—as well as inventions like spoons, swords, wheels, bows, etc., which were independently discovered/invented all over the world, gunpowder was discovered exactly once by accident by people who weren't even looking for it: Chinese alchemists trying to create an elixir of immortality. While eternal life eluded them, they found this gunpowder stuff was highly flammable and, with the right formula, highly explosive. The Chinese used gunpowder weapons in their desperate, losing war against steppe tribes and seized upon them as a way of turning the tide. It didn't work, but they ended up with an effective formula and a series of cheap mass-produced weapons based upon it (chiefly pole-grenades and pole-guns for use in defending against siege-assaults). It didn't take long to spread to India, where local warlords figured out ways to use it in their own wars, and eventually the Middle East where it was also popular for the same reasons. It even ended up reaching the quintessential backwater of the pre-modern world, Europe, after a while. Of course, none of this is to say that gunpowder wouldn't be invented eventually in most scenarios, but only in more or less in the same sense as the old thing about how infinite monkeys on infinite typewriters would eventually produce the works of Shakespeare. Justifying the Trope There are a number of ways to justify the trope, for those that care to take the time, mostly based on engineering concerns or historical analogy: 1. Literal gun control — The main reason that it took three centuries for gunpowder to cross from the Song Empire to Europe was that the alchemical 'recipe' was the equivalent of a state secret in each new realm it spread to. In a fantasy culture, even in the absence of that kind of state control of military technology, the people who do all the alchemy tend to be the same people that work with magic, who are easily motivated to keep it a "trade secret" to avoid competition in the realm of fireball-tossing. 2. Missing ingredients — Saltpeter, especially, can be rendered essentially unavailable by basic changes to biology or terrain. For instance, if bats are magical enough to make wandering through caves collecting guano an extreme hazard to life and limb (not a stretch in D&D-based stories) making the stuff isn't worth the pain even if you know how, and it's certainly not common enough to waste on projectile weapons when you've got perfectly serviceable crossbows that have better penetration anyhow. 3. High explosives happened first — If someone worked out how to multiply nitrate glycerine or toluene before working out a low explosive like gunpowder, society may have skipped over to bombs and given alchemical explosives a reputation for being something you don't want anywhere near your face. 4. They exist, but they're not cost-effective — In the medieval period and, really, the entirety of history up through the Crimean War/US Civil War, personal firearms were not quite as long-ranged as crossbows and lacked the penetrating power and reliability, and mostly took over because they were cheaper to maintain and manufacture, transport, store, and make ammunition for than bolt or arrow weapons (India and Europe fought so many internal wars that the scarcity of bow-wood made bows more expensive than guns after about the 16th century or so). All it takes is iron being scarce and/or wood plentiful (making bows cheaper as well as better), a military that just doesn't do much naval warfare or siegesnote , or a military and society that just doesn't do much warfare full stopnote and you have very few people using guns. This is exactly how things actually happened, as so spectacularly illustrated by the First Opium War of 1840-42, wherein the forces of two European societies who'd had fought through more than 3 centuries of virtually non-stop gunpowder warfarenote faced off against the forces of an empire which (starting from a similar if not greater standard of gunpowder-usage) hadn't fought a siege or naval battle for three centuries.note . The result was... predictable. 5. They are out of scope. Medieval guns were more like battlefield equipment instead of personal weapons. They required a piece of burning rope which would first ignite a bunch of gunpowder in an open pan, which in turn would ignite the gunpowder inside the gun. This means you needed a lot of preparation before firing it, and you couldn't really use it while on the move. Also, starting a fire was a lengthy process. The issue with medieval guns wasn't the reload speed alone, muskets in Napoleon's time were just as slow to reload, but you could fire a loaded flintlock musket without any significant preparation. Not so with medieval guns. By the time wheellock and flintlock were discovered, the time we call the medieval era was over. This means all the guns you had in medieval times were a battlefield equipment, used by armies against other armies. However, most fantasy novels and role-playing games are focused on a very small group of adventurers on specific quests, and not on huge armies on an open battlefield. Dungeons and Dragons, notably, takes a combination of justification 4 and analogy to real-world medieval firearms: you can purchase them, and they're even simple weapons (you don't need to be a soldier to use them), but they're short-ranged, slow-loading, extremely expensive, prone to failure, and not really any more powerful than their wood-and-iron counterparts, though lucky (critical) shots occur more often.