The Truffle is a Hard ModeNPC and will only show up once you have constructed a house in an above-ground Glowing Mushroom Biome with Mushroom Grass Seeds. If you want to do this but don't want to take up a lot of surface space, a good way to do it is to build a skybridge of mud off of a Floating Island, plant Mushroom Grass Seeds, and then wait. (Note that the skybridge must be 2 mud blocks thick, and that the house must meet all of the other normal NPC house requirements.)
When an enemy comes in range, Truffle will summon mushroom spores to act as aerial landmines.
When trying to move him into an NPC house outside of a Glowing Mushroom Biome, the player will get the message "This housing does not meet the requirements for a Truffle" on the lower left-hand side of the screen.
A total of 100 tiles of Mushroom Grass/Glowing Mushrooms, or a combination of both that sum up to 100, is required to make a mushroom biome.