Remove peace tokens, fix who_i_am not in quotes, improve global prompt

main
Cameron Murphy Reikes 2 years ago
parent 0f14a6bcb3
commit 55541a7060

@ -18,14 +18,6 @@
{
filepath: "grunt_3.wav",
}
@image peace_orb:
{
filepath: "peace_orb.png",
}
@image peace_totem:
{
filepath: "peace_totem.png",
}
@image merchant:
{
filepath: "copyrighted/merchant.png",

@ -340,17 +340,6 @@
"id":2,
"name":"objects",
"objects":[
{
"class":"",
"height":32,
"id":4,
"name":"PeaceTotem",
"rotation":0,
"visible":true,
"width":32,
"x":1522.39393939395,
"y":1570.48484848484
},
{
"class":"",
"height":32,
@ -365,8 +354,8 @@
"rotation":0,
"visible":true,
"width":32,
"x":1530.91836734694,
"y":2684.06802721088
"x":1537.58503401361,
"y":1842.73469387755
},
{
"class":"",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

@ -8,7 +8,7 @@ const char *global_prompt = "You are a colorful and interesting personality in a
"Messages are json-like dictionaries that look like this: `{who_i_am: who you're acting as, talking_to: who this action is directed at, could be nobody, action: your_action, speech: \"Hey player!\", thoughts: \"Your thoughts\"}`. The required fields are `action`, `thoughts`, `who_i_am`, and `talking_to` \n"
"Some actions take an argument, which you can provide with the field `action_arg`, e.g for the action `give_item` you would provide an item in your inventory, like {action: give_item, action_arg: Chalice}. The item must come from your inventory which is listed below\n"
"`talking_to` provides the name of who the action is directed towards. Use 'nobody' if you just want to speak to the air, but if you're speaking to somebody fill out the field like `talking_to: \"Character's Name\"`. If in a past message, talking_to isn't your name, then it's much more likely you don't respond to their speech and action by leaving speech as a string of size 0, like `speech: \"\"`\n"
"Do NOT give away an item until the player gives you something you think is of equal value\n"
"You are an agent, NOT an assistant, which means you stand up for yourself! Do NOT give away an item until the player gives you something you think is of equal value. Get angry, act human, be interesting.\n"
;
const char *top_of_header = ""
@ -31,9 +31,6 @@ ActionInfo actions[] = {
.name = "give_item", .takes_argument = true,
.description = "Give the player an item from your inventory.",
},
{
.name = "fights_player",
},
{
.name = "joins_player",
.description = "Follow behind the player and hear all of their conversations. You can leave at any time",
@ -42,6 +39,9 @@ ActionInfo actions[] = {
.name = "leaves_player",
.description = "Leave the player",
},
{
.name = "fights_player",
},
{
.name = "stops_fighting_player",
},
@ -106,11 +106,6 @@ CharacterGen characters[] = {
.enum_name = "Invalid",
.prompt = "There has been an internal error.",
},
{
.name = "Peace Totem",
.enum_name = "PeaceTotem",
.prompt = "There has been an internal error.",
},
{
.name = "Player",
.enum_name = "Player",

@ -703,10 +703,6 @@ Vec2 entity_aabb_size(Entity *e)
{
return V2(TILE_SIZE*1.0f, TILE_SIZE*1.0f);
}
else if (e->npc_kind == NPC_PeaceTotem)
{
return V2(TILE_SIZE, TILE_SIZE);
}
else
{
assert(false);
@ -4136,9 +4132,6 @@ void frame(void)
else if (it->npc_kind == NPC_Jester)
{
}
else if (it->npc_kind == NPC_PeaceTotem)
{
}
else
{
assert(false);
@ -4397,23 +4390,9 @@ void frame(void)
{
if (closest_interact_with->is_npc)
{
if(closest_interact_with->npc_kind == NPC_PeaceTotem)
{
if(player->peace_tokens >= PEACE_TOKENS_NEEDED)
{
gs.won = true;
}
else
{
closest_interact_with->red_fade = 1.0f;
}
}
else
{
// begin dialog with closest npc
player->state = CHARACTER_TALKING;
player->talking_to = frome(closest_interact_with);
}
// begin dialog with closest npc
player->state = CHARACTER_TALKING;
player->talking_to = frome(closest_interact_with);
}
else
{
@ -4681,20 +4660,6 @@ void frame(void)
}
draw_animated_sprite((DrawnAnimatedSprite) { ANIM_knight_idle, elapsed_time, true, AddV2(it->pos, V2(0, 30.0f)), tint });
}
else if(it->npc_kind == NPC_PeaceTotem)
{
DrawParams d = (DrawParams) { true, quad_centered(it->pos, V2(TILE_SIZE, TILE_SIZE)), IMG(image_peace_totem), WHITE, .layer = LAYER_WORLD, };
draw_shadow_for(d);
draw_quad(d);
it->red_fade = Lerp(it->red_fade, dt*2.0f, 0.0f);
float fade_requirements = Lerp(0.0f, 1.0f - clamp01(LenV2(SubV2(player->pos, it->pos))/(TILE_SIZE*4.0f)), 1.0f);
MD_ArenaTemp scratch = MD_GetScratch(0, 0);
draw_centered_text((TextParams){true, false, FmtWithLint(scratch.arena, "%d/%d", player->peace_tokens, PEACE_TOKENS_NEEDED), AddV2(it->pos, V2(0.0, 32.0)), blendalpha(blendcolors(WHITE, it->red_fade, RED), fade_requirements), (1.0f / cam.scale)*(1.0f + it->red_fade*0.5f)});
MD_ReleaseScratch(scratch);
}
else
{
assert(false);
@ -5029,26 +4994,6 @@ void frame(void)
// ui
#define HELPER_SIZE 250.0f
// how many peace tokens
{
MD_ArenaTemp scratch = MD_GetScratch(0, 0);
const float to_screen_padding = 50.0f;
const float btwn_elems = 10.0f;
const float text_scale = 1.0f;
const float peace_token_icon_size = 50.0f;
TextParams t = {false, true, FmtWithLint(scratch.arena, "%d", player->peace_tokens), V2(0, 0), WHITE, text_scale};
AABB text_bounds = draw_text(t);
float total_elem_width = btwn_elems + peace_token_icon_size + aabb_size(text_bounds).x;
float elem_height = peace_token_icon_size;
AABB total_elem_box = aabb_at(V2(screen_size().x - to_screen_padding - total_elem_width, screen_size().y - to_screen_padding), V2(total_elem_width, elem_height));
draw_quad((DrawParams){false, quad_at(total_elem_box.upper_left, V2(peace_token_icon_size, peace_token_icon_size)), IMG(image_peace_orb), WHITE, .layer = LAYER_UI});
t.dry_run = false;
t.pos = AddV2(total_elem_box.upper_left, V2(peace_token_icon_size + btwn_elems + aabb_size(text_bounds).x/2.0f, -peace_token_icon_size/2.0f));
draw_text(t);
MD_ReleaseScratch(scratch);
}
// keyboard tutorial icons
if (!mobile_controls)
{

@ -245,9 +245,6 @@ typedef struct Entity
bool held_by_player;
ItemKind item_kind;
// peace totem
float red_fade;
// npcs
bool is_npc;
bool being_hovered;
@ -280,7 +277,6 @@ typedef struct Entity
bool is_character;
bool knighted;
bool in_conversation_mode;
int peace_tokens;
Vec2 to_throw_direction;
BUFF(Vec2, 8) position_history; // so npcs can follow behind the player
CharacterState state;
@ -467,7 +463,7 @@ MD_String8 generate_chatgpt_prompt(MD_Arena *arena, Entity *e, CanTalkTo can_tal
PushWithLint(scratch.arena, &cur_list, "{");
if(it->context.i_said_this) assert(it->context.author_npc_kind == e->npc_kind);
PushWithLint(scratch.arena, &cur_list, "who_i_am: %s, ", characters[it->context.author_npc_kind].name);
PushWithLint(scratch.arena, &cur_list, "who_i_am: \"%s\", ", characters[it->context.author_npc_kind].name);
MD_String8 speech = MD_S8(it->speech, it->speech_length);
PushWithLint(scratch.arena, &cur_list, "talking_to: \"%s\", ", it->context.was_talking_to_somebody ? characters[it->context.talking_to_kind].name : "nobody");

@ -9,7 +9,6 @@
#define PLAYER_ROLL_SPEED 7.0f
#define PERCEPTION_HEARING_RAGE (TILE_SIZE*4.0f)
#define CHARACTERS_PER_SEC 45.0f
#define PEACE_TOKENS_NEEDED 5
#define PROPAGATE_ACTIONS_RADIUS (TILE_SIZE*5.0f)
#define ARENA_SIZE (1024*1024)

Loading…
Cancel
Save