When Starbug was attacked by the Despair Squid and sprayed with his venom, the ship crashed into a sandbank and the resulting explosion killed the crew. They awoke in an Artificial Reality suite and were told by a recorded voice that they had spent the last four years playing a computer game.
There were slots for four different characters, each of which had various bio-feedback devices and tubes for feeding (and relieving) the player's bodily functions. When the machinery disengaged itself, the Boys (who thought they were) from the Dwarf realised that they were not the people they remembered.
The attendant, Andy, told them that their memories would return in time, but that they had to make room for the next set of players. "Red Dwarf" was a very popular game on the Fascist Earth where the arcade was situated, having a two year waiting list even with 20 gaming machines. He was very critical of their performance in the game, pointing out all their failures. These included: not realising that Rimmer was a Space Corps special agent, Lister not winning Kochanski's heart, not jump-starting the second Big Bang, failing to locate the planet of the nymphomaniacs and getting killed by the Despair Squid instead of using the Esperanto's laser cannons to destroy it. They had finished with a pathetic score of only 4%.
When the next players came into the suite, they were much more successful. As the old Lister was leaving the building he looked at an observation screen which showed him how the new Dwarfers were doing. The handsome and confident New Lister had saved Kochanski and his posse from an exploding Red Dwarf and was clearly having a much better time than his predecessor.
It was later made clear that these games were an escape for the people of Fascist Earth form the oppressive goverment. All of these revelations made the Dwarfers very depressed, with circumstances conspiring to drive them to suicide. Fortunately, Holly was able to snap the crew out of their shared hallucination and convince them that the game didn't really exist. (RD: Back To Reality).