I’m normally pretty ok at naming things in code, but I’m struggling here and would love some new ideas.

I’m building part of a game for the dialog with NPCs. It functions just like Fallout:

  • Player initiates dialog with NPC.
  • NPC says a few sentences.
  • Player gets a list of replies and can pick one.
  • Depending what the player picks, either the conversation will end, or the NPC will say some new stuff and start this over.

Here’s the names of objects that I have so far that I’m not exactly in love with. I’d love suggestions on any of these.

  1. Dialog: This is a “container” object. Clicking on an NPC will start the Dialog. This contains many Chats.
  2. Chat: This is the name I dislike most. A Chat contains the text the NPC will say, and a list of ChatReply objects.
  3. ChatReply: This contains the text of the reply (what the player is saying back to the NPC), as well as a pointer to either a new Chat, or to end the Dialog.

Any suggestions?


Update: From the replies, I think I like Dialog / Prompt / Reply.

  • tunetardis@lemmy.ca
    link
    fedilink
    English
    arrow-up
    14
    ·
    6 days ago
    1. Honestly, I don’t think dialog is bad for this? Maybe npc_dialog or npc_dialog_tree if you want to be less ambiguous?
    2. Something like prompt, query, or npc_prompt maybe?
    3. reply, response, or player_response? Maybe response could be the container that holds a reply (the text the player says) and a link to the next prompt?
  • kubica@fedia.io
    link
    fedilink
    arrow-up
    7
    ·
    6 days ago

    It might be over simplistic, but I’d probably try to be as close as I can to “Conversation”, formed by one or more “Question” and “Answer”.

  • FourPacketsOfPeanuts@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    6 days ago

    Instead of Chat how about ‘Utterance’ or just ‘Speech’?

    Also the other characters response shouldn’t be a different object should it but a different type? Perhaps you should have CharacterSpeech and NPCSpeech inheriting from Speech? And Dialog holds a collection of these?

  • Lemon@lemmy.zip
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    4
    ·
    6 days ago

    I usually ask ChatGPT and it gives me good answers. Might suggest the same!