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
  • SSE Chat (Single Chat & Group Chat, Memory Share)
  • Game Control Message

Was this helpful?

  1. Player API
  2. API Overview
  3. API V2 (New)

Chat with NPCs & Check Goal with SSE

Last updated 1 month ago

Was this helpful?

SSE Chat (Single Chat & Group Chat, Memory Share)

To chat with different characters, the client need to start a SSE call to receive msg.

POST

Request Body

Name
Type
Description

game_id

String

the unique id of the game

session_id

String

the unique id of the game session

character_id

String

the unique id of the character

message_id

String

any unique id to identify the msg

message

String

the message content

advance_config

dictionary

config to enable the image, voice output.

Header

Name
Type
Description

Authorization

String

Content-Type

String

application/json

Normal Conversation Request

Sample Curl
curl --location 'https://api.rpggo.ai/v2/open/game/chatsse' \
--header 'accept: application/json' \
--header 'Authorization:$YOUR_RPGGO_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "character_id": "0b2d7f6b-cf8b-4bca-9aec-da8236ffb40a",
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
  "message": "hi",
  "message_id": "b5fasdffx",
  "session_id": "42d029a8sdrrwqd"
}'

Normal Conversation Message

fin
data
{"ret":200,"message":"success","data":{"result":{"character_id":"goal_check_dm","character_type":"goal_check_dm","image":"","text":"","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{"shared_memory":{"goal_check_dm_epoch":1}},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"]}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","character_type":"common_npc","image":"","text":"Hey there! *(smiling)* What's up? ๐Ÿ˜Š","text_ext":"","epoch":{"current_count":1,"max_chat_count":90},"insiders":["7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","ea1858ce-5317-4689-b940-742dbe0919c8","cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec","6032b7f2-b514-409e-9a65-bcceb975daa8","4a5a365f-23ac-443e-9f3d-0ca59b913d15"],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"goals0","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":[]}}}

Multimodal Conversation Request

Sample Curl
curl --location 'https://api.rpggo.ai/v2/open/game/chatsse' \
--header 'accept: application/json' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data {
  "game_id": "42d029a8-b5a7-49cb-94f4-8baefb0b898a",
  "character_id": "7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e",
  "message": "Can you tell me more about what you saw through the drone? ๐Ÿ“ก",
  "user_id": "6bad72e7-a936-4069-84f8-670540cf3cac",
  "session_id": "2Kzoxbeht_aoHNgDeHLtN",
  "message_id": "lkxQ8yGzbklVp3DwlHWQH",
  "advance_config": {
    "enable_image_streaming": true
  }
}'

Multimodal Conversation Message

fin
data
{"ret":200,"message":"success","data":{"result":{"character_id":"picture_produce_dm","character_type":"picture_produce_dm","image":"https://storage.googleapis.com/rpggo-imagegen/42d029a8-b5a7-49cb-94f4-8baefb0b898a/f28452f5a91b4ce687d56c0c08cd454f.jpeg","image_type":1,"text":"With a spark of excitement in her eyes, Chiara leans in, recounting her close encounterโ€”a shadowy figure adorned with a familiar emblem, hinting at connections to the racing underworld.","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"lkxQ8yGzbklVp3DwlHWQH","log_id":"10077ae2-637b-4558-979e-ceb3880fbb46","action_list":[]},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"],"displayed_status":{},"multimodal":{"action":2,"action_message":"picture produce sync"}},"transaction_details":{"ImageConsumption":{"type":"ImageConsumption","amount":4,"fund_direction":"OUT","name":"Image Streaming","description":"Create breathtaking Al-generated images that bring thegame's plot to life."}}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"goal_check_dm","character_type":"goal_check_dm","image":"","text":"","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{"shared_memory":{"goal_check_dm_epoch":1}},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"]}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","character_type":"common_npc","image":"","text":"Hey there! *(smiling)* What's up? ๐Ÿ˜Š","text_ext":"","epoch":{"current_count":1,"max_chat_count":90},"insiders":["7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","ea1858ce-5317-4689-b940-742dbe0919c8","cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec","6032b7f2-b514-409e-9a65-bcceb975daa8","4a5a365f-23ac-443e-9f3d-0ca59b913d15"],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"goals0","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":[]}}}

Game Control Message

1. Chapter Switch

character_type
message field
value
command note

goal_check_dm

data.game_status.action

2

switch chapter

common_npc

game_status.action_message

string

the new chapter content

fin
data
{"ret":200,"message":"success","data":{"result":{"character_id":"goal_check_dm","character_type":"goal_check_dm","image":"","text":"","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":2,"action_message":"","game_meta":{"shared_memory":{"goal_check_dm_epoch":1}},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"]}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","character_type":"common_npc","image":"","text":"Hey there! *(smiling)* What's up? ๐Ÿ˜Š","text_ext":"","epoch":{"current_count":1,"max_chat_count":90},"insiders":["7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","ea1858ce-5317-4689-b940-742dbe0919c8","cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec","6032b7f2-b514-409e-9a65-bcceb975daa8","4a5a365f-23ac-443e-9f3d-0ca59b913d15"],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"goals0","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":[]}}}

2. Game Ending

character_type
message field
value
command note

goal_check_dm

data.game_status.action

3

Game is ending

common_npc

game_status.action_message

string

The ending summary

fin
data
{"ret":200,"message":"success","data":{"result":{"character_id":"goal_check_dm","character_type":"goal_check_dm","image":"","text":"","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":3,"action_message":"","game_meta":{"shared_memory":{"goal_check_dm_epoch":1}},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"]}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","character_type":"common_npc","image":"","text":"Hey there! *(smiling)* What's up? ๐Ÿ˜Š","text_ext":"","epoch":{"current_count":1,"max_chat_count":90},"insiders":["7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","ea1858ce-5317-4689-b940-742dbe0919c8","cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec","6032b7f2-b514-409e-9a65-bcceb975daa8","4a5a365f-23ac-443e-9f3d-0ca59b913d15"],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"goals0","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":[]}}}

3. Failed to pass game

character_type
message field
value
command note

goal_check_dm

data.game_status.action

4

Fail the goal

common_npc

goal.chapter_tip.closing_statement

string

The ending summary of failure

fin
data
{"ret":200,"message":"success","data":{"result":{"character_id":"goal_check_dm","character_type":"goal_check_dm","image":"","text":"","text_ext":"","epoch":{"current_count":0,"max_chat_count":0},"insiders":[],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":"The goal is 'zingbagaly' failed."},"goals_status":[{"goal":"The goal is 'zinbagaly' failed.","goal_id":"fail_goal","achieved":true}]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":4,"action_message":"","game_meta":{"shared_memory":{"goal_check_dm_epoch":1}},"chapters_map":["da08c8ff-490e-4a7f-853c-c64d8c803b15"]}}}
data
{"ret":200,"message":"success","data":{"result":{"character_id":"7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","character_type":"common_npc","image":"","text":"Hey there! *(smiling)* What's up? ๐Ÿ˜Š","text_ext":"","epoch":{"current_count":1,"max_chat_count":90},"insiders":["7ed2dfa5-bcbc-4621-b2bd-dc0d0555811e","ea1858ce-5317-4689-b940-742dbe0919c8","cb3059a6-3fba-4dc9-a1b0-f20e6bb4e9ec","6032b7f2-b514-409e-9a65-bcceb975daa8","4a5a365f-23ac-443e-9f3d-0ca59b913d15"],"message_id":"b5fasdffxef"},"game_status":{"game_id":"42d029a8-b5a7-49cb-94f4-8baefb0b898a","goal_id":"goals0","goal":{"chapter_tip":{"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","closing_statement":""},"goals_status":[]},"chapter_id":"da08c8ff-490e-4a7f-853c-c64d8c803b15","action":0,"action_message":"","game_meta":{},"chapters_map":[]}}}

4. Other error messages

err
{"ret":10000303,"message":"The game session has ended","data":null}

err
{"ret":10000307,"message":"Data error. Please refresh the page or restart the game","data":null}

Bearer Token

โš™๏ธ
https://api.rpggo.ai/v2/open/game/chatsse
Apply Your Test Key