A hypocorism is a nickname that shows affection or closeness. If your dog's name is Buster but you tend to call him "Sweetiecakes," you're using a hypocorism.
A pet name is a hypocorism, and so is the addition of a diminutive suffix to the end of a name, like when you change the name "Bill" to "Billy." Some hypocorisms are as straightforward as changing "Melissa" to "Missy," and others are strange terms of endearment, like your mom calling your dad "Boopsy" when she thinks no one can hear. The Greek root word is hypokorizesthai, literally "to use child talk."