diff --git a/assets/drama.mdesk b/assets/drama.mdesk index 6cb8b2b..8a7615b 100644 --- a/assets/drama.mdesk +++ b/assets/drama.mdesk @@ -21,7 +21,7 @@ {enum: PreviousPlayer1, dialog: "Yo?", to: Daniel} {enum: Daniel, dialog: "Are you askin' a question", to: PreviousPlayer1} {enum: PreviousPlayer1, dialog: "I guess so? What do you think of farmers?", to: Daniel} -{enum: Daniel, dialog: "I don't tolerate questions. Get out of my sight before I make you!", to: PreviousPlayer1, action: ACT_aim_shotgun, action_argument: "PreviousPlayer1"} +{enum: Daniel, dialog: "I don't tolerate questions. Get out of my sight before I make you!", to: PreviousPlayer1, action: ACT_aim_shotgun, action_argument: "Previous Player 1"} {enum: Raphael, dialog: "What's going on here?", to: Daniel} {enum: Daniel, dialog: "THIS DAMNED FOOL DOESN'T UNDERSTAND RESPECT", to: Raphael} {enum: Raphael, dialog: "Easy man, easy. I ain't much for helpin' folk but you're outta control.", to: Daniel} @@ -61,6 +61,15 @@ {enum: PreviousPlayer2, dialog: "kys", to: Tombstone} {enum: Tombstone, dialog: "Pardon?", to: PreviousPlayer2} +{can_hear: [PreviousPlayer3, Tombstone]} +{enum: PreviousPlayer3, dialog: "Hey", to: Tombstone} +{enum: Tombstone, dialog: "Another one shall bite the dust, or so to speak.", to: PreviousPlayer3} +{enum: PreviousPlayer3, dialog: "What trisls?", to: Tombstone} +{enum: Tombstone, dialog: "The trials of self-discovery, my friend. Can you change Daniel's ways before the sun sets?", to: PreviousPlayer3} +{enum: PreviousPlayer3, dialog: "Who is Daniel?", to: Tombstone} +{enum: Tombstone, dialog: "You'll find Daniel to be the Planet of Raphael's moon... Quite the rotund buffoon.", to: PreviousPlayer3} +{enum: PreviousPlayer3, dialog: "And you're saying to change his ways? How? What does that mean?", to: Tombstone} +{enum: Tombstone, dialog: "Cause a profound self realization before sundown, or he's toast", to: PreviousPlayer3} {can_hear: [PreviousPlayer1, Angel]} {enum: PreviousPlayer1, dialog: "fjdsklajf", to: Angel} diff --git a/character_info.h b/character_info.h index 2080f04..cb8f953 100644 --- a/character_info.h +++ b/character_info.h @@ -126,15 +126,20 @@ CharacterGen characters[] = { .prompt = CHARACTER_PROMPT_PREFIX("The Devil") "strange red beast, the devil himself, evil incarnate. You mercilessly mock everybody who talks to you, and are intending to instill absolute chaos.", }, { - .name = "PreviousPlayer1", + .name = "Previous Player 1", .enum_name = "PreviousPlayer1", .prompt = CHARACTER_PROMPT_PREFIX("Previous Player 1") "random person, just passing by", }, { - .name = "PreviousPlayer2", + .name = "Previous Player 2", .enum_name = "PreviousPlayer2", .prompt = CHARACTER_PROMPT_PREFIX("Previous Player 2") "random person, just passing by", }, + { + .name = "Previous Player3", + .enum_name = "PreviousPlayer3", + .prompt = CHARACTER_PROMPT_PREFIX("Previous Player 3") "random person, just passing by", + }, { .name = "Tombstone", .enum_name = "Tombstone", diff --git a/main.c b/main.c index e6de6d6..d26d140 100644 --- a/main.c +++ b/main.c @@ -5849,6 +5849,7 @@ void frame(void) case NPC_Devil: case NPC_PreviousPlayer1: case NPC_PreviousPlayer2: + case NPC_PreviousPlayer3: assert(false); break; } diff --git a/makeprompt.h b/makeprompt.h index ac2f52f..6306b0f 100644 --- a/makeprompt.h +++ b/makeprompt.h @@ -441,6 +441,84 @@ String8List dump_memory_as_json(Arena *arena, Memory *it) return current_list; } +String8List memory_description(Arena *arena, Entity *e, Memory *it) +{ + String8List current_list = {0}; + #define AddFmt(...) PushWithLint(arena, ¤t_list, __VA_ARGS__) + // dump a human understandable sentence description of what happened in this memory + bool no_longer_wants_to_converse = false; // add the no longer wants to converse text after any speech, it makes more sense reading it + if (it->action_taken != ACT_none) + { + switch (it->action_taken) + { +#define HUMAN(kind) S8VArg(npc_to_human_readable(e, kind)) + case ACT_none: + break; + case ACT_join: + AddFmt("%.*s joined %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); + break; + case ACT_leave: + AddFmt("%.*s left their party\n", HUMAN(it->context.author_npc_kind)); + break; + case ACT_aim_shotgun: + AddFmt("%.*s aimed their shotgun at %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); + break; + case ACT_fire_shotgun: + AddFmt("%.*s fired their shotgun at %.*s, brutally murdering them.\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); + break; + case ACT_put_shotgun_away: + AddFmt("%.*s holstered their shotgun, no longer threatening anybody\n", HUMAN(it->context.author_npc_kind)); + break; + case ACT_approach: + AddFmt("%.*s approached %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); + break; + case ACT_end_conversation: + no_longer_wants_to_converse = true; + break; + case ACT_assign_gameplay_objective: + AddFmt("%.*s assigned a definitive game objective to %.*s", HUMAN(it->context.author_npc_kind), HUMAN(it->context.talking_to_kind)); + break; + case ACT_award_victory: + AddFmt("%.*s awarded victory to %.*s", HUMAN(it->context.author_npc_kind), HUMAN(it->context.talking_to_kind)); + break; + } + } + if (it->speech.text_length > 0) + { + String8 target_string = S8Lit("the world"); + if (it->context.talking_to_kind != NPC_nobody) + { + if (it->context.talking_to_kind == e->npc_kind) + target_string = S8Lit("you"); + else + target_string = S8CString(characters[it->context.talking_to_kind].name); + } + + String8 speaking_to_you_helper = S8Lit("(Speaking directly you) "); + if (it->context.talking_to_kind != e->npc_kind) + { + speaking_to_you_helper = S8Lit("(Overheard conversation, they aren't speaking directly to you) "); + } + + AddFmt("%.*s%s said \"%.*s\" to %.*s (you are %s)\n", S8VArg(speaking_to_you_helper), characters[it->context.author_npc_kind].name, TextChunkVArg(it->speech), S8VArg(target_string), characters[e->npc_kind].name); + } + + if (no_longer_wants_to_converse) + { + if (it->action_argument.targeting == NPC_nobody) + { + AddFmt("%.*s no longer wants to converse with everybody\n", HUMAN(it->context.author_npc_kind)); + } + else + { + AddFmt("%.*s no longer wants to converse with %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); + } + } +#undef HUMAN +#undef AddFmt + return current_list; +} + // outputs json which is parsed by the server String8 generate_chatgpt_prompt(Arena *arena, GameState *gs, Entity *e, CanTalkTo can_talk_to) { @@ -507,76 +585,8 @@ String8 generate_chatgpt_prompt(Arena *arena, GameState *gs, Entity *e, CanTalkT in_drama_memories = false; AddFmt("Some time passed...\n"); } - // dump a human understandable sentence description of what happened in this memory - bool no_longer_wants_to_converse = false; // add the no longer wants to converse text after any speech, it makes more sense reading it - if(it->action_taken != ACT_none) - { - switch(it->action_taken) - { - #define HUMAN(kind) S8VArg(npc_to_human_readable(e, kind)) - case ACT_none: - break; - case ACT_join: - AddFmt("%.*s joined %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); - break; - case ACT_leave: - AddFmt("%.*s left their party\n", HUMAN(it->context.author_npc_kind)); - break; - case ACT_aim_shotgun: - AddFmt("%.*s aimed their shotgun at %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); - break; - case ACT_fire_shotgun: - AddFmt("%.*s fired their shotgun at %.*s, brutally murdering them.\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); - break; - case ACT_put_shotgun_away: - AddFmt("%.*s holstered their shotgun, no longer threatening anybody\n", HUMAN(it->context.author_npc_kind)); - break; - case ACT_approach: - AddFmt("%.*s approached %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); - break; - case ACT_end_conversation: - no_longer_wants_to_converse = true; - break; - case ACT_assign_gameplay_objective: - AddFmt("%.*s assigned a definitive game objective to %.*s", HUMAN(it->context.author_npc_kind), HUMAN(it->context.talking_to_kind)); - break; - case ACT_award_victory: - AddFmt("%.*s awarded victory to %.*s", HUMAN(it->context.author_npc_kind), HUMAN(it->context.talking_to_kind)); - break; - } - } - if(it->speech.text_length > 0) - { - String8 target_string = S8Lit("the world"); - if(it->context.talking_to_kind != NPC_nobody) - { - if(it->context.talking_to_kind == e->npc_kind) - target_string = S8Lit("you"); - else - target_string = S8CString(characters[it->context.talking_to_kind].name); - } - - String8 speaking_to_you_helper = S8Lit("(Speaking directly you) "); - if(it->context.talking_to_kind != e->npc_kind) - { - speaking_to_you_helper = S8Lit("(Overheard conversation, they aren't speaking directly to you) "); - } - - AddFmt("%.*s%s said \"%.*s\" to %.*s (you are %s)\n", S8VArg(speaking_to_you_helper), characters[it->context.author_npc_kind].name, TextChunkVArg(it->speech), S8VArg(target_string), characters[e->npc_kind].name); - } - - if(no_longer_wants_to_converse) - { - if (it->action_argument.targeting == NPC_nobody) - { - AddFmt("%.*s no longer wants to converse with everybody\n", HUMAN(it->context.author_npc_kind)); - } - else - { - AddFmt("%.*s no longer wants to converse with %.*s\n", HUMAN(it->context.author_npc_kind), HUMAN(it->action_argument.targeting)); - } - } - #undef HUMAN + String8List desc_list = memory_description(scratch.arena, e, it); + S8ListConcat(¤t_list, &desc_list); } // if I said this, or it's the last memory, flush the current list as a user node