Pre-production
In June 2014, Derrickson was chosen to direct the film. He had written a 12-page scene for the film featuring Strange and an assailant fighting in the astral plane while a doctor attempts to save Strange's physical body in a hospital, based on a sequence from the comic Doctor Strange: The Oath. Derrickson illustrated the sequence with his own concept art, alongside storyboards from professional artists and an animatic, which he presented in a 90-minute pitch to the studio. This cost Derrickson an "obnoxious amount" of his own money, but he felt it necessary to prove "that I wanted [the job] more than anyone", especially after Marvel told him that more people had lobbied to direct Doctor Strange than any of their other films. Derrickson ultimately had eight meetings with Marvel for the film. After he was hired, Marvel bought the 12-page scene from Derrickson, and it became one of the film's main set pieces.
On transitioning from horror films to a superhero film, Derrickson said, "It was nice to work on something more positive. And not have my headspace in something so dark for so long. But it was also weirdly similar because of the fantastical nature of the movie". In his horror films, Derrickson tried to use "real characters and real character drama played by good actors ... [to] encounter the fantastical", and so he wanted actors of the same high caliber for Doctor Strange through which he could introduce the more fantastical elements to the MCU.
Derrickson and Marvel had originally discussed him writing the film alongside his Sinister co-writer C. Robert Cargill, with Derrickson also directing, but Marvel felt that they would not be able to reach their intended release date of July 2016 if Derrickson filled both roles. When Derrickson was chosen as director, Marvel passed on Cargill as an individual writer, with Jon Spaihts hired to rewrite the script instead. Spaihts, a big fan of Doctor Strange as a child, had started "pestering" Marvel as soon as he read reports of the company searching for a director for the film. This eventually led to him meeting with the studio, before they actually began looking for writers for the film. Spaihts said that they talked "all afternoon, and the fit was right", but he received a call from Marvel several days later saying that they were not completely sure they wanted to take the film in the same direction as Spaihts, and were going to look at other writers. Spaihts told his agent to not "take that answer. Call them back, tell them there's a lot of right answers, and get me back in the room", and after talking with Marvel for "another three or four hours" he was given the job. Marvel never seriously looked at any other writer for the film.
Derrickson was already hired when Spaihts joined, and the pair spent several months working on the film's story with Feige and executive producer Stephen Broussard. They started writing the film from the beginning, and initially were unsure whether it would be an origin story, or if it would begin with Strange already as a "fully-formed" sorcerer. Spaihts ultimately felt that "the origin story of this character, as depicted in the comics, is so operatic and beautiful, and so tragic and epic in its sweep, that it was unavoidable. We had to tell that story, and tell our best version of it." Elements from Spaihts' early drafts that he later stated were still in the final film include many of the film's set pieces, such as the climactic battle, which came straight from Derrickson, as well as "little things" from Spaihts, "like a bandaged hand running down a row of prayer bells in a Nepalese temple." Derrickson wanted Nightmare to be the film's antagonist, along with the concept of "nightmares themselves as being a dimension", but Feige felt "getting across the idea of the Dream Dimension as another dimension" would have been challenging alongside everything else that the film introduces. Dormammu, "the most present villain in the comics", became the film's main villain.
During the early development process, Marvel, Derrickson, and Spaihts all envisioned Benedict Cumberbatch playing the title role. By the end of June, Marvel had reportedly been looking at Tom Hardy and Jared Leto for the film's lead as well, while Édgar Ramírez, who worked with Derrickson on 2014's Deliver Us from Evil, had discussed a possible role with the director. In July, after fans and the media had also championed Cumberbatch for the role of Doctor Strange, the actor explained at the 2014 San Diego Comic-Con that he would be unable to accept the role due to commitments to other projects. Feige stated that a lead actor would be announced "relatively quickly", and by the end of that month Joaquin Phoenix entered talks to play the character.
Marvel Studios was in negotiations by September 2014 to shoot Doctor Strange at Pinewood-Shepperton in England, with crews being assembled for a move into Shepperton Studios in late 2014/early 2015, for filming in May 2015. Negotiations with Phoenix ended in October 2014, as the actor felt that blockbuster films would never be "fulfilling", with "too many requirements that went against [his] instincts for character." Marvel then placed Leto, Ethan Hawke, Oscar Isaac, Ewan McGregor, Matthew McConaughey, Jake Gyllenhaal, Colin Farrell, and Keanu Reeves on their shortlist for the character. Ryan Gosling also had discussions to play the character, while Reeves was not approached about the role, and Cumberbatch was still considered to be in contention. In October, Cumberbatch entered negotiations to play the character, and was officially cast in December. Feige explained that Marvel had kept returning to him for the role while considering other actors, with Derrickson noting that even during discussions with Phoenix, he and Marvel still wanted to cast Cumberbatch in the role. The company eventually decided to change the film's production schedule to fit around Cumberbatch's commitments, allowing him to join the project.
With the film's new production schedule, its intended release date was pushed back to November 2016, and Derrickson was able to do some work on the script himself. He brought Cargill in to work with him on this as was originally planned. Describing the film, Cargill called it both a superhero film and a fantasy film, saying "it's a very magical fantasy universe, but at the same time it plays by some of the superhero tropes that people enjoy." Spaihts returned later in the process to "do some more writing and help bring the movie home", and said he was "delighted" by the work that Derrickson and Cargill had done in the interim. Feige and Derrickson have noted that, in addition to The Oath and Steve Ditko's original work on Doctor Strange, an influence on all the film's writers was the Doctor Strange comic book Into Shamballa.
In January 2015, Chiwetel Ejiofor entered preliminary talks with Marvel for a role in the film, later revealed to be Karl Mordo. Ejiofor's role was confirmed during the 2015 D23 Expo. In April, Derrickson and members of the production team visited New York City to scout potential filming locations, while Feige revealed that filming would begin that November. A month later, Tilda Swinton was in talks to play the Ancient One. In June 2015, Derrickson announced that he was going to London to begin work on the film, and Feige confirmed that Strange's Sanctum Sanctorum would appear, located on Bleecker Street in New York City's Greenwich Village, as in the comics. Swinton confirmed her role in the film in July, when Rachel McAdams was being considered for the female lead. McAdams cautioned that "it's still super-early, and I don't know where that's gonna go, if it's gonna go anywhere at all", but she ultimately confirmed her role during the 2015 Toronto International Film Festival. Jessica Chastain had been approached for the role before McAdams, but turned down the opportunity because she felt she was "only going to get one shot at being in a Marvel film" and wanted to be a lead character. Mads Mikkelsen entered into early negotiations to play a villain in August, "one of a number of actors being considered for the unspecified villainous role."
In September 2015, Guardians of the Galaxy director James Gunn stated that many of the crew that worked on that film were unable to return for its sequel, because they had committed to Doctor Strange. Derrickson also revealed that Gunn had provided notes on the script, beyond the general conversing the MCU directors have between themselves for their films. At the end of the month, Feige stated that additional casting announcements would be made "before the end of the year", and by early November, Michael Stuhlbarg entered negotiations to appear in the film as Nicodemus West, a rival of Strange. Derrickson had offered the role to Stuhlbarg because he was interested in working with the actor, and he agreed to join the cast after reading some Doctor Strange comics and being drawn to the character's "guilt-ridden arc" where West "blames himself for ruining the surgery on Strange's hands and robbing him of his ability to operate".
Feige felt that the visuals of the film needed "to be a Ditko/Kubrick/Miyazaki/The Matrix mind-trip", and said that "You don't get into it in Harry Potter, but if a scientist went to Hogwarts he'd find out how some of that stuff is happening! We're not going to spend a lot of time on that, but there will be some of that. And particularly for a character like Strange, who goes from a man of science to a man of faith and who traverses both worlds." In developing the film's magic, Derrickson felt a responsibility to not repeat the representation of magic from previous films, like Fantasia and Harry Potter, wanting "to find a new way to make it feel more tactical and real and surreal. And to root it in gestures as opposed to spoken incantations and things like that." Feige called Doctor Strange the "doorway" into the supernatural side of the MCU, a role that Derrickson noted was also served by the character in the early comics, when the Doctor Strange comics "broke open the Marvel comic book universe into the Marvel multiverse". Discussing the portrayal of other dimensions in the film, Feige stated that it would not explore parallel realities like the comics' "Earth-616 and Earth-617", but would instead feature "dimensions that are so mind-bending that you can barely perceive them", like the Astral plane, Dark Dimension, and Mirror Dimension.
Astrophysicist Adam Frank served as a scientific consultant on the film, having already known Derrickson and been a Marvel fan since childhood. Frank advised on "the human experience of space and time", helping Marvel conceive ideas for their cinematic multiverse, and suggesting dialogue for characters based on their beliefs, whether they were materialist, rationalist, reductionist, or "had this enlarged perspective." He noted that modern movie goers may not necessarily understand these complex scientific ideas, but do appear to appreciate that "amazing things happen from science. So by grounding your stories enough in science to not so much make them plausible, but to allow that science to open up new possibilities—people are used to that in their lives. So I think it makes sense to them, and it's exciting to them". This was an aspect of previous MCU films that Frank called a "great thing ... speaking as a scientist", saying that "they build a coherent and consistent universe that respects the scientific process and that uses enough of real science to make things plausible or build off them."