From The Lion of Comarre by Sir Arthur C. Clarke,
Thrilling Wonder Stories, August 1949
First, some background…
One thousand years in the future, Richard Peyton has located the fabled city of Comarre, constructed by a social movement called the Decadents, and lost to humanity for five hundred years.
It’s located in a huge continental nature preserve, where overflights are strictly prohibited. Lucky, that.
Surprised by its compact form factor (but then, if it sprawled it would have been rediscovered years earlier), Peyton effects a successful entry to the brooding, mysterious structure. Wandering its deserted halls, he finds a strangely uniform interior plan. Most of the structure is devoted to lavishly appointed sleeping chambers.
Peyton is an engineer, possibly the best of his generation, and he’s itching to find and master the legendary technology rumor attributes to the lost city. But time passes and he grows weary. Perhaps a brief nap is in order? Certainly there’s no shortage of beds.
His head has barely hit the pillow when he experiences a curiously vivid dream.
Then he seems to awaken in a curiously familiar world. Then, things get a little hazy…

If Richard Peyton had ever known time, that knowledge was forgotten now. Only the present was real, for both past and future lay hidden behind an impenetrable screen…In his enjoyment of the present Peyton was utterly content…

By a stroke of luck, he is awakened by the ringing of his pocket phone…

Later he was never able to recollect anything of his life on the island. He had known many companions, but their names and faces had vanished beyond recall. Love, peace of mind, happiness–all were his for a brief moment of time. And yet he could remember no more than the last few moments of his life in paradise…
He had not been dreaming; he was sure of that. Rather, it was as if he had been living a second life and now he was returning to his old existence as might a man recovering from amnesia. Though he was still dazed, one clear conviction came into his mind. He must never again sleep in Comarre…Unsteadily he rose to his feet and made his way out of the room. Once again he found himself in the long corridor with its hundreds of identical doors. With new understanding he looked at the symbol carved upon them…

That symbol is the lotus flower…

The human mind was a delicate, sheltered thing, having no direct contact with the world and gathering all its knowledge and experience through the body’s senses. It was possible to record and store thoughts and emotions as earlier men had once recorded sound on miles of wire.
If those thoughts were projected into another mind, when the body was unconscious and all its senses numbed, that brain would think it was experiencing reality. There was no way in which it could detect the deception…
All this had been known for centuries, but the builders of Comarre had used the knowledge as no one in the world had ever done before. Somewhere in the city there must be machines that could analyse every thought and desire of those who entered. Elsewhere the city’s makers must have stored every sensation and experience a human mind could know. From this raw material all possible futures could be constructed.
Now at last Peyton understood the measure of the genius that had gone into the making of Comarre. The machines had analysed his deepest thoughts and built for him a world based on his subconscious desires. Then, when the chance had come, they had taken control of his mind and injected into it all he had experienced.
No wonder that everything he had ever longed for had been his in that already half-forgotten paradise…
A little later he discovered the thought monitor…After some experimenting he plugged in to one of the circuits and slowly increased the power…He still retained his own personality, but superimposed on his own thoughts were ideas and images that were utterly foreign to him…

Yes. The consciousness of another sleeper. Luckily, Peyton was a truly brilliant engineer, so the five hundred year old control interface posed few challenges for him…

One after another he checked the circuits on the board. The great majority were dead, but perhaps fifty were still operating. And each of them carried all the thoughts, desires, and emotions of the human mind…

Observing from a technicians monitoring board, Peyton is able to gain some insight into the tricks the hardware uses to work its illusions…

He could see the flaws in these synthetic worlds, could observe how all the critical faculties of the mind were numbed while an endless stream of simple but vivid emotions was poured into it.
Yes, it all seemed very simple now. But it did not alter the fact that this artificial world was utterly real to the beholder…
For nearly an hour, Peyton explored the worlds of fifty sleeping minds. It was a fascinating though repulsive quest. In that hour he learned more of the human brain and its hidden ways than he had ever dreamed existed. When he had finished he sat very still for a long time at the controls of the machine, analyzing his new-found knowledge. His wisdom had advanced by many years, and his youth seemed suddenly very far away.
For the first time he had direct knowledge of the fact that the perverse and evil desires that ruffled the surface of his own mind were shared by all human beings. The builders of Comarre had cared nothing for good or evil–and the machines had been their faithful servants…

I had initially planned to compare Comarre with “The Matrix”, but after thinking it over, I realized it’s much closer in concept to “The Menagerie”. Unlike Neo’s playground of the mind, Comarre is not a multi-user domain. Its builders were looking for an escape from reality analogous to narcotics. The real trick here is the creation of an utterly believable surrogate reality that gives you exactly what you really want. Hmm. Perhaps there’s a little bit of Forbidden Planet in there too.
Here’s some bonus futurity for extra credit. To reach Comarre, Peyton had to hike twenty miles through an African nature preserve. It’s amusing to see how he coped with the experience…

For almost the first time in his life Peyton was experiencing Nature as it had been in the days before man existed. Yet it was not the wildness of the scene that he found so strange. Peyton had never known silence. Always there had been the murmur of machines…Peyton found the silence unnerving and did what almost any man of his time would have done. He pressed the button of his personal radio that selected the background-music band.

Yes, any man of the thirty-first century would almost certainly turn to his pocket radio-phone for a soothing dose of elevator music.

So, mile after mile, Peyton walked steadily through the undulating country of the Great Reservation…He carried with him that mist of unobtrusive music that had been the background of men’s lives almost since the discovery of radio.
Although he had only to flick a dial to get in touch with anyone on the planet, he quite sincerely imagined himself to be alone in the heart of Nature…