Skip to main content

NPC Development and Optimizations

Technical Insights into NPC Development and Optimization

2021 09 06 npcrigging 01The TGS development team is currently focusing on refining NPC functionality in The Repopulation, addressing challenges and identifying opportunities for improvement. Initial attempts to optimize PC and NPC models by removing unnecessary parts and consolidating textures revealed only a marginal performance boost of less than 1%. Further investigation exposed significant overhead issues in the Repop method of loading NPCs, causing a notable 40-50% performance drop compared to the default HE method. This discovery provides valuable insights for enhancing both the game and the engine, marking a step toward more efficient and optimized NPC systems.

We have identified two major issues impacting The Repopulation, leading to latency and crashing problems. The first issue involves extremely large audio files causing loading and reloading challenges. The second issue centers around the NPC State system, particularly the excessive number of animations. Currently, humanoid characters, including Player Characters (PC) and Non-Player Characters (NPC), load 2 to 3+ sets of animations, each with identical binary data but stored in different directories with slight naming variations. This inefficient setup results in significant overhead, unnecessary loading, and unloading during character selection and area transitions, highlighting the need for optimization.

During our team's in-depth testing has uncovered significant performance and crashing issues related to The Repopulation's NPC States system. This system, responsible for handling NPC behaviors and characteristics, creates unique specifications for every NPC, resulting in a substantial overhead. Even for identical NPCs, each specification, along with associated animations, is loaded individually, leading to increased load and unload times. With numerous attached systems like Babbler, NPC FX, Outfit, Skill Spec, Level/Tier, Knowledge, Task, Voice, QA status, Threshold, and Armor Stat, the cumulative effect exacerbates performance drops, particularly noticeable with a higher number of NPCs in an area.

In the short term, the TGS development team plans to implement optimizations for The Repopulation, focusing on improving overall NPC performance. Initial efforts involve refining animations, leading to noticeable enhancements in loading times across various game phases. However, while testing these improvements, the team encountered unexpected issues with the facial features of female characters. Despite this hiccup, the commitment to incremental optimizations demonstrates a strategic approach to addressing immediate concerns before undertaking a comprehensive overhaul of character models and systems in the future.

In a surprising turn, a seemingly unrelated change in the animation file directory for The Repopulation resulted in unintended consequences for female characters' facial features. Despite conventional expectations that animations don't influence face morphs, an anomaly emerged where alterations to the animation file location affected the facegen file for all female characters during idle states. Intriguingly, active animations corrected the facial distortions, only for the issues to resurface during idle periods. This perplexing behavior underscores the intricate connections within game development and highlights the need for careful scrutiny even in seemingly isolated modifications.

The investigation into the facial distortion issue in The Repopulation took an unexpected turn, revealing odd animations in the male animation directory, including ones from a previous game, Hero's Journey. Intriguingly, some animations from Hero's Journey were employed in The Repopulation, potentially contributing to the problem. The mystery deepened as certain animations temporarily corrected the facial distortion during combat, while others did not. The root cause emerged as animation skin weights affecting not only the body but also the facegen and head skin weights. Now faced with a critical decision, the development team must choose between redoing all character models or painstakingly fixing skin weights for existing models and affected animations.

In this update, we delve into the technical intricacies of character development, focusing on Player and Non-Player Characters (NPCs). This featurette goes beyond the surface, providing insightful updates on ongoing development efforts.

Optimizations,  Challenges and Testing:

Initial attempts to optimize PC and NPC models showed minimal impact. Testing revealed significant performance drops, particularly when using the Repop method. The identified bottleneck lies in the NPC State system, primarily related to large audio files and redundant loading of animation sets.

A deeper analysis exposed redundant loading of animation sets, contributing to unnecessary overhead. Some directories contained 20.5 MB of identical animation data, causing inefficiencies during transitions. These insights paved the way for improvements in both the game and engine.

Investigations revealed issues in the NPC States system, causing latency with increasing NPC counts. Each NPC, even identical ones, carried unique specifications, resulting in extensive load times. Systems like Babbler, NPC FX, Outfit, and more added to performance challenges.

Short-Term Improvements:

Immediate enhancements focus on audio and animations. The upcoming patch will default to disabling audio files, reducing load size. Optimizing animations for humanoid characters led to a 30-40% reduction in load times. Unforeseen challenges affecting female characters' facial features during idle animations are under investigation.

Looking ahead, a redesigned NPC system is in the works to address recurring issues. The new system promises a unified interface for creating, updating, and fixing NPCs, simplifying development.

The forthcoming system incorporates an in-depth AI system tied to mission dialogue and faction systems. Enhanced pathing ensures cleaner, faster updates for NPCs. A unified spawner approach for static and aggressive NPCs, coupled with optimized combat using the new skill system, brings efficiency to the spawning process.

New character models are in the works, providing an up-to-date look while maintaining Repop's stylization. Leveraging the new item system facilitates cleaner and reusable code, enabling customization for NPCs' gear and inventory. In conclusion, ongoing efforts aim to enhance both the game and engine, providing a more immersive and efficient gaming experience. Stay tuned for future updates as we refine our character development process.

  • Hits: 29745