top of page
  • Writer's pictureDoğa

Rewriting Advanced Locomotion System with C++

Updated: Jan 30, 2023

Introduction

Advanced Locomotion System is a popular plugin for Unreal Engine, and it's fully based on blueprints. Because of that, the system is technically looks awesome, but in practice, it comes with lots of performance issues. It's already a known thing C++ performs way better than blueprints, so that, I've decided to step up and rewrite that awesome system on C++ without involving blueprints. My GitHub repository with more than 1.5k stars can be accessed from https://github.com/dyanikoglu/ALS-Community


About the Progress

While rewriting the system, I've did lots of optimizations on crucial parts of the character class, especially for the calls made in tick function. For example, the blueprint version was controlling character state enum values in tick function, and migrating those values into animation blueprint in case of they're changed by player inputs. That was one of the worse methods you can use for a character logic, so I've dumped the whole method, and switched to a event based system instead. In my implementation, each character state enum has a setter & getter function, and it's prohibited to directly set those values. So that, whenever setter function for the related enum is called, the change also will be migrated into animation blueprint, and required work will be done only one time. That saved lots of CPU time in my implementation, because of removing character state checks from tick fuction (Please note that ALS has around 7-8 different character state enum).


That method I've described above also saved lots of bandwith on replication, because on the blueprint version, animation blueprint was continuously doing RPCs on each tick to fetch state values from character blueprint. With my method, only one RPC is made after a state change occurs for a single character. Speaking about replication, after I've made my Github repository public, and shared it on various Unreal Engine communities, it got huge amount of attention from other developers. One of those developers helped me to complete replication support for ALS (Blueprint version doesn't have replication support). Thanks to his contributions, we were able to implement a full replication support with highly optimized bandwith usage. Apart from those, I've also implemented lots of custom bug fixes to make the system more stable for production purposes (Blueprint version is not maintained anymore by the owner). Because of those efforts of mine, the repository is advertised as "Community Repository" in the support Discord server. Stress test for ALS C++ with 200+ AI characters on the scene. It is still able to maintain 60+ FPS with acceptable CPU time. (I think I don't need to mention blueprint version dips down to ~10 fps in same scenario 🙂) :


Replication demo with 2 connected players, and other AI characters wandering around:

The repository is still actively maintained, and I'm currently giving menthorship to other developers who wants to use ALS in their projects.

184 views0 comments

Recent Posts

See All
bottom of page