WARNING: The following contains spoilers for Maze Theory's Doctor Who: The Edge of Reality, available now.

In Maze Theory's Doctor Who: The Edge of Reality video game, users play as the Doctor's newest ally and companion. As the game begins, Jodie Whittaker's Thirteenth Doctor sends the players a message, asking for their help in retrieving three Time Crystals scattered across space and time that, when collected, will free her from the distant location she is currently trapped in. Only then will she able to stop the threat of the Reality Virus. This places the game in the current continuity of the Doctor Who franchise, but The Edge of Reality was also billed as a game that would feature the return of David Tennant's fan-favorite Tenth Doctor.

As promised, the game indeed brings the Tenth Doctor back, as he joins in the race to stop the Reality Virus from destroying all of creation. But what comes as perhaps a big surprise is that The Edge of Reality reveals a surprising connection to an old Doctor Who episode: Season 2's "The Girl in the Fireplace," which is now a crucial prequel to the video game.

RELATED: Doctor Who: Edge of Reality Debuts the Franchise's Most Frightening Cyberman

Doctor Who The Girl In The Fireplace

"The Girl in the Fireplace" was the fourth episode of the second season of Doctor Who's modern era. Written by Steven Moffat and starring David Tennant as the Doctor, the episode saw the immortal Time Lord develop a romance with historical figure, Madame de Pompadour. In the distant future, the Doctor found a spaceship which held a fireplace that was actually a window through space and time that lead to Madame de Pompadour's time.

Throughout the episode, he traveled through the window, appearing sporadically at various moments through the Marquise's life, growing ever close to her. The two eventually fell in love, but their story reached a tragic ending when the Doctor prepared to take her away. When he last returned through the window, Madam de Pompadour had passed away, and he was left to mourn her loss.

The Season 2 episode ranks as one of the all-time best episodes of the sci-fi series and it has made its mark in Doctor Who history. But while the episode has never been revisited on television, it has become a crucial prequel to Maze Theory's The Edge of Reality.

RELATED: Doctor Who: Russell T Davies Already Proved Why He Won't Retcon the Timeless Child

In the game's final level, the Thirteenth Doctor faces the CyberReaper, a frightening Cyberman who aims to upgrade itself with the Doctor's body. The villainous robot gets under the Doctor's skin by describing her as the ultimate warrior, and it tests her by saying that she can't be both this warrior and the humane hero she claims to be. To hammer home that point, the CyberReaper reveals an alternate reality where "The Girl in the Fireplace" ended very differently. In this universe, the Tenth Doctor stopped being the Doctor and had a life with Madame de Pompadour. The two lived happily ever after together and had children together.

It's a poignant revelation, especially as we hear the details of this life, told as a story by David Tennant's Tenth Doctor to his child. After glimpsing this reality, the CyberReaper insists that, if the Doctor stops the villain and fixes the damage caused by the Reality Virus, this universe will cease to exist, and the life created there by this alternate version of the Tenth Doctor will be completely erased. Given the importance of the events of "The Girl in the Fireplace" and the love the Doctor had for Madame de Pompadour, the Thirteenth Doctor simply can't make that choice.

Thankfully, she tasks the players with making the choice for her. With the fate of the universe in the users' hands, the choice is made, and the Reality Virus is stopped. The alternate reality is erased, and all of creation is safe. After that, both the Tenth and Thirteenth Doctors applaud the players for the choice they made, the former showing signs that he knew exactly what was at stake. Still, he insists that the right choice was made. It's a bittersweet moment for the character and a touching scene for the game -- and the wider Doctor Who franchise.

Doctor Who: The Edge of Reality is available now on PlayStation 4, PlayStation 5, Xbox One, Xbox Series X|S and Steam and coming to Nintendo Switch Oct. 21.

KEEP READING: Which Doctor Who Companion Suffered the Worst Fate?