This is a standard trope in science fiction, although more common is the idea of transferring minds from real people into a virtual environment.
Right now, such an idea is still firmly in science fiction. We don't know a few things:
What consciousness is in detail. There are various educated guesses and philosophical stances, but none have been seriously verified.
What the minimal environment is that can support consciousness. This is important because simulating more complex environments is more computationally expensive. There is a huge gulf between capabilities of current computers and something that could simulate reality to the level of granularity that we can experience and manipulate it (let alone to the depth that we can scientifically investigate).
Will this consider them to be an AI?
Assuming you can solve the caveats above, then yes, perhaps even a "Strong AI" in the domain of the game, but not a human-equivalent AGI (depending on the complexity of the environment).
If you mixed a current RPG game with some agents driven by our current best game-playing bots, and improved them so that they are able to solve problems within the game - e.g. in World of Warcraft, or perhaps in Minecraft - then you would have something as advanced or better than any current "narrow AI" that solves points scoring or adversarial games. You would be justified in calling it "AI", if OpenAI and Deep Mind can call their achievements "AI". However, it seems unlikely such agents would be much like your imagined simulated people - having consciousness etc.
Would this be real in the future?
Depends on the constraints faced by researchers. To get to an imagined point where this is possible, we have to extrapolate current trends on computing power and advances in understanding goal-driven AI and self-awareness. There is a range of opinions on how likely this is, how much power is required etc.
It is a compelling idea, and unlike say faster-than-light travel, there are no widely-accepted theoretical limits that prevent it.