RPGGO Developer Documentation
  • Introduction
    • 🎮RPGGO API: the AI Engine for Game
    • 😎Getting Started
  • DATA SCHEMA
    • 🔢Understand the data schema
    • 🪿LLM-based Game Open Schema (L-GOS)
  • CREATOR API
    • 🆕V2 API
      • Create Character
      • Create Game SpriteSheet
  • Player API
    • ⚙️API Overview
      • API V2 (New)
        • Game Control
        • Chat with NPCs & Check Goal with SSE
      • API V1 (Deprecated)
        • Game
        • NPC
        • Memory
        • ErrorCode
    • 📰Notes: API V2 Released
      • Changes
  • Open Source Use Cases
    • 🍎Step by Step: Discord with V1 API
    • 🍒Simple Chat Game with V2 API
    • 🏰2D AI Town with V2 API
    • 🌴Stardew Valley Mod with V2 API
    • 🌐AI Game Website with V2 API
  • Thesis
    • 🗒️Thesis 2024: A Text-to-Game Engine for UGC-Based Role-Playing Games
    • 🗒️Initial Vision 2023: Text-To-OpenWorld Engine
  • Support
    • 🔑Apply Your Test Key
    • 📩Contact us
Powered by GitBook
On this page
  • GameList
  • StartGame
  • Chat

Was this helpful?

  1. Open Source Use Cases

Step by Step: Discord with V1 API

Based on our Discord game, here is a basic practice to demonstrate how to create a simple detective game using our API.

Last updated 8 months ago

Was this helpful?

Before diving into this document, it is strongly recommended to read to understand the relationships between games, scenes, goals, DMs, and NPCs.

All interfaces require the application of an app ID and authentication. The specific process can be found

GameList

You need to call the to retrieve all playable games. This API will return basic game information, which you can display as needed. In our Discord game, we display the game name and a brief description to help players choose.

Additionally, you need to remember the game ID and scene ID. When starting the game in the next step, the API will require these to specify the game. The relationship between games and scenes can be referenced .

curl --location --request POST 'https://api.rpggo.ai/open/game/gamelist' \
--header 'Application-ID: YOUR_RPGGO_APP_ID' \
--header 'Authorization: Bearer YOUR_RPGGO_API_KEY' \
--data ''

StartGame

In our Discord game, background information is displayed to help players understand the game. Relevant NPCs are loaded based on the NPC list for future conversations, and the initial dialogue between NPCs is automatically displayed.

Through the initial dialogue, players can naturally learn about the NPC's character, style, and plot. The DM will also explain the current game goal.

curl --location --request POST 'https://api.rpggo.ai/open/game/startgame' \
--header 'Application-ID: YOUR_RPGGO_APP_ID' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_RPGGO_API_KEY' \
--data '{ "session_id": "YOUR_SESSION_ID", "game_id": "6", "scene_id": "5", "continue": false }'

Chat

To enhance the game's playability, each game round limits the number of conversations with NPCs. So, in the API's response, pay attention to the "epoch" field, as NPCs will stop responding after reaching the conversation limit.

curl --location --request POST 'https://api.rpggo.ai/open/game/chat' \
--header 'Application-ID: YOUR_RPGGO_APP_ID' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_RPGGO_API_KEY' \
--data '{ "session_id": "YOUR_SESSION_ID", "npc_id": "1144870688000327750", "message": "who are you?" }'

The game's progress status is indicated in the "game status" field of the API interface. You can start a new game or end the game based on this field.

In our Discord game, when "action=3" (indicating the end of the game), a button to start a new game is automatically displayed, and relevant NPCs are removed. Of course, you can also implement a more interactive UI and save user game data to your server.

curl --location --request POST 'https://api.rpggo.ai/open/game/chat' \
--header 'Application-ID: YOUR_RPGGO_APP_ID' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_RPGGO_API_KEY' \
--data '{ "session_id": "YOUR_SESSION_ID", "npc_id": "1144871194668040232", "message": "James is the murderer" }'

After players choose a game, you need to call the , passing in the game and scene IDs to start the game. In our Discord game, clicking the game button will fetch the game based on these IDs. In this interface, the API will return basic information about the game scene, background, NPC list, and initial dialogue.

Once the game begins, you can use the at any time to engage in chat with the NPCs.

The DM, as a special NPC, not only engages in regular chat but also controls the game's goals and game progression. The specific relationships between scenes, objectives, and NPCs can be found .

🍎
here
here
here
here
chat interface
gamelist interface
startgame interface