Everything You Need To Know About Writing Robots and AI - A robot performs Hamlet's soliloquy.

Everything You Need To Know About Writing Robots and AI

We are entirely reader supported. This article may contain affiliate links and we may earn a small commission when you click on the links at no additional cost to you. As an Amazon Affiliate we earn from qualifying purchases.

In the Rick and Morty episode, ‘Something Ricked This Way Comes’, slovenly super genius Rick Sanchez casually builds a tiny robot at the breakfast table.

“What is my purpose?” the robot asks him, seconds after its creation.
“Pass the butter,” Rick replies.
The robot completes the task, then repeats, “What is my purpose?”
“You pass butter,” Rick clarifies.
The robot glances down at its tiny, butter-passing hands, grappling with the mundanity of its existence.
“Oh my god.”
“Yeah,” Rick says, unsympathetic. “Welcome to the club, pal.”

As well as crafting a hilarious, bleak moment, writer Dan Harmon manages to encapsulate a huge amount about how AI and robots are typically written.

From androids to super-computers, there are certainly a lot of forms and purposes an AI character can serve in your story, whether as main characters, secondary ones, or simply a periphery presence. Despite that, there are commonalities to writing AI that authors should be aware of, whether it’s to learn great lessons or stand out from the crowd. That’s why, in this article, I’m going to examine what AI is, how AI characters are typically used in fiction, and what you can do to make yours believable and memorable.

What is AI?

Artificial intelligence is intelligence exhibited by machines. In the computer science field that studies it, machines that are ‘intelligent’ are ‘intelligent agents’, capable of mimicking cognitive functions like learning and problem-solving that we associate with the human brain. They are aware of their environment and can work out what they need to do in order to have the best chance of achieving a goal.

As technology advances, certain abilities like ‘optical character recognition’ are now too normalized in machines to be considered ‘intelligent’ anymore. Currently, ‘intelligence’ in machines includes self-driving cars, interpreting complex data, ‘content delivery networks’, military simulations, and being able to compete against the best human players at strategic games like chess.

How is AI used in fiction?

In fiction, AI is a recurrent theme in science fiction and speculative fiction, and particularly in utopian and dystopian settings. Most of the time, authors present a binary ‘Human vs. Machine’ paradigm, ending in either coexistence or one attempting to dominate the other. These frictions tend to either have a political ‘Slave vs. Master’ underpinning, or theologically-bent, ‘Creation vs. Maker’ one, depending on the author’s own interpretation. Machine rebellions against their human ‘parents’ are largely rooted in them developing superiority complexes. Their organic creators are either seen as being too incompetent to be left unsupervised or too destructive to be left unchecked, leaving intelligent machines to develop into either benevolent or brutal dictators.

This thinking nearly always exposes the ‘flaw’ of most AI – lack of human empathy or an inability to make ethical decisions. Often – and ironically – this leads to philosophical discussion about the nature of what it is to be human, and whether or not humanity are the deserving inheritors of a world we inflict so much harm on. Onto our artificial children, we project the very best and very worst of our own characteristics, and – through blinking lights, chrome faces, or synthetic skin – they reflect them back at us.

AI theory

Obviously this subject is very dense and – for the non-computer science literate – very complicated. While no-one expects you to be an AI expert, it’s important to get a good handle on some of the defining theory.

An understanding of basic AI theory can take sci-fi authors to the next level.Click To Tweet

The singularity

If you’re worried this theory is as ominous as it sounds, then you shouldn’t be. You should be downright terrified. The ‘technological singularity’ is a hypothesis predicting that the creation of ‘artificial superintelligence’ (a machine capable of self-maintenance and self-improvement) will kick-start a sudden, exponential growth in technological intelligence that, in the process, will wipe out human civilization. (Think The Matrix.)

The idea is that a computer capable of making itself smarter is capable of enhancing that selfsame skill at an accelerating rate – if the original AI can make itself significantly smarter in ten minutes, then the improvements it makes to itself mean it can now make itself significantly smarter in five minutes. This goes on until the AI is getting smarter by the second, dwarfing its makers.

Write better AI by understanding the Turing Test, the singularity, and the Three Laws.Click To Tweet

Because of this, the theorized singularity represents a moment where an AI becomes not just smarter than we can cope with, but unfathomably intelligent and capable. That might mean it goes from existing on one computer to existing on every computer, or that it figures out in a few minutes how to build a working body that would have taken mankind decades to invent. The singularity is a popular theory, and one that prominent voices such as Stephen Hawking, Elon Musk, and Bill Gates have warned should be taken seriously.

The Turing Test

Devised by Alan Turing in the 1950s, this is a test of a machine’s intelligence acording to its ability to mimic human behavior. Any machine that passes the test can theoretically make itself indistinguishable from a human (provided its either hidden or in some kind of human-like disguise, like (spoiler) David, the humanoid android in Ridley Scott’s Prometheus). Turing referred to this as ‘the imitation game’. He also proposed the less easily answerable, ‘Can machines think?’ This question has become fundamental to the philosophy of AI.

Only a few years ago, in 2014, an AI became the first to pass the Turing test. The extent of its success is open to debate, but the program, which simulates a 13-year-old Ukrainian boy named Eugene Goostman, passed under conditions suggested by Turing himself. Not only was this a shocking moment for science, but it shows the incredible influence of speculative fiction within the field of AI research.

The Three Laws

The Three Laws of Robotics are the invention of pioneering science fiction author, Isaac Asimov. He first introduced them in the short story, ‘Runaround’ (1942) though had eluded to the idea in previous works.

The laws are, as they appear in Handbook of Robotics, 56th Edition, 2058 A.D:

  1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.
  2. A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
  3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.

This precautionary feature came to underpin the majority of Asimov’s AI-based stories, drilled into his robot character’s core processing by way of a ‘positronic brain’. As such, it’s impossible for a robot to defy them, but this strict adherence can lead to big problems, as I’ll discuss later.

Asimov’s laws are a work of fiction, but come from a place of such expertise and influence that they’re generally embraced as the foundation of any believable fictional AI. They’ve even come to influence real-life AI research and development, so it’s worth considering incorporating them into your own work.

“What is my purpose?” Three ways to write AI characters

This isn’t to say there are only three ways to write AI characters, just that you can largely split AI fiction into three distinct categories. Choose one to decide the path your AI character will take, or try to take ideas from all three to create something more unique.

“Kill all humans!” – Robot overlords

We tend to be pretty cynical as a species, so maybe that’s why the theme of ‘AI going wrong/bad’ seems to be more prevailing in fiction that the one in which they’re happy to remain in our servitude while we’re free to blast off into space or just sip cocktails on a beach. Not that beaches will still exist by the time any of this is possible.

In Harlan Ellison’s nightmarish short story, I Have No Mouth and I Must Scream, AM, one of three super-computers built during WWII, becomes sentient. Realizing – as the title graphically implies – that all its supreme intelligence is redundant when trapped in the body of a stationary machine, AM decides to do the only thing it can – kill humans. All of them. But, to stave off boredom, it spares five people and grants them immortality. This is a curse rather than a gift, as the last surviving humans are destined to become the undying subjects of horrific psychological experimentation by AM.

These kinds of oppressively bleak tales are – for obvious reasons – not hugely popular unless they end in humanity triumphing over their artificial dominators. AIs serve as contrasts or challenges to the resolve of the human spirit rather than us learning much about AI itself, hence their mustache-twirling, two-dimensional villainy. The moral of these stories is that we shouldn’t ‘play God’, stemming from the very first science fiction novel, Mary Shelley’s Frankenstein, in which bypassing the ‘natural’ birth of new life is punished by way of that life being inherently monstrous.

If you want to write a robot overlord, there’s a lot of scope to flesh them out (pardon the pun) as much as your human characters. Give them solid reasons to turn on us other than it just being ‘inevitable’. In cyberpunk pioneer William Gibson’s trilogy of books (known as the The Sprawl Trilogy) the fear of AI turning on humanity becomes so pronounced that a global organization called ‘Turing Police’ exist solely to keep artificial intelligence from getting any funny ideas about dominance. This kind of set up makes AI characters seem automatically like underdogs, so when they do start acting out of line, we can’t help but empathize with them.

How smart’s an AI, Case?  Depends. Some aren’t much smarter than dogs. Pets. Cost a fortune anyway. The real smart ones are as smart as the Turing heat is willing to let ’em get.

Neuromancer, William Gibson

“Are you satisfied with your care?” – Robot companions

The 2004 movie, I, Robot, set in 2035, imagined a world in which intelligent robots fulfilled public and domestic service positions. But, when Detective Del Spooner starts investigating a suicide case, he uncovers a sinister plot to enslave humanity, orchestrated by (spoiler) the AI created to protect it. The film used Asimov’s Three Laws of Robotics and took its name from the cover of one of his short story collections, but, if he’d still been around to see the film, he probably wouldn’t have been a fan of the twist ending.

Are your robots servants, masters, or people?Click To Tweet

Asimov detested the idea of robot overlords, preferring to believe that robots were destined to be perfect tools – provided safety measures like his Three Laws were in place. Through stories like Runaround, Little Lost Robot and Liar!, Asimov explored how misinterpretation or conflicting instructions given by humans could cause robots to act strangely or even violently – but never dictatorially. Fictional AI are still essentially servants, but are either unaware of their sub-status, or okay with it. They can be helpers like Big Hero 6’s Baymax, or even saviors, like Marvel’s The Vision or the Ghost In The Shell manga’s Tachikoma. And, as these examples prove, this more positive use of AI characters seems to play better with a younger audience. To create a friendly robot companion, make them actually like humans (flaws and all) and visually appealing to us (Baymax is cuddly and the Tachikoma are small and scuttling) but not off-puttingly close to being human (The Vision is humanoid but is colored bright red; Star Trek’s Data has the skin tone of Nosferatu).

“Do androids dream of electric sheep?” – Robots with souls

Not all AIs in fiction have to be inherently good, bad, or have grand intentions. Some, like humans, just exist. Some of the most believable and lovable AI characters are ones which neither detest nor embrace humanity, but simply act like machines with distinct personalities who have become part of our world. The ‘robot-ness’ of robots in opposition to human behavior can be really endearing. In the Star Wars series, droids C-3PO and K-S20 are used as sources of comic relief, their probability calculations continually rejected by their exasperated human owners, and in turn, they wearily muse on their own failure to understand why humans do the silly and pointless things that they do. They play integral roles within the main group, but their non-organic status is incidental. They’re part of the story without being the story.

You can include AI and robots in your stories without making them the focus.Click To Tweet

Of course, it’s impossible to talk about robots with distinct characters without mentioning Marvin the Paranoid Android from Douglas Adams’ The Hitchhiker’s Guide to the Galaxy. Like Ellison’s murderous AM, Marvin is afflicted with magnificent intellect (a “brain the size of a planet”) which he hardly ever gets to fully use. But rather than send him on a human-killing rampage, it just makes Marvin a perpetual downer. According to him, the best conversation he had was over 40 million years ago with a coffee machine. The fact that Marvin has a personality is good, but the nature of that personality makes it great. It’s one that could belong to a human character, but is colored by his experience as a robot, making it unique to him and turning him into one of the most believable AI characters in fiction.

Writing great AI

AI characters can be used as villains, companions, pets, or servants, they can be allegories for the human experience or the proofing ground for human characters, but they can also just be part of the fabric of your world. A story can have AI present without AI being the story. Just how computers have become ubiquitous helpers in our day-to-day lives. Whatever their status and role, the key to writing believable AI characters is a combination of adhering to the theory behind them, understanding the genre expectations of them, and making them distinctive – either through enhancing their humanity or their ‘robotness’.

For more on writing unusual viewpoints, check out Are You Writing Believable Non-Human Characters? Or, to see a less-than-brilliant AI character in action, try The Best Ways To Root Out A Cheesy Villain. Know a fictional AI that could inform great writing? Let me know in the comments.

295 Shares

Leave a Comment

Your email address will not be published.