Biped Crowds

The biped crowd is a special case of crowd simulation necessitated by the complex nature of legged animal movement. Biped locomotion exhibits intricate dynamics and exacting IK foot constraints. As such, the smoothly curving trajectories computed from delegate motion parameters, while suitable for birds, fish, insects, and snakes, are not rich enough to animate the microstructure of bipedal motion. Therefore, several features in Crowd are focused on the special needs of bipeds.

In order to generate the required level of nuance, animated motion clips form the basis for the repertoire of biped movements. In other words, during a Biped/Crowd simulation, the delegates have no effect over the motion of the Biped, they only set goals to be achieved using clips available in the Motion Flow graph. With this approach, known as motion synthesis, the animator can precisely control details in the motion either by using hand animation or employing motion capture to produce a set of clips that describe how a member in the crowd behaves.

For example, if you wanted to animate a crowd of marathon runners making their way through the streets of a city, you would need motion clips for various kinds of walking, running, jogging, resting, drinking water, cheering, etc. In effect, each of the motions you might expect to see in a marathon race could be represented as a clip. But motion must be more than a fragmented collection of clips. You must also consider how motions might be sequenced. Which motion transitions are possible from a given motion clip?

To best understand this process, study this topic and follow the procedure Using bipeds in a crowd simulation.

Motion Flow Network and Possible Scripts

Biped's Motion Flow functionality provides the mechanism for defining how separate motions fit together into a fluid animation. In effect, the motion flow network describes which motions can follow from other motions. Once the motion flow network is defined, a broad set of animated actions is possible by following different paths through the network. In Biped, a path through the network is called a motion flow script.

For example, shown below is a motion flow network used in the sample file walkers.max. You can find this file in the cstudio\tutorials\biped_crowds folder in your 3ds Max Design path. This folder also contains the BIP files used in the motion flow network. You can access these files only if you have installed tutorials on your hard disk. For information on installing tutorials, see the Installation Guide.

This is a fairly simple network of possible motions, because the characters can only start, stop, turn at 90 degree angles left and right (walk_L90 and walk_R90), and do an about-face (walk_180). However, for more natural crowd interaction, it's advisable to expand the motion flow network to include shorter, more finely tuned variations such as turning at 45 degree increments, moving in different directions while facing the same way, loitering motions, and moving at different speeds. The Biped Motion Library has a comprehensive list of clips for you to experiment with.

TipYou can create motion clips that curve slightly to the left and right by applying Biped's footstep-bending operation to straight-line motion clips. If the clips are motion captured, you should employ footstep extraction during import in preparation for the bending operation. Adding clips that turn slightly will let the biped crowd simulation make minute corrections in heading in order to achieve goal locations more precisely.

Motion flow graphs that work best incorporate fine-tuned transitions. A good way to check your motion-flow transitions is by building test scripts as you build the graph: Add clips to the graph, add the necessary transitions, and optimize the transitions. Optimizing transitions works well as a starting point and, more often than not, produces the smoothest transitions. Next, make a new script that uses your transitions, and use the script to tweak the motion flow until the feet don't slide.

The Shared Motion Flow Networks feature lets many bipeds use a single motion-flow network. Therefore, it’s practical to make motion-flow networks large without taxing your computer's memory.

Delegate-Directed Behavioral Goals

You can give a biped a behavioral goal by associating it with a delegate in the Crowd system, and then assigning behaviors to the delegate.

For example, in the walkers.max sample, the behavioral goals of each of the biped's delegates are to:

During a biped crowd simulation, character studio attempts to compute the best motion flow script for each biped member of the crowd that satisfies the behavioral goals of its associated delegate. In other words:

So in the walkers.max sample, the simulation will always choose the best available walking clip in the network that directs the biped's delegate toward the sphere. Each biped's script evolves as the crowd "Solve" computes. This is somewhat like a real-time "game engine" in that the crowd solver’s choice of the next best clip for a given biped is restricted by that biped's currently active clip.

Biped Crowd Avoidance, Priority, and Backtracking

Because bipeds in crowds are always following motion flow scripts, the avoidance behavior for bipeds works differently. Unlike ordinary delegates, biped delegates can move only along motion flow-scripted paths, so if a collision takes place, character studio will backtrack to the previous clip in the current script and find another path. This may take some time to compute when complex crowd interactions are present since a single backtrack may not be enough. The computation will explore all paths from a given backtracking clip, and if that fails, it will backtrack to the previous clip, and so on, until a solution is found.

In the example, if the current script of a biped is:


and a collision is encountered during the walk_L90 clip, the biped will backtrack to the end of the walk clip and attempt to try a different clip in place of the failed left turn. If that fails, it will try the next best choice, and so on.

TipThe inclusion of stopping and loitering motions in the motion flow network is sometimes helpful in preventing excessive backtracking since stopping is always an effective way to avoid collisions in a tight situation. In general, the more variation in speed and direction that is possible, the more quickly the backtracking feature will find a solution.

In order to make the backtracking computationally manageable, the biped crowd members are computed one at a time, in order of priority. Thus, the crowd interaction is accumulated with each successive biped added to the animation. In other words, each waits its turn to compute its complete animation, which entails avoiding the bipeds that have been computed before it. It follows that bipeds with the lowest priorities generally encounter the most collisions, since they must steer around all the bipeds that have higher priorities.

Preparing Characters for a Biped Crowd

To create a biped crowd simulation, you will need several bipeds. Because the crowd simulation factors in each biped's leg length when applying clips to the biped, your simulation will be more accurate if your bipeds are the correct size from the start.

One straightforward workflow would be:

This setup makes it easy to merge the characters into the crowd scene. When characters are merged, the meshes themselves will be hidden, which will improve system performance.

Preparing Motions for a Biped Crowd

The clips you use for a biped crowd simulation can be loaded from the CD that comes with character studio, imported from motion capture files, or created from scratch.

The integrity of transitions between clips in the motion flow network is very important when creating a biped crowd simulation. When creating transitions for a single biped, it's a simple matter to correct individual transitions after the motion flow script has been created. With a crowd, having to correct transitions for each biped after the simulation is complete would be extremely time-consuming. It is much more efficient to ensure your transitions are correct before starting to solve the simulation.

One way to make this process easier is to set up all motions so each has an ideal transition of exactly the same number of frames, such as 10 or 15. Then you can optimize transitions for this length, and all or most transitions will work flawlessly.

To check transitions, create a simple script for one biped using several transitions in the graph. Check the motion and work with transitions individually until they look right. You might not catch all bad transitions with this method, but you'll catch most of them. A “bad” transition would be one where the feet skip or hop when they should be walking, or any other undesirable change that occurs during a transition. See Customizing Transitions.

After solving the biped crowd simulation the first few times, check again for bad transitions you might have missed the first time around. After a few simulations, most likely you will have found all or nearly all the bad transitions.


Some features of the crowd system are not designed to work with biped crowds. These behaviors and parameters have no effect on the crowd's movements when bipeds are used with the simulation.

Procedures: Using Bipeds in a Crowd Simulation

The following sequence of procedures gives the basic steps for creating and saving a motion flow graph, assigning several bipeds to delegates, and then sharing the motion flow graph among the bipeds so that character studio automatically creates separate motion flow scripts for each biped, based on the behaviors assigned to its delegate.

NoteThese procedures assume you know how to animate bipeds with footsteps and keyframe methods, and save the animations as BIP files. To prepare for using Shared Motion Flow, you should create and save a range of biped motions such as start, walk, turn right, turn left, stop, and wait. See Loading and Saving BIP Animation.

The first step is to create an appropriate motion flow graph and save it to disk.

To create the shared motion flow:

  1. Add a biped, and then go to the Motion panel.
  2. On the Biped rollout, click (Motion Flow Mode).
  3. On the Motion Flow rollout, click (Show Graph).
  4. On the Motion Flow Graph toolbar, click (Create Multiple Clips).

    This displays an Open dialog that lets you select any number of BIP files from the same directory to add simultaneously to the motion flow graph. Use Click+Shift+click (click, and then Shift+click) to choose several contiguous files, and Ctrl+click to choose non-contiguous files.

  5. Choose the BIP files you want character studio to use for motion synthesis, and then click the OK button.

    The files are added to the graph as clips. Each clip is automatically named after the file from which it's derived.

    NoteFor best results, especially with simulations in which bipeds are to turn at different angles, use as many different turning clips as possible. A minimal setup would include separate left-turn and right-turn walks at angles of 45, 90, 135, and 180 degrees.

    The next step is to add transitions among the clips so character studio knows which actions can proceed to and from other actions. You can do this manually for greater control, but for initial testing, you can save time by letting character studio add and optimize transitions automatically.

  6. Click (Synthesize Motion Flow Graph). This uses the first 30 percent and the last 30 percent of each motion to create transitions.

    The graph now shows arrows to and from each clip, as well as from each clip to itself. If you like, delete transitions that obviously don't belong, such as the ones from the stop and start clips to themselves.

    Alternatively, you can use (Create Transition) to set up a custom graph.

  7. Optimize the transitions. See Transition Optimization Dialog.

    When you solve the simulation, Crowd automatically generates a motion flow script for the biped, based on this graph. When you have a graph with multiple clips, as in this case, it chooses the starting clip for the script from one or more clips you designate as random start clips.

    If you want to check the integrity of transitions before continuing, do so now. See Customizing Transitions.

  8. Click (Select Random Start Clips), and then click a clip.

    This tells character studio to start the script with this clip, and uses the default probability of 100 percent that the clip will be chosen.

    If you want the various bipeds to start with different clips, select multiple random start clips by pressing and holding the Ctrl key as you click. The default Random Start Probability setting of 100 for all clips means that character studio will choose randomly among them for a starting clip for each biped's script.

    To change the likelihood of starting with specific clips, right-click a clip and modify its Random Start Probability setting. For example, say you want to start each biped's script with any of three clips: clips A, B, and C. You want clip A to be chosen twice as often as clip B or C. In that case, using the Random Start Clips tool, you'd first click clip A, and then Ctrl+click clips B and C. Then you'd right-click each in turn, assigning a Random Start Probability of 60 to clip A, and 30 to both clips B and C.

    NoteThe Probability values are arbitrary; what counts is their ratios. For example, values of 80/40/40 or 20/10/10 would work the same.
    NoteYou can also set and change random starting clips and start probabilities in the Motion Flow graph after loading the MFE file into the Shared Motion Flow dialog, described later in this procedure.
    NoteIf a motion flow script already exists for a biped, for example after you've solved a crowd simulation, character studio can use the first clip in the script for subsequent solutions.
  9. On the Motion Flow rollout, click (Save File), and save the graph in the MFE format.

    The next step in using bipeds in a crowd simulation is to create the simulation.

To set up the crowd simulation:

  1. Reset 3ds Max Design.
  2. Set up a crowd simulation with any number of delegates, using behaviors appropriate to the crowd scene you want to create. Do not use bipeds at first; work with delegates only to rough out the motion of the crowd members.
    TipWhen first starting out with motion synthesis, use smaller crowds of eight or so delegates.
  3. Solve the simulation and adjust the settings as necessary to obtain the desired motion.
  4. Merge bipeds and characters into the scene, and associate each delegate with a different biped using the delegate's Motion Parameters rollout Biped group settings.

    You must select the biped's center of mass (COM) object (typically named Bip0#), as indicated by the mouse cursor turning into a crosshairs icon when it's over the COM in the active viewport.

  5. Turn on Use Biped for each delegate.
    TipTo link up any number of delegates with bipeds, all at the same time, select the Crowd helper object and click the Setup rollout (Biped/Delegate Associations). Use the dialog to connect the pairs and turn on Use Biped for each delegate. See Linking Objects to Delegates.
  6. Set the biped/delegates to use a random start clip as the first clip. You can set this simultaneously for multiple delegates with the Edit Multiple Delegates dialog.

To apply the shared motion flow:

Next, you use the Shared Motion Flow function to apply the saved motion flow graph to the bipeds.

  1. Select any biped and go to the Motion panel.
  2. On the Biped rollout, click (Motion Flow Mode).
  3. On the Motion Flow rollout, click (Shared Motion Flow).
  4. In the Shared Motion Flow dialog, click the New button.

    This creates a new shared motion flow and assigns it a default name. You can change the name if you like.

    Next, load a motion flow file.

  5. Click the Parameters group Load .mfe button, and use the Open dialog to load a motion flow file. Typically, this would be the one you saved earlier in the procedure.

    Next, specify the bipeds that will share this motion flow.

  6. In the Parameters group, click the Add button, and use the Select dialog to specify the bipeds that will share the motion flow.

    For your convenience, the Select dialog shows only center of mass objects for the bipeds in the scene.

    After you click the Select button, the bipeds appear in the dialog, in the list under "Bipeds Sharing this Motion Flow."

  7. To correctly share a motion flow, bipeds' legs must be scaled the same. If any of the bipeds are scaled differently than the one you started with, an alert appears, and then, when you click the OK button in the alert box, the wrong-scale bipeds are noted as such in the list. At this point, you can select one of the bipeds in the list, and then click the Set Shared Motion Flow Scale button to match the others' scale to that biped. Or you can click one of the Reset Wrong Scales buttons to rescale the wrong-scale bipeds or just their legs. Be sure to take one of these measures before proceeding.

    One more step in the Shared Motion Flow dialog is necessary: You must activate Motion Flow mode for all the bipeds sharing the motion flow. A special button in the dialog lets you perform that action in one step.

  8. Click (Put Multiple Bipeds In Motion Flow).

    This activates Motion Flow mode for all the bipeds sharing the motion flow.

  9. Click the OK button to exit the dialog.

To offset the delegates and test the simulation:

Delegate-controlled bipeds can begin their animation with their motion flow scripts' first clip, if it exists, or with a random motion clip. But when you load a motion flow file into the Shared Motion Flow dialog, any scripts in the file are ignored. Thus, delegate-associated bipeds using motion flow in an unsolved crowd simulation have no existing scripts, and you must specify that they use the random start clip that you set in the motion flow. You do this via the delegates.

  1. Use the Edit Multiple Delegates dialog Biped group to specify Random Start Clip for all the delegates.

    Solve the simulation.

  2. Select the Crowd object, and go to the Modify panel.
  3. In the Solve rollout, set the desired End Solve frame.
  4. Click Solve to run the simulation.

    Crowd solves the simulation.

  5. Check the solved simulation by dragging the frame slider and/or playing back the animation.

To fine-tune the simulation:

Chances are good that adjustments will be required. You can resolve problems in a number of different ways: Change the behavior and/or motion flow setups, change delegate parameters, and so on.

If you find that bipeds are colliding and interpenetrating, you can take advantage of Crowd's special Priorities and Backtracking features. In fact, it is strongly recommended that you use both options for most Crowd/Biped simulations.

  1. Use the Priority rollout controls for assigning different priorities to your delegates. Typically, delegates at the head of the crowd should have the highest priorities (that is, the lowest Priority settings).
  2. In the Solve rollout Bipeds group, turn on Biped/Delegates Only, then turn on Use Priorities, and then turn on Backtracking. If you've solved previously, it's a good idea to turn on Delete Keys Before Solve as well.

    Now, when it solves the simulation, Crowd solves for one biped/delegate at a time, starting with the lowest-priority biped/delegate. As it solves for each subsequent biped/delegate, it looks for collisions, and when the occur, it backs up the solution to the end of the previous clip, and if necessary, previous clips, and then tries different paths through the motion flow graph. This method can take longer, which is why Backtracking is off by default, but it's often the best way to resolve problems with colliding bipeds.