Ryoga is the rival of Ranma. He has horrible sense of direction and is constantly getting lost on his way to battles, even if they're in his own backyard. He is also cursed to turn into a pig whenever he is exposed to cold water.
Ranma and Ryoga became enemies from back in middle school, where during lunch, Ranma would out manoever Ryoga's attempt to get the last pieces of bread distibuted. this happened on so many occasions, that Ryoga challenged Ranma to a battle in his backyard, 3 days from the challenge. however, due to his lack of a sense of direction, he manages to cross the whole of Japan before arriving at the destination, to find Ranma, who was kept waiting for 3 days straight, had given up and left.
however, Ranma went to China to train with Genma, Ryoga went to follow him to make him rebattle. however, on arriving in Jusenkyo, he ran into both Genma and Ranma, who had already been cursed and were in their panda and female forms respectively, then knocked Ryoga into the "Spring of the Drowned Piglet". He took the form of a black piglet, and maintains his bandana.
Later on, He finds Ranma after he is engaged to Akane. the two eventually fight, with Ryoga having the upper hand. however, when it started to rain, Ryoga transformed, unbeknownst to Ranma. He was found by Akane, who adopted him, naming him P-Chan. this allows for every so often for Ryoga to sleep with Akane in this form, which he enjoys after developing feelings for her.
The close proximity to Ranma allowed for a time for the two to coexist relatively peacefully, willing to help each other out to a certain extent.
Thanks to Cologne, he was able to learn the "Breaking Point Technique", which he used in battle against Ranma in the mountains, with dating rights to Akane as the prize. the battle was intense, with the advantage switching between the two, until Ranma, who improved his "Chestnuts-Roasting-on-an-Open-Fire" Technique, was finally able to defeat a significantly stronger Ryoga. at the end of the battle, both fell off a cliff into water, but Ryoga was rescued by Ranma, and was seen leaving.