JELLE VAN DOORNE - GAME & NARRATIVE DESIGN
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit

NPC's and Conversations

24/4/2018

0 Comments

 
Through the weekend and yesterday, I worked on a mechanic to allow the player to talk to NPC's: non-playable characters. In Viola, any NPC can join your party, so it's important to be able to talk with them.

Click 'Read more' to find out what I used to make this mechanic.

How to Talk to People

To create the talking mechanic, I needed a few art assets to start: avatars, a font, and a 9-slice image of the UI. 9-slices are automatically manipulated by Unity to create scalable UI's. This little thing can become a very large window with this technique. The avatars were created from the RPG battle concept art, and the font is the same 'RPGFont' I've used previously.
Picture
However, programming-wise, story elements like these are a gargantuan task. The components individually are not overly difficult, but there are still quite a few:
  1. Player must be in range of an NPC
  2. Disabling player control
  3. Spawning UI
  4. Write dialogue, and make it easy to edit
  5. Spawn written dialogue
  6. Know which NPC is talking and changing UI based on that
  7. Time the dialogue
  8. Play audio clips when characters talk
  9. Possibly animate the "avatar" UI
  10. Hold conversation flags
Doing this once is doable. However, scalability becomes an issue. Five dialogue lines is very easy to oversee with a few components added to NPC objects. When that number may be 50, 500, 5000 or even 50000, plus the potential for voice lines, localization, multiple characters, thousands of conversation flags... That's when it becomes hard. At that point, using a tried-and-true system somebody else previously built is a much better option, especially for a beginner programmer such as myself.

Thus I found RPGTalk, a free Unity asset package that does a lot of the heavy lifting when it comes to the talking mechanic. Out of the above list, it handles points 1, 3, 4, 5, 6, 7, 8 and 9. Basically, it doesn't keep track of conversation flags and doesn't disable player control. The latter is trivial. Conversation flags are a lot of custom work for each level, but very doable, especially since RPGTalk can trigger functions in scripts on its own.
Picture
A DialogueHandler object is used to hold the basic settings of RPGTalk.
Picture
Every NPC has an RPGTalk Area, that changes a few variables, such as which lines need to be displayed. It also calls a function on the BoolHandler, which sets conversation flags.
Picture
I had to write a BoolHandler myself to keep track of conversation tags. Luckily for me, it's very simple to create. Not so luckily, it requires a slight bit of coding, and I'll have to create new containers for each level.
Picture
Finally, I had to write a TalkSoundHandler, which changes the audio clip whenever a new character speaks. This way, every character has a unique "voice".
Picture
For the curious: text is handled simply with a .txt file. RPGTalk can look for the [title] tags to know where a dialogue begins and ends, and the character speaking is simply determined by the name in front of the line of dialogue.
I'll spend the rest of the week working on new concept artwork for the RPG battles. I had an idea to make the game a little more music-themed, which would give the game an extra unique selling point (USP): music and rhythm game elements added to the RPG sections.
0 Comments



Leave a Reply.

    Tweets by GameViola

    About

    This is a development blog for my own game project, "Viola".

    Picture

    Archives

    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018

    Categories

    All
    Art
    Design
    Music
    Programming
    Story
    Viola

    View my profile on LinkedIn

    RSS Feed

Site

Portfolio
About
​Contact
  • Home
  • Portfolio
    • Angela's Wedding Disaster
    • Angela's High School Reunion
    • Angela's Fashion Fever
    • Viola
    • Press Q To Stop Time
    • SECRET
  • Blog
  • About
  • Contact
  • Presskit