The shogun was needed most when the Daimyo stopped paying taxes and the government lost control over their people. The Daimyo started to rise and got followers and armies of samurai warriors. The emperor needed an army of his own to protect his land and a leader for that army. So up came the shogun, and then he gained power.
He was to protect the emperor's land and fight for land from other clans. He was the only part that kept the emperor's land from being conquered.
Feudalism started when Daimyo stopped paying taxes. As stated earlier the emperor and the government wasn't in charge any more they needed a army, and one who led it. The shogun came to the top and gained a lot of power. His choice came first and he was a commander over many samurai. He also got a lot of land in return for being the shogun and paid the most. It also affected him because he could get killed in war being shogun.
The shogun's role was not just leading the samurai and leading the war but he also ruled the government.
The shogun gained power in feudal times when the emperor needed someone to protect his land. The shogun eventually had so much power that he had the true power and the emperor was just a figurehead. The shogun's decision always came first instead of the emperor's.
The relationship the shogun had with others is that he had controll over everyone, including the emperor who had no power over the shogun from the 1100's to the 1800's. He would give protection over everyone, and ruled the government called a shogunate. A shogunate was usually made up of a shogun, shoguns, or a shogun's family. The rules he stated affected everyone in how they lived their everyday life. He commanded the army made up of samurai protecting, and also gave land to the samurais who were in the army.