Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manekinekko/minecraft-openai
Controlling a Minecraft NPC using OpenAI 🤖
https://github.com/manekinekko/minecraft-openai
ai artificial-intelligence game gpt-3 minecraft mineflayer mineflayer-bot mineflayer-pathfinder npc openai
Last synced: 7 days ago
JSON representation
Controlling a Minecraft NPC using OpenAI 🤖
- Host: GitHub
- URL: https://github.com/manekinekko/minecraft-openai
- Owner: manekinekko
- License: mit
- Created: 2021-12-17T15:50:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-27T10:13:42.000Z (over 2 years ago)
- Last Synced: 2024-12-24T17:33:12.742Z (17 days ago)
- Topics: ai, artificial-intelligence, game, gpt-3, minecraft, mineflayer, mineflayer-bot, mineflayer-pathfinder, npc, openai
- Language: JavaScript
- Homepage: https://slides.com/wassimchegham/playing-minecraft-artificial-intelligence-open-ai-gpt-3-javascript
- Size: 229 KB
- Stars: 120
- Watchers: 12
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Minecraft OpenAI
A proof of concept for controlling a Minecraft Non-Player Characters using OpenAI and GPT-3.
![playing-minecraft-with-ai-gpt-3-no-text](https://user-images.githubusercontent.com/1699357/165494902-122c763c-7b88-4158-9685-24f0bdecb6b8.jpg)
## Requirements
- Clone this project on your local machine.
- [Minecraft](https://www.minecraft.net/en-us/get-minecraft) (Java Edition) version 1.17
- Node.js version 14+
- An [OpenAI](https://openai.com) account
- Create a `.env` file and copy your [OpenAI API key](https://beta.openai.com/account/api-keys) and save it```
CODEX_API_KEY=
```## Slide deck
https://slides.com/wassimchegham/playing-minecraft-artificial-intelligence-open-ai-gpt-3-javascript
## How to use
### Start the Minecraft server
Here is how to start the Minecraft server:
1. Choose a host computer. This computer should be fast enough to play Minecraft, while running a server for other players as well.
2. Launch the game and click **Single Player**.
3. Create a new world or open an existing one.
4. Inside that world, press the Esc key, and click **Open to LAN**.
5. Choose a game mode to set for the other players.
6. Choose **Creative mode** that allows you to fly and place an infinite number of blocks.
7. Click **Start LAN World**, and you'll see a message that a local game has been hosted.
8. Take note of the port number.### Launch the bot
From your terminal, run the following commands:
```
npm install
npm start -- --port [PORT]
```In a few seconds, you should see a message that the bot is running, and you should see the NPC pop up in Minecraft.
### Sending commands
Inside the Minecraft client, press the `T` key to open the chat box.
### Loading context
There are mulptiple supported contexts:
1. `empty`: An empty context (default).
2. `simple`: A basic context.
3. `advanced`: A more complex context.To load a context, type `load context [context_name]`.
You can also reset the current context by typing `reset context`.
## Disclaimer
This is a proof of concept. It is not intended to be used in production.
## Troubleshooting
### On WSL
If you are using WSL, you may need to provide the host computer's IP address to the bot.
```
npm start -- --port [PORT] --host [HOST]
```To get the IP address of your host computer, run the following command:
```
wsl.exe hostname -I
```