At the end of the Muromachi period, Japan was very rich, but divided into small city-states. The capital was still in Kyoto. In the late 1500s, the daimyo Oda Nobunaga gradually re-unified Japan. He bought guns from European traders and used the guns as patterns to make lots more guns.
Christianity in Japan
Oda Nobunaga also promoted Christianity to get his people fired up to hate their Buddhist enemies. And Oda Nobunaga put men (though not women) in charge based on how smart they were, and not just how rich they were.
When one of Nobunaga’s own soldiers killed him in 1582 (he was 48), Toyotomi Hideyoshi took over and finished making Japan into one country. Hideyoshi threw the Christians out of Japan. He tried to use the new guns to attack Korea and China, but the guns were not good enough. In 1598 he was killed in that war, when he was 61 years old.
When Hideyoshi died, he left only a baby son, and soon a daimyo from a different family, Tokugawa Ieyasu, took over as shogun. His capital was Edo (which is now Tokyo). Starting in 1635, Tokugawa Ieyasu made the daimyos spend every other year in Edo, with him, to limit their power and keep Japan one country. (A generation later, Louis XIV did the same thing in France.)
Edo became one of the biggest cities in the world. There was still an emperor (the Mikado), but he still didn’t have any power. The Tokugawa shoguns built good roads and minted good coins, but they didn’t think much of freedom. No strangers were allowed to visit Japan, and Japanese people weren’t allowed to travel to other countries.