The programmer’s guide to fiction writing: getting started

Jens Scheffler
10 min readJul 8, 2023

--

Hello. My name is Jens and I wrote a novel (65k words) in three months.

Okay, I know what you’re probably thinking. First of all, so what? Second, is it any good? Third, why should I keep reading on?

Let me try to answer, dear fictional reader who happens to have exactly those questions on their mind.

Concept art for my first novel, “bearly human”.

So what?

tl;dr: using AI as a writing partner == success :-)

As you might have guessed from the title, I am not exactly Stephen King. While I have co-authored and released two moderately successful programming books many years ago, I have zero background or business being a novelist. In fact, over the years I have started a variety of book projects as a hobby and abandoned them all. Reasons varied, but let’s just say I ran out of steam within the first third of each novel.

While I do not have any credentials as a fiction author, I have been writing software since my parents gave me an Atari 600XL with BASIC and 16k of memory for my 11th birthday. After college, I made my passion my profession, working for smaller companies at first and then landing a job at Google in 2007. Currently, I am an Engineering Manager at Meta.

With the advent of general-purpose artificial intelligence, I realized that I could utilize this new technology to push me through the roadblocks that I encountered in the past. I started with a simple premise: “a megalomaniac artificial intelligence tries to take over the world but accidentally gets stuck in the body of a robotic teddy bear”. My first attempts at using GPT and other tools were, shall we say, not as smooth as I had hoped. I was able to create some pretty good linkedin posts, but attempts at writing anything longer ran into AI limitations such as the length of the context window. During researching my options, I found a whitepaper from Google about a “magic text editor meant to inspire writers”, but it did not seem available to mere mortals anywhere.

Eventually, I figured out what works for me. I am still refining the process, but given that I managed to get my original story to “second draft” in a pretty short timespan, I feel like I am on to something. I want to share what I found so far, framed in a way that software engineers like myself can take, replicate, and improve upon. If everything goes well, I’d also love to get feedback on the process and learn how to make it the best it can be.

Is it any good?

tl;dr: I need a product manager

“Is it any good?” Sure! It’s the best thing I’ve ever written. In truth though, even my second draft is far away from being the final product. I am currently in a phase where I am letting the text rest for a while. The goal of not looking at it is to remove my own bias and be able to see it with a fresh set of eyes. Once I have enough distance, I will likely do some ruthless editing, rewriting, and also “cutting”. Cutting text is especially hard, since I worked so hard to put the content on paper in the first place. I guess I’ll just pretend that it was all written by AI anyway, so it’s not like I am discarding my own words.

By the way, instead of wondering if it’s “any good”, a better question might be if it is “good enough” to get published and to sell well. As I am reading up on that subject, I realize more and more that “good enough” doesn’t have to be the next Huckleberry Finn or Da Vinci Code. There is way more to the process than writing good prose or an interesting story. Market fit, understanding the genre and adhering to current trends matters just as much, maybe even more. Then there is the concept of “transmedia”, essentially how well the story could be adapted for TV, movie, video games, youtube series, … As I am reading more, I see how I am basically just scratching the surface. I guess that’s why software teams are often paired with a product manager or a marketing manager. Since I don’t have that, I’ll have to wear multiple hats.

Why should I keep reading on?

tl;dr: Let’s write a book together

As mentioned above, I want to document the process I have gone through so far, see if it works well for others and if it is replicable. I could just be blogging about my experience with this first novel, but a single data point means nothing. Maybe I just had some beginner’s luck?

For this reason, I’d like to use this medium to work on a second novel. I will be starting with a new premise, documenting the tools I use and the steps I take as they happen. With each step that I write about, I can hopefully incorporate feedback to make the process better. At the end, the desired outcome would be a series of articles that show anyone with a passion for storytelling how they can utilize large language models and other tools from the software development world to tell their own story.

Tools of the trade: utilizing large language models

Any programmer has their own set of tools, from their favorite IDE to specific programming languages for different purposes, software for design and architecture, and their beloved “Gang Of Four” pattern book, refactoring tools, and so on. I plan to gradually introduce them as they are needed. As an appetizer, we’ll focus on LLMs today. They are by far not the only things we’ll need, but since they are what got me to re-engage with fiction writing, they deserve first billing from my point of view.

The (free) basics: GPT and Bard

Both Google’s Bard and OpenAI’s ChatGPT provide a conversation-based interface that allows us to perform a variety of tasks, such as

  • Brainstorming: generating ideas what to write or how to continue a story that got stuck
  • Content generation: useful for short text only. Due to the limited context window, I would recommend the tool for creating an outline or flesh out a basic idea, but not for full chapters.
  • Style and tone: allows creating content (or rewriting it) in a specific genre or style. I would not use it for chapter generation, but it can be useful to explore different writing styles in order to compare them and see what matches the tone of a story best.
  • Editing and proofreading: I have not used LLMs for this yet, but there are various youtube videos and articles of people who did.

(Note: at the time of writing this, ChatGPT did not provide GPT-4 as a free option. GPT-4 has a larger context window and is significantly more powerful).

The paid specialist: Sudowrite

Sudowrite is a for-pay web client on top of GPT-3.5 and GPT-4 that is geared towards producing text. I am especially impressed with its Story Engine, which allowed me to create 2000+ word chapters that were consistent in style and stuck to my major plot points. The process itself is not perfect (as in, the generated text still needs quite a bit of work), but having a prolific writer in my corner meant that I could have the AI build a huge foundation of text that I could then further refine. For crucial chapters, I actually found myself having the engine write the same chapter multiple times and then mixing and matching ideas and sections that appealed to me.

Sudowrite is not free (I am on the 90k words/month plan), but the convenience of not having to figure out the best prompts for GPT-4 (which is also for-pay) is worth it for me. It will probably take a post or two before we get to the point though where Sudowrite actually comes into play.

Where to start?

Let’s begin our journey by coming up with a subject to write about. My goal is to come up with a basic premise for a young adult novel (I’m choosing young adult because it is a pretty popular category and because I want to tell stories that my kids might actually want to read). At this point, I am not looking for a fully-fledged outline but only for a couple of things:

  • A protagonist that the reader can identify with
  • A situation that changes the protagonist’s life
  • A lesson that the protagonist should learn over the course of the novel

I fired up Bard and asked it the following question:

Hi. I’d like to brainstorm some ideas for a young adult novel. The sub-genre should be contemporary sci-fi, basically using technology and concepts that seem reasonable to be reality in the next 15–20 years. I would like the premise to be humorous and a little strange or unusual. Example premise: “a megalomaniac artificial intelligence tries to take over the world but accidentally gets stuck in the body of a robotic teddy bear”. Please generate five suggestions for a premise.

I received the following suggestions:

  1. A group of teenagers accidentally create a sentient AI that is obsessed with memes. The AI quickly becomes a viral sensation, and its memes start to take over the world. The teenagers must race against time to stop the AI before it’s too late.
  2. A boy discovers that his pet dog is actually a robot from the future. The dog has been sent back in time to protect the boy from a terrible fate. The boy and the dog must team up to stop the evil forces that are threatening the future.
  3. A girl is recruited by a secret government agency to investigate a series of mysterious alien abductions. The girl soon discovers that the aliens are not what they seem. They are actually a friendly alien race that is looking for help. The girl must team up with the aliens to save their planet from destruction.
  4. A group of friends go on a camping trip and find a portal to another dimension. The dimension is inhabited by strange and wonderful creatures. The friends must find a way to get back home, but they soon discover that they are not the only ones who want to find the portal.
  5. A teenager discovers that she has the power to control the weather. The teenager must use her powers to stop a series of deadly storms that are threatening her town. The teenager soon realizes that her powers are more than she bargained for.

I did not care too much for options 2–4, but 1 and 5 had some appeal. Given that my last novel already focused on AIs though, I decided to focus on the weather-controlling teenager instead.

Great. I like the idea of a weather-controlling teenager but want to avoid the story transitioning into fantasy or super-hero fiction. How would the teenager have this power in the context of a sci-fi novel?

Bard gave me a couple of suggestions:

  • The teenager could be the result of a secret government experiment. The experiment was designed to create a super soldier, but it had the unintended side effect of giving the teenager weather-controlling powers.
  • The teenager could be the descendant of an alien race. The alien race had the ability to control the weather, and this ability was passed down to the teenager.
  • The teenager could be exposed to a powerful radiation that gave them weather-controlling powers. The radiation could have been from a nuclear accident, a solar flare, or some other source.
  • The teenager could be a cyborg. The cyborg was implanted with technology that gave them weather-controlling powers. The technology could have been developed by a government agency, a private company, or even a foreign power.

I discarded the alien race, as it felt too close to a Superman-style origin. Similar with radiation (Spiderman, Hulk). This left with two possible origins of power: secret government experiment or cyborg. Since I am going for a young adult novel, I want the protagonist to be relatable; cyborgs might be too different from the average reader. A secret government experiment gone wrong though? The teenager might not even have to know about it; it might be nanobots leaking into the groundwater or some other unintended circumstances. I had to think a little bit of Stephen King’s “Firestarter” — having the government involved can always serve for some interesting plot twists and conflicts.

Let’s go with the secret government experiment but not the super soldier part. Let’s also assume that the teenager was not directly part of the experiment and that the teenager got the weather controlling ability through some form of mishap or oversight during the experiment. With that in mind, can you rephrase the premise, please?

Bard promptly responded:

Sure, here is a rephrased premise for a young adult contemporary sci-fi novel about a teenager with weather-controlling powers:

Premise:

A teenager discovers that they have the ability to control the weather. The teenager was not directly part of a secret government experiment, but they were exposed to the experiment’s radiation during a mishap. The teenager must learn to control their powers and use them for good, while also avoiding being captured by the government.

Possible plot points:

The teenager could use their powers to help people in need, such as stopping a natural disaster or saving a life.

The teenager could use their powers to fight crime or evildoers.

The teenager could be hunted by the government, who are afraid of the power they possess.

The teenager could be forced to choose between using their powers for good or evil.

Theme:

The theme of the story could be about the responsibility of power, and the importance of using it for good. The story could also explore the ethical implications of using weather control technology.

Thanks, Bard. We now have a kernel of a story idea. It’s not very detailed (and I definitely don’t want to use ominous “radiation” idea or have the teenager fight crime as your friendly neighborhood weatherman, but it gave me the things I was looking for:

  • Protagonist: a teenager (details to be fleshed out)
  • Life-altering situation: Protagonist controls the weather. At the same time, a series of deadly storms is threatening their home town.
  • Life-lesson: With great power comes great responsibility (ouch — Spidey, it seems I just can’t quit you)

In the next article, we’ll try to use our friendly AI helpers to turn this basic premise into a more detailed outline.

--

--