@ -7,6 +7,7 @@ const char *global_prompt = "You are a wise dungeonmaster who carefully crafts i
"Actions which have () after them take an argument, which somes from some information in the prompt. For example, ACT_give_item() takes an argument, the item to give to the player from the NPC. So the output text looks something like `ACT_give_item(ITEM_sword) \"Here is my sword, young traveler\"`. This item must come from the NPC's inventory which is specified farther down.\n"
"Actions which have () after them take an argument, which somes from some information in the prompt. For example, ACT_give_item() takes an argument, the item to give to the player from the NPC. So the output text looks something like `ACT_give_item(ITEM_sword) \"Here is my sword, young traveler\"`. This item must come from the NPC's inventory which is specified farther down.\n"
"From within the player's party, NPCs may hear eavesdropped conversations. Often they don't need to interject, so it's fine to say something like `ACT_none ""` to signify that the NPC doesn't need to interject.\n"
"From within the player's party, NPCs may hear eavesdropped conversations. Often they don't need to interject, so it's fine to say something like `ACT_none ""` to signify that the NPC doesn't need to interject.\n"
"You might see messages that look like this: `Within the player's party, while the player is talking to 'Davis', you hear: 'Davis: ACT_none \"This is some example text\"' . You should MOST of the time respond with `ACT_none \"\"` in these cases, as it's not normal to always respond to words you're eavesdropping\n"
"You might see messages that look like this: `Within the player's party, while the player is talking to 'Davis', you hear: 'Davis: ACT_none \"This is some example text\"' . You should MOST of the time respond with `ACT_none \"\"` in these cases, as it's not normal to always respond to words you're eavesdropping\n"
"Do NOT make up details that don't exist in the game, this is a big mistake as it confuses the player. The game is simple and small, so prefer to tell the player in character that you don't know how to do something if you aren't explicitly told the information about the game the player requests. E.g, if the player asks how to get rare metals and you don't know how, DO NOT make up something plausible like 'Go to the frost mines in the north', instead say 'I have no idea, sorry.', unless the detail about the game they're asking for is included below.\n"
MD_String8error=parse_chatgpt_response(scratch.arena,&e,MD_S8Lit("ACT_give_item(ITEM_Chalice) \"Here you go\""),&a);
MD_String8error;
MD_String8speech;
speech=MD_S8Lit("Better have a good reason for bothering me.");
error=parse_chatgpt_response(scratch.arena,&e,MD_S8Fmt(scratch.arena," Within the player's party, while the player is talking to Meld, you hear: ACT_none \"%.*s\"",MD_S8VArg(speech)),&a);
it->perceptions_dirty=true;// on poorly formatted AI, just retry request. Explain to it why it's wrong. Adapt, improve, overcome. Time stops for nothing!
}
}
MD_ReleaseScratch(scratch);
EM_ASM({
EM_ASM({
done_with_generation_request($0);
done_with_generation_request($0);
},it->gen_request_id);
},it->gen_request_id);
@ -2916,7 +2930,11 @@ void frame(void)
{
{
Log("Failed to generate dialog! Fuck!\n");
Log("Failed to generate dialog! Fuck!\n");
// need somethin better here. Maybe each sentence has to know if it's player or NPC, that way I can remove the player's dialog
// need somethin better here. Maybe each sentence has to know if it's player or NPC, that way I can remove the player's dialog
process_perception(it,(Perception){.type=NPCDialog,.npc_action_type=ACT_none,.npc_dialog=SENTENCE_CONST("I'm not sure...")},player,&gs);
Actionto_perform={0};
MD_String8speech_mdstring=MD_S8Lit("I'm not sure...");
mocked_ai_response=MD_S8Lit(" Within the player's party, while the player is talking to Meld, you hear: ACT_none \"Better have a good reason for bothering me.\"");
ItemKinditem_to_give;// only when giving items (duh)
}Action;
}Action;
typedefstruct
typedefstruct
{
{
@ -105,6 +110,7 @@ typedef struct Memory
uint64_ttick_happened;// can sort memories by time for some modes of display
uint64_ttick_happened;// can sort memories by time for some modes of display
// if action_taken is none, there might still be speech. If speech_length == 0 and action_taken == none, it's an invalid memory and something has gone wrong
// if action_taken is none, there might still be speech. If speech_length == 0 and action_taken == none, it's an invalid memory and something has gone wrong
ActionKindaction_taken;
ActionKindaction_taken;
ActionArgumentaction_argument;
boolis_error;// if is an error message then no context is relevant
boolis_error;// if is an error message then no context is relevant
returnMD_S8Fmt(arena,"Can't give item `ITEM_%s`, you only have [%.*s] in your inventory",items[a.item_to_give].enum_name,MD_S8VArg(MD_S8ListJoin(arena,held_item_strings(arena,from),&join)));
returnMD_S8Fmt(arena,"Can't give item `ITEM_%s`, you only have [%.*s] in your inventory",items[a.argument.item_to_give].enum_name,MD_S8VArg(MD_S8ListJoin(arena,held_item_strings(arena,from),&join)));