Following a tip from a Klingon ship, the Federation starship Enterprise, under the command of Captain Jean-Luc Picard, finds debris from an Earth ship orbiting an uninhabitable alien planet. A sample of the debris beamed aboard shows NASA markings and a 52-star American flag. To investigate how such an old ship got so far from home, Commander Riker, Lt. Worf and Lt. Commander Data beam down to a small area capable of supporting human life and find a revolving door. Upon entering they find themselves trapped in an old Earth-style hotel/casino called the Royale where they are cut off from contact with their ship.
While exploring the building after unsuccessfully attempting to leave, they find the remains of Col. Steven Richey, a NASA astronaut who had lived to a very old age, and a book titled Hotel Royale by Todd Matthews. Upon reading his diary it is revealed his starship was in confrontation with aliens and he was the only survivor. Taking pity on him they created The Royale for him thinking the novel was an instruction of humans' preferred way of living. Little did they know Col. Richey's time in The Royale was a living hell. Data, Riker, and Worf eventually discover that they are inside a living version of the book the same as Col. Richey was.
However, their newfound knowledge doesn't get the away team any closer to finding a way out of the building, until a quick read-through of the novel reveals that it had been recreated in detail by the aliens, and its contents played out in its entirety. None of the characters (or the away team) can leave until they are scripted to do so. As such, Riker realizes they have to assume the role of the characters in the novel to escape and, using the building's craps table, raise enough money to become the nondescript "foreign investors" destined to buy out the Royale. They successfully leave after fulfilling their part of the story.
In the scene where Chief Engineer Geordi La Forge scans the planet, he describes the surface temperature as -291°C, a temperature that is below absolute zero (−273.15°C). Although absolute negative temperatures are not impossible, it would mean that the planet is incredibly hot and radiating massive amounts of radiation, which is the opposite of how it is portrayed in the episode.
When observing Col. Steven Richey's uniform/suit the mission patch on the sleeve is an Apollo 17 mission patch.
During the craps game in the final scene, Riker comments, upon Data's getting a point of 6 in the craps game, that "the probability of making a six is no greater than that of rolling a seven". In fact, there is a 5 in 36 probability of rolling a 6 in craps (on every roll) compared to an 18 in 36 chance of rolling a 7.