top of page

MassAI Civilians, City Sample Crowds & XP system

  • Writer: Roland Thomas
    Roland Thomas
  • Mar 1, 2024
  • 4 min read

To start this longer-than-usual post, I'll cover the non-civilian related achievements. I implemented an experience system, creating the relevant variables in the Third Person Character, and added an 'Give Exp' event to distribute XP to a player in the Game State. I also started a new map, with aims to add actual building assets and block out a level map.


City Sample Buildings

Sapphire City won't feel like a city if it doesn't have civilians walking around. I found a pack on Unreal Marketplace called City Sample Crowds and City Sample Buildings. These are packs of assets from a sample level created by Epic to show off Unreal Engine 5's capabilities. My initial plan was to use the buildings and crowd assets in my project, to create Sapphire City and its inhabitants.


At this time I was working on a different university group project, and was looking to use this assets in that project also. Doing it for the group project would help inform the process of implementing them in Nemesis: Showdown. I downloaded the HUMONGOUS City Sample Buildings pack, and created a storage level to put it in, from which I would then Migrate the assets I want to the group project. This is when I encountered my first problem. The buildings pack is not well optimised at all. It was so large and so performance intensive that it was impossible to use. Once I migrated a few buildings however, I attempted to push the project to the group Git, but as Git's repository files almost double the size of a project, and the building assets were so large, it eventually was decided that I had to abandon the buildings pack.


Later, I found Unreal's Documentation for City Sample that said the system requirements for the City Sample Project were waaaaay past my system's capabilities, recommending 64GB RAM, a 12-core CPU at 3.4 Ghz and an RTX 2080 / AMD Radeon 6000 or higher GPU.


City Sample Crowds

I then set my sights on the Crowds pack. This is a pack of metahuman assets, all bundled into one blueprint that allows the features to be swapped or randomised. Pairing this with Unreal Engine's MassAI framework (which allows you to spawn instances of actors en masse, and even apply AI to them), many instances of the City Crowd Blueprint can be spawned with randomised features, effectively populating the world with practically unique civilians.


Setting up Unreal to make use of City Sample Crowds and Mass AI was a bit difficult, as MassAI is still experimental and there isn't too much information about how to set Crowds up properly, however I did find a UE forum post that told me exactly which plugins I needed to enable to use Metahumans and Mass AI, and then an initial video I found on YouTube by mcGamez2k99 by showed me how to setup City Sample Crowds to be implemented into a project, and this was cross-referenced with this guide (part 1 of 3) by Ryan Laley on Mass AI, to further educate me on the process.


I setup the Zone Graph, Lanes, Data Assets and Mass Spawner required for the Mass AI system to work, and was actually able to spawn them in!

City Crowd Mass AI Data Asset
Mass AI Civilian State Tree

Whilst I was happy about this achievement, it was soon overturned, as the Mass Spawner would spawn the desired number of Crowd BP instances once the level starts. It turned out that the Crowd BP would asynchronously load all the assets it needed, especially as it the assets were being randomly picked for each instance that was spawned. This created a really long wait for the game to load, as soon as the level starts, or upon entry of the game. But at least they worked, right? Maybe I can find a way to optimise them, and then that will sort most of my problems.


So later on I worked on optimising City Crowds. Or rather, the loading time for them. To begin with, I turned off the option to randomise the features and instead created 2 or three Blueprints of them with set features, hoping that doing that would dramatically reduce the number of references it was searching for and loading in. This didn't work, as its till took just as long to start a level.


So then I tried a different approach. I thought that maybe I could implement a loading screen, that would wait until they were loaded in and then start the match. This proved to be more difficult than I planned, as after I learned how to implement one, I was unable to find a way to get the loading screen to register if the City Crowd blueprints were finished loading. I considered Level Streaming, but then found out that this would be really awkward to do in a multiplayer game.


Giving Up on City Sample

In the end, I decided to give up on City Crowds. In all honesty, they were a really big asset in terms of storage space as well, so I would be shrinking the size of the project by a large amount by removing it. I took another look at Mixamo and found that there were more 'civilian' type models than I first believed. I decided I would just use them instead, as they cost so much less in performance and wouldn't take an age and a half to load in. So started to gather the meshes and animations I would need, to implement at a later date.


Zone Graph - Lanes the civilians will spawn on and walk around
City Crowd Metahumans spawned in and walking around (after a lengthy loading period)

Recent Posts

See All
TODO: Session UI & Pause Screen

Started Session UI. Created most of the widgets, just need to complete the Find Session one, then include the functionality. Also created...

 
 
 

Comments


© 2024 by Rolandson Thomas. 

bottom of page