Search Unity

Managing NPC progress in a RPG.

Discussion in 'Game Design' started by mrCharli3, May 24, 2018.

  1. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    976
    I am struggling to come up with a smart system to manage my NPCs progress.
    By that I mean, what dialog should be played, what should they be doing, etc.

    At the moment, I am using a field called "NPC Stage", which I basically increase when something happens that would impact that NPC. Then I play a different dialog when I talk to that NPC depending on it's stage.

    This sytem is very basic, and as such can only support pretty basic scenarios. Say for example I want to talk to Joe, well he should probably have a different dialog pool depending on if his brother is dead yet or not. With my system this type of feature is hard to get.

    TLDR; Are there any tested and proven ways to manage NPC progress so that you can control their dialogs/quests/actions in a smart way, i.e depending on what has happened in the game, they will differ.
     
  2. verybinary

    verybinary

    Joined:
    Sep 23, 2015
    Posts:
    373
    afaik, your setup is great. the next step would be to expand it. one variable "brotherdead" another variable, "bodyfound", and lets go with another, "hassallytalkedsmackaboutbrotheryet"
    if joes brother is dead, dialogue A. after the body has been found, dialogue B, unless sally has talked smack about his brother to you yet, in which case, dialogue C.
    If you don't want to add a lot of variables, use an array to hold all of an npcs states
     
  3. Serinx

    Serinx

    Joined:
    Mar 31, 2014
    Posts:
    788
    It depends on the flow of your games story. Is it linear? Do things always happen in the same order?

    If it is linear, you could simply have a story progress variable, all NPCs would look at this same variable and adjust their dialogue accordingly.

    If it's not linear it becomes a little more complicated.

    I would approach it by having your NPCs with a list of all potential dialog options throughout the entire game.
    To begin with you might activate 3 of them.
    When an event occurs, e.g. brother dying, you can add and remove dialog options from the affected NPCs (or all of them)
    This way it wouldn't matter the order of events, you can just modify the dialog set when an event occurs.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    I agree about more variables than just "NPC Stage". Most games with branching dialogue use multiple variables, sometimes just global variables, sometimes with additional variables local to each NPC or data object (quest, location, etc.).

    The challenge is keeping the permutations manageable. It can help to compartmentalize. So variables related to Joe and his brother would play into each other, but variables related to Nancy, who lives in another country and is unlikely to ever meet Joe, can be entirely separate from Joe and his brother's dialogue. It's as much an art as anything else because you need to strike a balance between accommodating variables and managing complexity.

    If you're a visual thinker, a node-based tool like articy:draft or a free web-based mind-mapping app might be helpful to map the dialogue relationships.
     
    Doug_B likes this.