Tutorial: Your First 60 Minutes with Mass

A guide to serve as a walkthrough of the MassEntity system for first time users. It covers the concepts of Mass, key terminology, and how Mass processors work under the hood. This is all tied together by creating Mass agents that behave as wandering pedestrians.

https://dev.epicgames.com/community/learning/tutorials/JXMl/unreal-engine-your-first-60-minutes-with-mass

4 Likes

Hey James.Keeling,
thank you for writing, I appreciate your work in creating this tutorial. I started it and ran into one issue.
While the first steps are working in 5.1, in 5.2 Preview 2 I ran into the issue that the EQS or MassSpawner does not select different SpawnPoints for the MassEntities, all MassEnitities are spawned in the same location. I created a short video to show the issue and the setup I have in 5.2 Preview 2. Not sure if it is an issue in 5.2 and if it is already known.

2 Likes

I too am having the same issue as ThePathfinder posted. However, I am only seeing one MassDebugVisualizer spawned in.
image

I am here to say that I have the same issue as ThePathfinder and codarth.

Hey everyone! I am looking into this issue. It seems to be caused by a change made so that Mass processors could tick inside the editor for editor utilities. We are working on a proper fix, but a workaround in the meantime is possible.

  1. Open ProjectSettings->Mass
  2. Expand the Mass Entity->Processor CDOs tabs
  3. Expand DebugVisLocationProcessor (Index 0 by default)
  4. Open the Execution Flags dropdown and check the option for Editor

Here is a screenshot of the change

Other processors are affected by this issue as well, but this is the change needed for the debug visualization to properly place the cones for the entities. The entities themselves were at the correct spawn locations as you can see if you open the GameplayDebugger and Pick an Entity. It will show a debug wireshape where the entity is, but since the DebugVisLocationProcessor is not running, the mesh to represent the entity is not moved.

I hope this helps. I will add a reply when a proper fix is added to the engine to address this bug.

4 Likes

A reply was promised, and a reply is given!

Okay. So this bug has been addressed, but it looks like 5.2 was branched before this fix was added. If you build from source, you can cherrypick this commit: [MassEntity] fixed processor execution flag for world for PIE

The workaround of adding the Editor flag will work, but is more of a hack than a fix. I do understand that it is a nuisance, and I am checking to see if we can have this fix added in a 5.2 hotfix.

2 Likes

Hi James! I cannot manage to make it work with 5.2. Everything went fine until I had to make the crowd move. They just don’t, and I cannot find out why. Any idea about what the problem could be?

Thanks a lot!

Hey there! Hate to hear that you can’t get them moving. I’m going to make this as a mini-guide for debugging Mass.

  1. In your entity config, if you press Validate Entity Config, does it give an error or report that everything is correct? Do you have all of the movement traits? Have you set the StateTree up yet? Does the spawned actor have a MassAgent component and the PuppetEntityConfig assigned?
  2. PIE the level with your entities. Open the Gameplay Debugger by pressing apostrophe (') or entering “EnableGDT” into the console. The Mass category should be enabled by default, and you should pick an entity with Shift + P and can then show the agent’s fragments by pressing Shift + G. Do you see movement and navigation fragments on the entity? You can toggle paths as well to see if it is trying to access ZoneGraph.
  3. Quit PIE. Open Visual Logger via Tools->Debug->Visual Logger or entering VisLog into the console. Press the record button and PIE the level. Let it run for a few seconds and pause the Visual Logger, there should be recorded events for the various Mass subsystems including MassStateTree. MassStateTree should breakdown the states that your entities are in and show the logic execution. Do the entries show logic entering and exiting the Root.Idling.Wander state? There should be entries for MassStateTreeSubsystem that are categorized as LogMassNavigation, do these contain information such as “Successfully requested action:EMassMovementAction”?
  4. Does the main log contain any warnings or errors?
  5. In the VisualLogger, under MassSimulationSubsystem, does the first or second entry in the time say “Discarding processors” and list movement or navigation processors? Check the next couple entries to see if any of those processors are listed as “Redirected” once the entities are spawned and relevant archetypes created.

Loving the tutorial! However I’m finding that the ZG Find Wander Target option is missing from the StateTree tasks. This is in Unreal Engine 5.2.

image

Is it missing in the latest release or am I missing an option somewhere?

EDIT: Nevermind, it appears that I needed to enable the Mass Crowd plugin. This might have accidently been left out of the required plugins section.

You are correct! I have added it to the list of required plugins in the tutorial. I am glad you are enjoying! =)

1 Like

Do you have any tips on smoothing an entities transition from one ZoneShape to another? The default implementation has them hesitate, turn around, then proceed through. I’ve messed with the movement and avoidance traits with little success.

Hi Dylan,

Could you include your ZoneGraph setup where this is happening? My guess is something is messing up around lane entry/exit points. I would need to get this reproducing locally to dig deeper into it.

-James

Edit: It appears that the issue lies with the StateTree Idle. When an entity gets to the end of a ZoneShape, it’ll trigger the OnStateComplete and progress to Idle for the set 1.5s – which makes complete sense that’s the case. I was originally thinking that it’d only occur when it reaches the end of a ZoneShape that doesn’t have any intersections.

–

Sure thing!

The issue with the entities “thinking” at ZoneGraph transitions occurs even with a basic two ZoneShape setup.

I’ve quadruple checked the configuration for the MassEntityConfigAsset for Crowd and Entity, and the StateTree to ensure that it has the same exact settings that are found within the tutorial. I’ve also adjusted the settings to fix the issue to no avail as of yet.

Note: Pedestrian is the same as Default for the Lane Profile


HQ Image

Hello! It’s seems that my actor (non-character) doesn’t rotate towards player, but if I use Debug Visualization with static mesh the primitive is orienting in a proper way. Already added Smooth Orientation Sync trait to the actor. No results :frowning: What can be the problem?

What do you mean towards the player? I’m having probably a similar problem that the actor doesn’t rotate in the walking direction. Do you have any idea?

Can you share some screenshots of your entity config and the gameplay debugger output for the entity when it is failing to orient its direction? The entity should show its direction vector when chosen in the scene with the gameplay debugger active.

Also, do you have anything showing in the logs (either regular log output or Visual Logger)?

hi all,

thanks for the walk through. Really enjoying getting exposed to all the cool stuff. I am however stuck at the moment. Orr, the mass agents are getting stuck. They will spawn, show the animation and some movement and avoidance, turning, but then after about 1 sec, they will stop moving. Console messaging says they are stuck, but I can’t find out where/why they think that have no room to move. I’ve looked at collision settings, removed the Avoidance and Nav Obstacle Traits as a test and still they get stuck. Double checked the tut here and the Zone Graph start up pages. Nothing looks off. Anyone have any ideas?

Hey POTWD! Can you post your ZoneGraph setup? Even a screenshot of the ZoneGraphData in the level would be very helpful. I would also encourage you to record this with Visual Logger and check that ZoneGraph and navigation processors are being run by Mass.

Hi! Sure, I’ll attach a few screen grabs and notes below. I’m in a better state thatn last week. I continued to noodle some values for avoidance obstacle detection distance (100 down from 400), lane width (now 300) and reduced idle stand time down to 0.1 and that seems to have made the biggest difference to keep everyone moving for testing. Some still get stuck but far far less frequently. Some are spawning in the ground for some reason as well.

My lane set up is pretty basic, just following along with basic shapes, 2 connected “U shapes”.

I stepped through the debug steps above and

  1. Config Validation - no errors
  2. Gameplay Debug - yes can see nav, movement, and zone path fragments listed.
  3. Yes, can see Visual logger data that describes state transitions.
  4. Main Console no longer shows “stuck” warnings from before.
  5. yes, many processors initially discarded then redirected.

Anyway, I guess I can keep playing with values for now. I seems like the system is connected properly and it may be a matter of dialing several numbers.

Pete




Hello James and thanks for all your wonderful work !

Your Guide an article is very very good and easy to understand,
so I really realy appreciate all your hard work.

With that said, there is one thing I miss and it would be so nice if you
could explain this in tutorial because I believe that many people
including myself would be very grateful for this.

As a filmmaker you often want to have some life in your scenes,
and for that the Mass Crowdis are perfect. In your tutorial we can
have a lot of robots (Mannequins) but if you want to have real
people like metahumans instead of the robots - how do you
implement that ? Would be nice to have a tutorial there you
use 3-4 metahumans instead of the robots.

if that is impossible - could you explain how to use 3 or 4 different
robots (Mannequins) or maybe 2 different robots (Manny and Mannequin)
to work with your solution ?

If that is impossible - couls you point me in the direction of
wht I have to do to make this possible ?

Kind Regards