In this guide, you will learn how to use OpenAI's "chat" API to generate an endless text adventure game on the PyPortal family of devices; the PyPortal Titano is recommended for its larger screen.

By providing a suitable prompt to OpenAI, it will offer a fictional adventure where the next choice can be made on the PyPortal touchscreen. This choice, along with some of the previous text, is fed back to the API to get the result of the action. Because of the random factor in the text ChatGPT generates, and the branching choices, it's unlikely that two games would ever be the same.

Ultimately the "adventure" is not pre-planned and frequently makes unjustifiable creative leaps, but the author has found it fun to play with anyway.

If the "Zorque Mansion" scenario doesn't interest you, create a scenario of your choice by writing a sentence or two in natural human language describing it; no complicated coding is needed to tell a sci-fi story instead, or even to play in French instead of English!

Photos in this guide show the PyPortal Titano with the 3D printed "retro case". Check out the full guide for that 3D printed project.

Parts

Hand holding PyPortal Titano development board with SAMD51, ESP32 Wifi, and 3.5" touchscreen TFT display.
The PyPortal Titano is the big sister to our popular PyPortal now with twice as many pixels! The PyPortal...
$59.95
In Stock
Angled shot of coiled pink and purple USB cable with USB A and USB C connectors.
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also made for USB C for our modernized breakout boards, Feathers, and...
$2.95
In Stock
Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display.
PyPortal, our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface...
$54.95
In Stock
Hand holding PyPortal Titano development board with SAMD51, ESP32 Wifi, and 2.4" touchscreen TFT display.Adafruit PyPortal Pynt
The PyPortal Pynt is the little sister to our popular PyPortal - zapped with a shrink ray to take the design...
$49.95
In Stock
Fully Reversible Pink/Purple USB A to micro B Cable
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully reversible! That's right, you will save seconds a day by...
$3.95
In Stock
1 x OpenAI Account & API Key
A $2.00 budget suffices for multiple hours of play.

This guide was first published on Mar 10, 2023. It was last updated on Jun 20, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.