Gameboi leverages GPT, Dall-E and PyGame to create customized 2D games based on user input. It is designed to streamline the game development process by automating various stages, from generating game sprites and assets to writing PyGame code.
Features:
-
Prompt Enhancement: The Game Generator begins by enhancing the prompt entered by the user. This step ensures that the game concept is well-defined and rich in detail, setting a strong foundation for the game development.
-
Image Asset Generation and Organization: One of the standout features is its ability to identify and generate the necessary image assets for the game. These assets are automatically downloaded and organized into an 'asset' subfolder within the main game folder, ensuring easy access and management.
-
Pygame Code Generation: The tool generates the initial Pygame code required to bring the game to life. This code serves as a starting point for further development and customization.
-
Error Resolution Loop: In the event of any errors during gameplay, the Game Generator enters a loop where it identifies the issues, solves them, and regenerates the necessary code. This feature significantly reduces debugging time and enhances the overall development process.
System Requirements:
- Python 3.x
- Pygame Library
- ChatGPT API Access
Space.Shooter.mp4
To run this project, you will need to add the following environment variables to your .env file. You need to add your OpenAI api key.
OPENAI_API_KEY
Windows:
-
Open the Start Menu.
-
Search for “Environment Variables” and click on “Edit the system environment variables.”
-
Click the “Environment Variables” button.
-
Under “User variables,” click “New” and enter the variable name and value.
macOS:
-
Open your Terminal app. You can find it in Applications › Utilities › Terminal
-
Type nano ~/.shre if you're using Zsh (default on newer macOS), or nano ~/. bash profile for Bash.
-
In the file that opens, add export OPENAI API KEY="your api key here" at the end.
-
Save changes by pressing Ctrl + 0, then Enter. Exit by pressing ctrl + X
-
Type source ~/.zshre Or source ~/. bash profile to reload the profile.
-
Verify the setup by typing echo $OPENAI_API_KEY in the terminal. It should display your API key.
Clone the project
git clone https://github.com/xf4c70r/GameBoi.git
Go to the project directory
cd GameBoi
Install dependencies
pip install -r requirements.txt
Run the main file
python3 main.py