Product
October 3, 2023

Navigating the Uncharted: Crafting Requests to OpenAI API

Unveiling the hurdles faced while crafting initial requests to OpenAI's GPT-3 for my medieval game

Navigating the Uncharted: Crafting Requests to OpenAI API

Venturing into the world of OpenAI's GPT-3.5 for generating a dynamic narrative for my game was akin to stepping into a medieval fantasy, filled with promise yet fraught with challenges. My initial foray was filled with the enthusiasm of a bard entering a bustling tavern, ready to regale the crowd with tales of heroics, courtesy of GPT-3.5. My basic prompt to the API was simple: "As a bard of a medieval tavern, tell a story about a hero, provide for me 3 choices." The idea was to continue the narrative based on the choices provided, a cycle of request and response that would spin the yarn of an epic tale.

The maiden voyage was smooth, but soon, the dragons of reality began to rear their heads. Here’s a recount of the challenges that ensued:

  1. Awaiting Responses:A quintessential challenge in the digital realm is the wait time between sending a request and receiving a response. In the case of the ChatGPT API, the response time could range from a blink to a few lingering seconds. While this was bearable for my MVP, aiming to merely see the first blush of dawn in my game, it's a villainous trait for a polished product. The fluidity of the narrative could easily drown in these pauses.
  2. Narrative Continuity:Each request to the API was like a roll of dice, sometimes landing on treasure, other times leading to a wild goose chase. The resultant stories, though intriguing, began to stray from one another as the narrative progressed. The unpredictability, once a charmed feature, started morphing into a maze with no clear end.
  3. Image Stagnancy:The visual aspect of my game at this juncture was a static image, a placeholder for a more dynamic illustration that would evolve with the narrative. The medieval ambiance craved for images that breathed along with the story, a task left for the morrow.

The antidote to the first two dilemmas was to craft a skeleton for the narrative. A core structure of locations and characters, coupled with additional information sent with each request, aimed to guide the narrative like a compass. However, this solution unfurled a new challenge, a hidden trap in the quest that awaited my next move. The tale of tackling this newfound challenge is a story for another day, a page in the chronicle that I am eager to share in the subsequent chapter.

As I delve deeper into the realms of coding, OpenAI, and narrative generation, each challenge unfurls a lesson, a step closer to the holy grail of creating a captivating game of choice set in the medieval era. Stay tuned for the next chapter where I’ll unravel more of this intriguing expedition from the realm of Product Management to the hands-on world of Coding and Game Development.