It is hard, if not impossible to determine how deep the roots of belief in the tree of virtuality reach back in the history of the human race. Certainly we did not need our Oculus Rift VR headset to come up with this idea. When did man first started to doubt the reality of the solid world around him? When did we first start to think we might be living in an illusion?
The first written tradition is perhaps the allegory of the cave by Plato  in his treaty "The Republic" written around 380 B.C.
In this allegory prisoners are chained in a cave in such a way that they can only look at a wall in front of them. Behind them is a fire burning and between the fire and the prisoners is a low wall, behind which other people walk carrying objects or puppets "of men and other living things". These objects cast shadows on the wall in front of the prisoners. The sounds made by the walking people also echo from this wall, so that it seems that the shadows are making these noises. For the prisoners, who never experienced anything else these shadows are the only reality there is. In the story one man escapes. At first according to Plato he would not understand that what the prisoners see and hear are mere shadows and echoes. Only once the escaped prisoner would find out about sunlight outside the cave and get accustomed to it, he'd be able to learn about shadows. Thus he'd start to understand the real source of the images and sounds. Thereafter he'd consider this new reality superior and "he would bless himself for the change, and pity [the other prisoners]" and would want to bring his fellow cave dwellers out of the cave and into the sunlight". Unfortunately back in the cave his eyes would need to get accustomed to the dark again. His fellow prisoners would think he'd gone blind and conclude it's dangerous outside of the cave. They would not be willing to leave.
As the freed prisoner in this allegory represents the person who sees the world for the illusion it is, this is one of the first written proofs that humans were conscious of the possibility that our reality might not be the ultimate reality.
The Greek sophist, Gorgias (c. 483–375 BC)  is reputed as the father of Solipsism, the notion that we can only be sure of our mind to exist. Moreover he's quoted to have stated:
1. Nothing exists.
2. Even if something exists, nothing can be known about it.
3. Even if something could be known about it, knowledge about it can't be communicated to others.
With this reasoning the Sophists tried to show that "objective" knowledge was a literal impossibility. An extreme interpretation of Solipsism is to assume that only I exist and that everything else is a concoction of my mind. Or a simulation if you wish.
Another early text on this topic is from the Zhuangzi  by the eponymous author who lived between 369 and 286 B.C:
"Once upon a time, I, Chuang Chou, dreamt I was a butterfly, fluttering hither and thither, to all intents and purposes a butterfly. I was conscious only of my happiness as a butterfly, unaware that I was Chou. Soon I awaked, and there I was, veritably myself again. Now I do not know whether I was then a man dreaming I was a butterfly, or whether I am now a butterfly, dreaming I am a man. Between a man and a butterfly there is necessarily a distinction. The transition is called the transformation of material things."
Dreaming in fact is our most direct springboard to question whether our reality is an illusion.
Both Vedic and Buddhist traditions have spoken of the world as Maya, a magic or illusory veil. Maya has been said to be the reflection of something very real in a spiritual world. The powerful and colorful paintings the Tantric and Tibetan Buddhists have used were intended to help them visualise alternate realities. The so-called Avatamsaka Sutra from about 100 B.C. speaks of "infinite realities". In images we find an enlightened deity sitting calmly on a lotus flower often in the middle of raging fires. Worlds within creatures and worlds within circles representing the karmic cycle show how we are caught in the web of dependent arising. Fortunately, there seems to be a way out of this Maya. A little rainbow colored path leads the enlightened ones to the realms of the deities.
Even today certain schools of thought in Buddhism teach perceived reality literally as unreal. Chögyal Namkai Norbu considers all our sensory perceptions as a big dream.
From a neuroscience perspective he is actually right in a certain way: When you think you see the outside world, actually what you are experiencing is an image concocted by your brain. We constantly internally hallucinate a "supposed world out there". We strongly filter the overflow of data entering our senses and create a coherent picture therefrom, which may or may not have a certain degree of isomorphism to the ontic reality. This is especially evident when we are asked to focus on a particular activity. If you are asked to count the number of times on people throw a ball to each other, like most people you will totally miss the man in a Gorilla suit walking among the players, because this irrelevant information is filtered out by your brain. In other words, from the sensory data we receive our brains concoct a simulation which is as meaningful as possible under the given circumstances. In that sense our epistemic reality is almost certainly a simulation.
Similarly in Hinduism we find the notion that Vishnu, the all-pervading one, lies in a dream state on the serpent Adisehsa Ananta. Ananta is time and floats for eternity on the ocean of Cosmic Consciousness. Brahma is born out of the navel of Vishnu and begins the process of creation. Vishnu expands into everything thereby becoming everything. By the act of watching his dream, including the creation of the universe by Brahma, Vishnu sustains the Universe. Only when Vishnu wakes from his dream, the cycle of creation ends.
In the Hellenic world we find the notion of Hermes Trismegistos, the thrice great one. This Godhead seems to be a merger of the Greek God Hermes and the Egyptian God Thoth. The earliest texts mentioning this God go back as far as 172 B.C. Hermes Trismegistos is reputed to have written the so-called Tabula Smaragdina (which may have an origin much later. It's earliest written version is an 8th century Arabic text). This Tabula Smaragdina mentions the concept "As above, so below", which seems to be considered as an absolute truth among esoterically oriented people today.
"That which is Below corresponds to that which is Above, and that which is Above corresponds to that which is Below, to accomplish the miracle of the One Thing."
The concept "As above, So below" implies that our physical world is a reflection of a spiritual world. That the microcosm (oneself) is similar in structure to the macrocosm (the universe).
Interested in reading more of this subject? It will be published in my upcoming anthology on the question whether reality is a simulation. I will announce this on Steemit, once the book is published.
By Antonin Tuynman, author of the books "Is Intelligence an Algorithm?", "Transcendental Metaphysics" and "Technovedanta".
 Plato, The Republic, Penguin Classics, 2007.
 Bruce McComiskey, Gorgias on Non-Existence, Philosophy and Rhetoric, Vol.30. No.1, pp. 45-49, 1997.
 Watson, B. The Complete Works of Zhuangzi, Columbia University Press, 2013.