Populating City Streets

Walking characters can easily be setup to populate streets and squares, resulting in realistic crowded urban environments. In this tutorial, we will go through the setup of walking characters using Navigation and Locomotion Behaviors.

Initial Setup

In this example, we use a simple plane geometry drilled in some places, in order to represent different walking areas. Any geometry with navigable areas can be used as well.

We also need to create an EntityType (using the EntityType icon ), which skeleton and skeleton mapping will be the one provided in the Samples Pack. See the Quick Start for more details about how to create an EntityType.

Create A Terrain

Select the navigable geometry and click on the NavMesh Creator icon to compute the navigation information and save it into a .gse file, using the "Compute and save ..." button. In Maya viewport, the navigable areas are now delimited by red borders (use Terrain Display Attributes to show/hide it) .

Default computation parameters should be fine.If not, have a look at the NavMesh Creator Parameters to properly compute navigation mesh.

Placement

Click on the Population Tool icon  then click in the center of the scene to place population around it. Then adjust the placement settings:

  • Change the distance and grid attributes to cover the entire scene (use a high distance value to avoid entities to be generated too close to other ones);
  • Adjust the number of particles as desired;
  • Adjust orientation noise (set maximum value to orient entities in all directions);

Once the population is properly placed, click on the "Create" button in the Population Attributes of the Population Tool. When playing the simulation, Characters should now appear.

Navigation Setup

Now, we have to setup entities navigation by defining for each of them a target, then by assigning them Behaviors to make them reach this target avoiding other entities.

Target Setup

Navigation targets are setup using a Population Tool. First, hide the Population Tool previously used to place entities at start, in order to avoid confusion with the new Population Tool we are about to create and use to place entities targets.

Only hide the Population Tool previously created, not the generated  particle system. Otherwise, the generated entities will no longer be displayed.

Create and configure a new Population Tool as previously described, with a number of particles equal or greater than the number of  simulated entities (notice that adjusting orientation is useless, only particles position is used for navigation purpose). Once done, just click on the "Emit particles" button in the Population Attributes of the Population Tool: the generated particle system will then then be used as target in Behaviors.

Behaviors Setup

Open the Behavior Editor using the Behavior Editor icon  then double-click on the available EntityType to open the tab corresponding to the behavior of the characters related to this EntityType. To drive an entity to a target in the generated particle system, it needs on parallel:

To do so, create a Parallel Operator and fill it with a Navigation Behavior and a GoTo Behavior (or just create a Navigation Behavior and drag'n drop a GoTo Behavior over it).

Now, we just have to set the generated particle system as target for GoTo Behavior. Just click the GoTo Behavior, then set the "Target Mode" option to "Target Particle System" value, and set the generated particle system to the "In Particle System" attribute.

The "Random Target in Environment" target mode can be used instead, but declaring a target particle system provides more control and visibility.

Now when playing simulation, characters are moving to a given target and avoiding other entities, but they are still not animated with walk motions.

Locomotion Setup

A Locomotion Behavior is needed to use animate characters with walking motions according to navigation controls. A custom Locomotion Behavior is provided in Samples Pack, along with a set of walk motions especially design for locomotion (meeting the requirements described here). 

Open the /scene/locomotion.ma file from the sample files, and load the Behavior Editor. Locate the Locomotion Behavior and Right-click on it to open the contextual menu and choose "Save". Note that when creating your first Custom Behavior, a dialog may pop up asking you where Golaem Crowd should save all your Custom Behaviors.

Open your own scene, and go to the Behavior Editor to import the Custom Locomotion Behavior and add it to the existing Parallel Operator (using drag'n drop).

The newly Custom Locomotion Behavior is properly configured using the provided set of walk animations.

The .gmo motion files provided in Samples Pack are used and configured in the imported Locomotion Behavior settings as shown below. Notice that:

  • All the provided animations can be used on the provided character/skeleton with the same .gmm animation mapping file.
  • All the provided animations are used, except the run animation. It uses a walk fast animation speed up by a x1.30 ratio instead to avoid characters running when they need to go very fast and obtain a smoother animation. To use the run animation, just use the run animation in its place with a x1.00 ratio, or add it to the list of motions to use them both.
  • Turning and standing orientation animations are only provided in one version, e.g. right turns and left standing orientations. The icon adds both original and mirrored animations.

Now when playing simulation, characters are properly navigating and walking.

Rendering

See Using The Samples Pack to know how to automatically configure the sample for rendering.

For more details, check the Rendering section.