top of page
SpaceBackground.png
SpaceBackground.png

Developer Diary Week 4 – Personalities, Custom Jobs, and Design Refactoring

  • Writer: gtristanitristani
    gtristanitristani
  • Jun 10, 2023
  • 6 min read

This week, my plan was to focus almost entirely on the personality and job customization system. In the end, I still did, but while experimenting, I found a lot of opportunity to better design and implement the system. I hadn’t quite planned for it, but since I’m ahead of the schedule I made for myself, I’d like to take the time to pursue it.


I spent a lot of time testing out the extent of the dialog bank system I had made the week before. I ended up identifying and fixing quite a few bugs and adjusting certain behaviors as a result. The bugs I fixed and minor changes I made are as follows:

  1. NPCs don’t get stuck and “walk in place” after being talked to by the player during their commute.

  2. NPCs turn to face the player before talking to them.

  3. NPCs turn back to face their workbench after being interrupted by the player while working.

  4. NPC career objects are checked to not be set to nullptr prior to a dereference in several sections of code.

  5. Fixed an instance where a Personality sub-bank’s length was used to calculate a Job sub-bank response, which caused an unexpected “out of bounds” crash.

Last week, I had drastically under-scoped how much time it would take to write dialog for different situations in the system. Initially, I had planned on five fully-written and unique personalities, and enough responses to keep them interesting. I ended up writing seven unique responses for each NPC in each of their sub-banks. There were 16 different sub-banks even before implementing the planned coworker sub-bank, which means each personality currently has 112 different responses. This week, I was able to write three, which I felt is sufficient to show off the system for the time being, given that it added up to a total of 336 different responses! The career dialog sub-banks also needed 3 responses for each sub-bank, which meant each of the four jobs needed 48 unique responses, adding up to 192 responses. Overall, I wrote 528 different responses for the three personalities and four careers.

ree

It might seem a bit excessive, but I still think it was a valuable use of time for this project since it means there’s much more opportunity to test the full extent of the system, and show it off in an engaging way to others when it’s complete. However, with this level of quality and given that the focus on this project for myself is specifically on technical development and not creative writing, I have decided that the two remaining personalities, aimless and sporty, are not necessary for the time being.


Taking this time actually paid off as quickly as this week. While I was writing, I realized that the dialog system itself, since it’s such a huge piece of this project, needed more tailoring than just a random selection from different sub-banks. I don’t know if I would have realized that until too late had I not taken the time early on to start writing responses.


Noting that, I started brainstorming a solution to make the system more interesting and tailorable. The player needs to have more agency in what they want to talk about with the NPC, since this allows greater opportunity for the player to interact in a meaningful way with any given NPC. I also wanted the player to be able to cheer up and bond with an NPC that hasn’t quite grown to like them yet.

ree

I also realized that simply increasing the affinity towards the player regardless of how the NPC is feeling doesn’t make sense in the context of the project. NPC systems I’ve enjoyed in the past, like Animal Crossing and Sims which served as heavy inspirations, don’t react the same way in terms of mood and enjoyment each time you talk. The NPC doesn’t want to be bothered when tired, and they want to be left alone when in a bad mood. If the player talks to them in this state, of course the NPC shouldn’t enjoy that. That’s another reason I decided to rework some of the dialog system.

ree

After thinking on it a while longer, I realized that the solution could lie in part through the implementation of a dialogue sub-menu. I created some basic UI for it this week, but didn’t have time to get to logical implementation. Of course, the old random selection system is still a possibility. I plan on implementing this through the “surprise me” button when choosing how to interact with the NPC. But now, it’s not the only choice that a player will have. If they truly want to explore all the dialog and potential responses an NPC has for them, this should provide a much more engaging and realistic way.


With this design more written out, I feel excited to proceed with this rework. Overall, I’m glad I got the chance to take the time to look back at my initial design and iterate a bit more before it got too late to change, even if that means some of my other goals for this week were left uncompleted.


After brainstorming for a bit, there was still something else I wanted to do. I mentioned back in week 2 that I had some difficulty with the animation system. This week, I tried creating a new animation blueprint that operated in the same way as the previous one I had been testing with. It took me a while to find that it’s possible to create a child animation blueprint that overrides the parent with its own custom animations, while still keeping the same variables and state machine logic. But thankfully, it ended up working very well! Thus, I created the first NPC Villager in the system with a complete personality and career: Lucy!

Lucy has a shy personality, and works as a software engineer from 12:30 – 8:30 AM, taking the late night shift. I experimented a lot with her to see how the two attributes operated together, and they seem to work particularly well. I found that some personalities and careers complement each other better than others. For the software engineer job, I thought it worked particularly well with both the arrogant/cocky and shy/quiet villagers. The software engineer job is the new name for my previously listed desk worker job, since desk worker I found to be far to broad to write dialogue for.


For the next week, I plan to change my previous schedule a bit to accommodate the dialog system rework. Specifically, I plan to implement the system as I described above for NPC dialog and player interaction. I’ll change the affinity gained or lost based on the exact sub-bank returning a response. Additionally, I’ll have negative mood and low energy responses override other sub-banks, since these are both incredibly strong incentives for why an NPC doesn’t want to speak.


I also want to spend more time thinking on and implementing factors that can adjust NPC mood besides the player. Specifically, I would like to implement a “luck system” that specifies how good or bad the NPC’s day was at different key points. I’d like for this system to activate three times a day: Once in the morning, once in the afternoon, and once in the evening. Each of these time values can be configured by the user. When this time is hit, the NPC will receive 4 different mood level changes. They’ll get a massive boost in one, a minor boost in another, a minor downgrade in the third, and a massive downgrade in the last meter. I hope that this will keep their behavior dynamic and interesting throughout each day!


There also isn’t much of a way to adjust their mood from negative to positive currently by talking, this is only something they can improve in the design through rest, hobbies, or gifts. I’ll need to spend time thinking about the best way to fix this, whether through having the negative mood gradually drain energy at a higher rate to make NPCs rest more quickly and recover, or through creating a special listen or comfort dialog option for players to use. I would rather stay away from the latter since I'd prefer not to spend more time focusing on writing responses. Regardless, the mood system is something that will need work and experimentation to fully figure out. So, I want a lot of time next week to be dedicated to figuring out how I want to implement it.


As a final note, there was a version control problem that arose earlier this week. While I was unaffected, it had me a bit worried about the possibility of losing my work so far. The solution I came to is hosting it publicly, specifically on my GitHub!

ree

I’d love to hear feedback on it, so please feel free to download and play around with it at your leisure! Besides a learning experience, I want it to be a tool to help others, and I hope it provides some insight into game AI behavior, and the design and implementation processes in game development.


The link to the GitHub repository is https://github.com/grist-maker/NPCVillagers. Thank you for sticking with me through this process, and I hope you'll tune in for next week's update!

 
 

©2022 by Gabrielle Tristani's Portfolio. Proudly created with Wix.com

bottom of page