After traveling through the Stargate, Major Lorne's team discovers a grid of satellites in orbit above a planet. After landing on the planet and discovering two civilizations, neither of which is capable of launching civilizations due to their low technology, Lorne contacts Atlantis. It seems that one of the civilizations regards McKay as a deity.
McKay and Sheppard quickly understand the situation and inform Weir about an after-hours activity the two have been engaged in. Shortly after arriving from Earth, McKay and Sheppard discovered an Ancient game room that housed a "Simsesque" world consisting of two societies. Each man controlled one society with the objective of outshining the other's in areas of agriculture, weaponry, science etc.
After arriving on the planet, Sheppard's team investigates and realizes that they were not just playing a game but conducting a complex real-life, real-time social experiment that the Ancients originally conducted. McKay is welcomed by his civilization (Geldar) as an Oracle by Nola, who Rodney modeled based on a woman he liked. Nola explains that their villages have occasionally been culled by the Wraith, and two years ago the Oracle visited them two years ago and advanced their technology and gave them his pictures. She shows them the "Portal," which connects to the satellites and relays the information to Atlantis, and vice versa. Nola speaks of Hallona and says now the Atlantis team will help dispose of them.
Back in Atlantis, Zelenka discovers that dozens of other societies on several planets throughout the Pegasus galaxy are also programmed within the database of the "game". Some of the societies had flourished on their own after the ancients stopped providing commands thousands of years ago. Others had been destroyed and wiped-out by war.
Sheppard brings Baden, the leader of Hallona, to meet with Geldar. McKay and Sheppard soon realize that since they have been in control of the "game", tensions between the two societies have escalated from a long-standing peace, to the verge of war.
In the "game-room," Zelenka and Lorne are tempted to assist a civilization in the database by saving the people from starvation. They feel they could improve the living conditions of the two civilizations on another planet.
McKay and Sheppard recall the actions that lead to the tense situation between the two civilizations. They recall the poor trade relations, McKay's command to secretly exploit the coal resources of Hallona, and their own personal hostility towards each other while playing the game. McKay and Sheppard arrange a meeting in Atlantis between the two leaders to help ease the tension between the two societies. Nola is shocked at the fact they her civilization is merely a pawn in their "game." Baden insists Sheppard continue to help them by providing more weapons and notes that Sheppard would do the same thing they want to do.
Weir is forced to discuss the treaty alone with Nola and Baden. Being technologically advanced by hundreds of years, the people of Geldar consider the people of Hallona as inferior barbarians. Meanwhile, the people of Hallona consider the people of Geldar as hostile invaders. Weir fails as it becomes clear the two civilizations reflect the opinions and attitudes of McKay and Sheppard. She tells Sheppard and Weir to try to get through to their respective civilizations, but they don't have any luck. Worse, even McKay and Sheppard can't agree how to deal with the problem and Weir tells them to figure it out. Zelenka tells them that Hallona has launched an attack on Geldar.
The attack doesn't cause any casualties and Weir sends them back with the Atlantis team to try and make break. Rodney and Ronon watch as Hallona's forces attack and Nola orders a counter-attack. They contact Sheppard and Teyla in Hallona, but the Geldar forces surrender. Nola says she has another plan and reveals they've constructed a bomb using Rodney's technological advancements, and plan to drop it using a dirigible.
Zelenka and Lorne soon find themselves captivated by the game, competing against each other when "playing" another civilization that is in trouble. Dr. Weir discovers them and has the system shut down.
Sheppard and Teyla use the Puddle Jumper to shoot down the dirigible but Nola orders a new attack with more bombs. Sheppard warns Baden they're not going to do it again, and Baden orders a full scale attack to finish the war. Sheppard's team beams up to the Daedalus and hastily devises a plan to prevent the war.
The team returns to the two civilizations and Rodney tries to convince Nola that he was wrong and she should call off the attack. She refuses and Baden is equally stubborn. Using the Portal devices, Nola and Baden watch as bombs explode throughout their villages, the ground shakes beneath them, and people flee to escape death. Both Geldar and Hallona lose hope and both Nola and Baden believe they have been defeated. Following the war, McKay and Sheppard inform Nola and Baden that what they experienced was an uploaded "Doomsday Simulation", uploaded from the Daedalus, to show them what they can expect from an actual war.
McKay and Sheppard return to Atlantis and start another game, this time playing a game of chess. Weir informs them that Nola and Baden have agreed to talks for a peaceful resolution. Meanwhile, McKay and Sheppard's competitive natures remain intact, and they never quite resolve a truce between themselves.