In ancient Japan, they served as spies and assassins. Some worked for particular noble families, like sneaky samurai, while others were basically covert-organizations-for-hire. They used disguise, deceit, and general trickiness to steal secrets and treasures, and they developed unexpected new modes of combat such as juujitsu (unarmed fighting) and "peasant" weapons like the sai (originally a rice planting tool) and the kusari-gama (which looks like a rice-harvesting sickle, but has a long weighted chain with hardened links on the other end that can break bones and disarm).
A few of their tricks are somewhat well documented; for example, they would disguise a log in clothes and a hat identical to their own, just barely hide it, and, when pursed, run past it. When their pursuers saw something that looked like the guy they were chasing hiding, they made the obvious assumption and attacked, thereby delaying the pursing party. If you wonder where Naruto's obsession with logs came from, well, now you know.
Another common trick was simple: Ninja were usually peasants and looked it, but knew gardening or some other skill that would allow them to get a job in the castle of some lord. The feudal system of Japan was such that the feudal lords (particularly the higher ups) tended to view peasants as interchangeable, thus giving the ninja an "invisibility" that had more to do with psychology than sneaking about.
Over time, they became feared. The primitive and superstitious people began to believe that ninjas were more than just dangerous spies and masters of disguise. They attributed magical powers to them, like the ability to shapeshift, conjure fire, turn invisible, control animals, and even mate with the spirits to give birth to monstrous half-human creatures. Because having the world simultaneously so terrified of you that it would pay a premium for your services and so hilariously wrong about the nature of your methods that actually countering you was hard was incredible for business, the secretive clans weren't exactly in a hurry to go debunking these folktales.
Ninja usually dressed like whoever they were disguised as at the time, since everyone stares at the guy in black pajamas. The iconic image of the head-scarf and robe clad "ninja" is actually an outgrowth of a clever bit of Japanese stagecraft.
In traditional Japanese theater there is no "backdrop" set, just a black felt curtain and stagehands manage the other sets and props while covered head-to-toe in black clothing. You may think this is distracting, but after a while, the audience is just trained to ignore them, the way you ignore that a stage is just a set and the actors only carrying props when you watch a play.
One incredibly clever playwright took note of the fact that the audience was trained to ignore these hands, and came up with a brilliant idea. When the script called for a ninja to assassinate a character, one of the stagehands would suddenly mock-stab them, leading to many double-takes and shat bricks on the audience's part. As with all good ideas, it was quickly appropriated by billions of talentless hacks who used it all the time, until the idea of the black-stage-gear-clad ninja was embedded deep into the public consciousness, simply because people always take their cues on what's real or unreal from fiction.
The move from decentralized feudal period to a centralized military dicatorship, however, dealt a heavy blow to the ninja's business, since, after all, a peaceful isolationist nation had much less need for their abilities, and the end of the shogunate and the modernization of Japan in the nineteenth century broke them for good, since their methods had grown dated with the passing years. Still, they remain in the public imagination, and in the hearts and minds of all fans of Japanese culture and history, weeaboo and non-weeaboo alike.
As a result, like the samurai, any traditional game with an ancient-Japan-proxy (read: all of them (or at least, all of them that grow to sufficient complexity)) has got ninja in it somewhere. Let's take a look.
Dungeons and Dragons 3rd Edition
Dungeons and Dragons 3rd Edition made the ninja a shitty rogue. Intended as a rogue/monk mix, but unlike Pathfinder they get much fewer skills than the rogue, no armor, and can't do rogue backstabbery unless invisible. They also can't use their weeaboo powers for shit because all of them draw from a super tiny ki pool and last only one round. The only one they get early enough to be worthwhile is invisibility which they need to (and can't) spam like crazy because, as said before, they get a shittier version of Sneak Attack that only works when invisible. So basically, they're rogues that can't skillmonkey OR backstab as well as rogues and get pretty much nothing in return.
Eberron has no Japan analog, or at least not one that hasn't been conquered by the Quori. Here Ninja are instead a creation of Elves with the Mark of Shadow. Note that Samurai, by contrast, are a Dwarf tradition.
Dungeons & Dragons 5th Edition
In Dungeons & Dragons 5th Edition, rather than make an entirely separate ninja class, they decided to simply roll it into the monk class as one of the "Ways" that a monk can choose to follow upon reaching level 3. The ninja option is the Way of Shadow, which allows the monk to use ki to cast certain spells (darkness, darkvision, pass without trace, silence, minor illusion), teleport from shadow to shadow, become invisible in darkness, and get a bonus attack against an enemy that was hit by someone else in that same round.
Pathfinder also made the ninja as a rogue/monk, and their vast variety of skills means that they outdo both classes by miles (except as skill-monkeys or number of attacks per round). They trade in the rogue's unique skillmonkey powers, like disarming magical traps, for "ninja tricks," which, like the monk's special powers, use up a ki pool. Also, they are perfectly capable of outdamaging the fuck out of rogues, given the nasty things they can do with projectiles and poison, on top of their sharing the rogue's backstabbery. They also get passive bonuses to their stealth tests the longer they've been in stealth, leading to hilarious shenanigans.
They also make a scrumptious dip class for monks and vice-versa, since their mixed martial arts passive abilities let their class levels stack for abilities, and the monk's flurry of blows explicitly works for all those ninja projectiles. Combine with the "ninja trick" that lets them double the number of projectiles they throw for a ki point, then combine that with poison... you get the idea. Hope the DM didn't let you get ahold of drow venom. In other words, Pathfinder ninjas are awesome. They are still screwed over by the many sneak attack nerfs introduced in Pathfinder, but at least they look cool.
Sadly when the Rogue was updated/fixed into the Unchained Rogue, the Ninja class was not updated along with it. It's almost possible to stack Ninja onto Unchained Rogue, but Unchained Rogue replaces Trap Sense with the same but better Danger Sense and makes it an (officially) invalid combination.
|The Classes of Pathfinder|
|Core Classes:|| Barbarian - Bard - Cleric - Druid - Fighter - Monk |
Paladin - Ranger - Rogue - Sorcerer - Wizard
| Arcanist - Bloodrager - Brawler - Hunter - Investigator |
Shaman - Skald - Slayer - Swashbuckler - Warpriest
| Alchemist - Antipaladin - Cavalier |
Inquisitor - Oracle - Summoner - Witch
| Kineticist - Medium - Mesmerist |
Occultist - Psychic - Spiritualist
|Ultimate X:||Gunslinger - Magus - Ninja - Samurai - Shifter - Vigilante|
| Aegis - Cryptic - Dread - Marksman - Psion |
Psychic Warrior - Soulknife - Tactician - Vitalist - Wilder
|Path of War:||Harbinger - Mystic - Stalker - Warder - Warlord - Zealot|
Legend of the Five Rings
Legend of the Five Rings is mostly about samurai shenanigans, but ninjas both exist and are potential sources of PCs . Only two of the Clans in Rokugan have ninja on the payroll (well, technically, only the Spider have ninja, the Scorpion are very insistent that they have shinobi -- the two are written the same, but differ in how you pronounce the characters). Ninja are theoretically regarded as somewhat mythical: actively talking about ninja like they exist in a court setting will lose you honor and result in lots of scorn and ridicule from the stuffed-shirt courtiers. In practice, most samurai do know they're real, so don't hesitate to tell people you trust in more-private and less-open settings when there's an assassin on the move.
Scorpion shinobi are, hilariously, probably the most level-headed and moral people in their crazy clan of manipulative assholes and anti-heroes. They actually start out running the Gauntlet, a series of tests that involve dressing like a "traditional" black-pajamas ninja and essentially running interference, attracting lots of attention while the actual ninja that's probably been posing as a manservant or courtesan for months does the necessary sabotage/wetwork/spycraft/etc. Those who survive get to learn to be REAL operatives.
The ninja of the corrupted Spider Clan are... less theoretically-benign. They're ordinary people who have traded away bits and pieces of themselves to the Shadow Dragon, a manifestation of the Lying Darkness whose malign power seeks to consume the world. They're probably better at outright assassination than Scorpion shinobi, since their powers are practically supernatural instead of just realistically good, but they often have very little personality or initiative of their own. It makes them good at not being noticed, or at pretending to be other people, but when the mask slips, they won't have the skills to talk their way out. Scorpion ninja can be good at lots of things, but most Spider ninja know only how to kill and steal.
While the ninjas of this setting only resides in Nippon (aka warhammer japan) the eastern continent GW does not giving a shit about and is therefore underdeveloped with little information about them nor is there any miniatures. Luckily, a bunch of Skaven from the clan Eshin was able to learn their ninjitsu arts after travel to the far east and became a bunch of backstabbing, shuriken throwing, cloak wearing, back flipping rats that decimate their enemy with sheer cunning and surprise tactics. Then there's also the occasional Man-Eater Ogre who does the same thing and pick up some of their tricks.
There are also other units from other faction/race where they utilize the cunning and stealthy tactics of a ninja without copy Nippon.
For the Dark Elves, there's Shades, who can move quietly in concealment while carry armor piercing crossbow to devastate their enemies in a surprise attack.
For the High Elves, there's Shadow Warriors, the descendants of the Nagarythe elves during the great sundering who are skilled in guerrilla warfare and concealment tactics. Alith Anar the king of Nagarythe is the leader of these badasses and he took the guerrilla warfare to a whole new level with his op war gear: The Moonbow that turned his every shot into a bolt thrower, Shadow Crown that can stop the fucking time for just a few seconds whenever he said Nagarythe, and finally Stone of Midnight a jewel that alith anar stole from Morathi that allows him to conceal himself in shadow.
For the Wood Elves, most of them are already experts of this kind of fighting style since they always conceal themselves with the forest, but there are the Waywatchers, who are skilled in concealment, shooting arrows and setting up booby traps. Then there are Wardancers, the warriors of their trickster god Loec, who fights with either twin blades or double sides double sided spear while performing war dance, lethal movements that devastates their enemies with absolute cunning while avoiding enemy strikes.
For the Lizardmens, there are these specialized poison darts Skink called Chameleon Skinks that has the looks and the ability of a real life chameleon, conceal themselves to perform guerrilla warefare while protecting them from enemy range fires.
For the Greenskins, there's night goblins. Due to years of consuming mushrooms and other potions, they have natural camouflage that conceal them in dark area. They are also pretty dangerous due to the consumption of fungus beer, where they could fight in absolute fanatical states. There are also these Nasty Skulkers who specialized in surprise tactics and is able to pierce enemy armor due to the two sharp razor blades they wield.
For the Dwarves, there are rangers who specialized in concealment, booby traps, sabotages and guerrilla warefare. Like all dwarves, they are slow and good in melee combat, but is still much faster in comparison due to wearing lacks of armor. They are also shunned by other Dwarves for being a bunch of weirdos fighting in cowardly tactics.