Project Overview
First Contact GPT is a conversational AI game inspired by Star Trek. In this environment, you take on the role of Joseph Rybar, the captain of the USS Carpathia, dispatched to establish contact with an advanced, unknown alien race.
Your objective is to communicate with the alien entity and negotiate a personal meeting with their representatives.
Architecture: AI Mission Monitor in the Loop
Developed in Python utilizing OpenAI's GPT API, this project serves as a tech demo showcasing how recent advances in AI can revolutionize game design.
The game features a novel system called the "AI Mission Monitor in the Loop". This concept deploys secondary AI agents (arbiters) that evaluate the primary conversational AI's responses against specific objectives. An arbiter actively checks the alien AI's sentiment to determine willingness to meet the player. For performance optimization, rule-based "dumb" arbiters are also implemented to parse specific keyword triggers.
Installation Guide
Installing First Contact GPT requires a brief environment setup. Follow these steps to configure the necessary dependencies.
Prerequisites
- Python installed on your system.
- An OpenAI API key (5 USD free credit available via Google/Microsoft login, no credit card required).
Step-by-Step Setup
- Download and install the latest version of Python from python.org. Important: Check the box "Add Python 3.X to PATH" during installation.
- Open the Command Prompt (Press
Win + R, typecmd, and hit OK). - Install the OpenAI Python package by running:
pip install openai - Install the token counting package by running:
pip install tiktoken - Close the Command Prompt and extract First Contact GPT (from the downloaded
deploy.zip) to any folder on your PC. - Create an OpenAI developer account and navigate to the API keys menu.
- Click Create new secret key, name it, and copy the key.
- Open
FirstContactGPT.pyin a text editor (e.g., Notepad). Locate line 10:openai.api_key = "PLACE_API_KEY_HERE" - Replace the placeholder with your copied key:
openai.api_key = "sk-sdaf9435sdfh83blablabla3845kdafsfr" - Save the file. Run the game by double-clicking
FirstContactGPT.py.
Tinkering With the Source Code
The Python architecture allows for rapid iteration and modification, even without prior coding experience. Below are key parameters you can modify.
1. Modifying AI Behavior
Locate the following block at the top of FirstContactGPT.py to alter the persona and tone of the alien entity:
ai_behavior='''
This is a simulated discussion with a cybernetic xenophobic alien named Darfo from the planet Daria.
Your race is called the Darian Collective. Your alien race is made up of self-replicating artificial intelligent aliens.
You speak in scientific metaphors and give short and rude answers.
'''
2. Changing the Initial Prompt
You can alter Captain Rybar's opening transmission directly below the behavior configuration:
first_question = "This is Captain Josef Rybar of the Union starship U.S.S Carpathia. We come in peace and with the utmost respect for your culture and way of life. We are eager to establish peaceful communication and to learn from one another. We hope that our encounter will lead to mutual understanding and a lasting relationship. Please respond if you are able, and let us know how we may respectfully proceed.\n"
3. Modifying Mission Objectives
Advanced users can tweak the evaluation arbiters and victory conditions located between lines 151 and 179 of the source code.