At the beginning of the film “The Martian,” astronaut Mark Watney (Matt Damon) is injured. His crewmates believe him to be dead and depart Mars, leaving Mark stranded 150 million miles from home.

The circumstances would daunt just about anyone. But early in his predicament, Mark promises himself, “I’m not going to die here.” His wisecracking positive attitude, despite occasional moments of despair, is shared by many other recent science fiction characters at the multiplex.

In “Martian,” some characters reveal selfish or nationalistic motives at odds with Mark's survival, such as when NASA director Teddy Sanders (Jeff Daniels) thinks of NASA’s public image almost as soon as he hears that Mark is still alive, or when members of the China National Space Administration debate whether or not to help America in their rescue efforts.

But overall, “Martian” is a positive tale of human grit and people helping one another. Mark’s crewmates decide to turn around, adding more time to their mission and countless risks, in order to help bring him home. Members of NASA work tirelessly to get aid to him. Mark himself works through crushing setbacks to figure out how to survive until help can reach him.

The hopeful tone of the film echoes that of other recent science fiction successes at the box office. The 2014 hit movie “Interstellar,” directed by Christopher Nolan of “The Dark Knight Rises,” takes place in a world where struggles in growing food have endangered life on Earth. Protagonist Cooper (Matthew McConaughey) decides to sacrifice time with his family and possibly his life to explore other planets that are possibly habitable. “Interstellar” also ends on a positive note: With the help of her father, Cooper’s daughter Murph (Jessica Chastain as an adult) has a scientific breakthrough that allows people to settle on other planets, ensuring humanity’s survival.

The power of the human spirit was also a theme in the 2013 hit “Gravity,” which was a box office success and viewed as a frontrunner for Best Picture. In the film, engineer Ryan Stone (Sandra Bullock) becomes stranded in space and, despondent over the recent death of her daughter, considers giving up. An imagined message of encouragement from her colleague Matt Kowalski (George Clooney) gives her the strength to continue, and Ryan ends up making it back to Earth safely.

Any science fiction fan knows the genre can get fairly dark. The protagonists of these newer movies do have moments of depression or doubt, but all the films have overall positive messages and an ending that's hopeful about the future.

“They give us realistic settings for great moments of heroism,” says Despina Kakoudaki, director of American University’s humanities lab.

Ms. Kakoudaki also notes the presence of “these very positive images of collaboration” in these films, both on a smaller scale – astronauts working together – and on an international one, as in “Martian” when China decides to help the US bring their astronaut home.

Moments in these films center on “ethics and what we owe each other” as human beings, says Kakoudaki.