Associating Bipeds with Delegates
 
 
 

In this lesson, you'll associate each biped in the Brown and Black families with its corresponding delegate. You'll also set up a motion flow graph so each character can choose from the same batch of motions over the course of the simulation.

The behaviors in the crowd simulation are set up to make the delegates wander around a camp, seeking the center of the camp and other members of their families.

This series of lessons assumes a basic knowledge of the crowd and motion flow systems. If you haven't done the tutorials Animating Crowds and Using Motion Flow , do these tutorials before proceeding.

Set up the lesson:

  1. Load the file tut_biped_crowds01.max.

    This file contains a crowd scene with six delegates and a ground plane. The delegates on one side represent the Black family, while the others represent the Browns. At the center of the ground plane is a box that represents the center of the pandas' camp.

  2. Select the Crowd helper in a viewport, and go to the Modify panel.
  3. On the Setup rollout, click Behavior Assignments. The Behavior Assignments and Teams dialog appears.

    Behaviors have been set up to make the mama and baby bears seek their respective fathers, who wander from time to time. They all seek the box in the center to a small degree, which keeps the delegates from wandering too far away from the camp. An Avoid behavior prevents collisions between all delegates.

  4. Click OK to close the Behavior Assignments and Teams dialog.
  5. Play the animation.

    Even though there are no bipeds in the scene yet, the simulation has been solved with just the delegates. The two sets of delegates alternately mingle in the center and wander off as a family group.

    Tip It's a good practice to test the simulation with delegates only, to ensure the behaviors are all working correctly. A common error is to test behaviors with delegates moving at high speeds that do not accurately approximate the speed of biped movement. Test the behaviors with the delegates' average speed similar to speed the bipeds will use. You can change all the delegates' average speed by selecting the Crowd helper, and clicking Modify panel > Setup rollout > Multiple Delegate Editing. In this simulation, the average delegate speed is 2 units per frame.

Merge the characters:

Pair up bipeds and delegates:

  1. Select the Crowd helper.
  2. On the Modify panel, in the Setup rollout, click the Biped/Delegate Associations button.
  3. Beneath the Bipeds list, click the Add button. Select all the bipeds in the scene.

    The selected bipeds display on the dialog in alphabetical order. You want the papa biped to be listed first for each family.

  4. Highlight Black_Papa_Biped, and use the up arrow button at the center of the dialog to move that biped to the top of the list. Use the same technique to move Brown_Papa_Biped to the fourth position, above the two other Brown family bipeds.

  5. Beneath the Delegates list, click the Add button. Select all the delegates.
  6. Make sure the Make Specified Associations option is selected.

    This will associate each biped with the delegate directly across from it on the list.

  7. Make sure Set Delegates to Use Biped is turned on.

    This option will turn on the Use Biped option for each delegate in the scene, which will make it possible to create a biped crowd simulation.

  8. Click the Associate button to associate the bipeds with delegates.
  9. Save the scene as my_biped_crowds02.max.

    Although each biped is now associated with its respective delegate, the bipeds are not aligned with delegates. This will happen later once you solve the simulation for the first time. Before you can solve the simulation, however, you'll need to set up a motion flow graph.

Set up a motion flow graph:

You'll set up a motion flow graph that they'll all share, also known as a shared motion flow. When solving a simulation with delegate-controlled bipeds, Crowd uses this graph to synthesize motion flow scripts for the bipeds. The motion is shared, but Crowd typically generates a unique script for each biped, depending on the behaviors influencing its delegate. This process is motion synthesis.

Tip Before creating the motion flow graph, you might find it helpful to look at each of the clips to see what they contain. To do this, reset 3ds Max, create a biped, and load each clip listed in step 5 by clicking Load File on the Biped rollout. Watch the motion contained in each clip. When you have finished looking at the motions, reload my_biped_crowds02.max or tut_biped_crowds02.max , and continue from this point.

  1. Select any part of one of the bipeds, and go to the Motion panel.
  2. Click the Motion Flow Mode button.
  3. In the Motion Flow rollout, turn on the Show Graph button.

    This opens an empty motion flow graph. As a first step in creating the motion flow graph, you'll add all the necessary clips.

    Note If you like, instead of creating the motion flow graph from scratch, you can click Load Motion Flow Graph and load the file panda_crowd.mfe file in the tutorials\character_animation\biped_crowds folder. If you do, the Reset Unfound Motion Flow File dialog might appear to ask you for the location of the first clip referenced by the graph. If this occurs, navigate to the tutorials\character_animation\biped_crowds folder under your 3dsmax path, turn on Add Directory to Search Path and Add Directory to .ini File, and choose the first file requested. The remaining clips will be located in the same folder, and the graph will load. If you do this, skip this procedure and the next, and continue with the “Choose starting clips” procedure to ensure starting clips are selected.
  4. On the Motion Flow Graph dialog toolbar, click the Create Multiple Clips button.
  5. Navigate to the tutorials\character_animation\biped_crowds directory in your 3ds Max path, and open the following files.
    TipYou can select multiple files in the Open dialog by using the SHIFT or CTRL keys.
  6. If you like, use the Move Clip tool to rearrange the clips in the graph in a circular arrangement.
    TipThe arrangement of clips in the graph does not affect the simulation, but it can help you see your graph more clearly. For this graph, a roughly circular arrangement with panda_walk.bip , panda_walk_fast.bip , and panda_walk_slow.bip at the top will make it easy to see all the clips and transitions, and to choose starting clips.

Create a motion flow network:

A motion flow network is a series of connections between clips. When the crowd simulation solves, it will choose a series of clips for the biped to follow. Transitions between clips tell the crowd simulation that one clip can follow another in the series.

  1. On the Motion Flow Graph toolbar, click Select Clip/Transition.
  2. Draw a selection region around all the clips to select all of them.
  3. Click Create All Transitions. When you are asked if you want to create transitions from each clip to itself, click Yes.

    Transitions are created between all clips, and between each clip and itself.

    Tip You can toggle the probability display by clicking Show Random Percentages. The number 100 appears next to and between each transition to indicate the probability of each transition being chosen during the transition.

    Next, you will optimize the new transitions. This will change each default transition to the best possible transition for each pair of clips.

  4. Draw a selection region around all clips and transitions to select them. Click Optimize Transitions. Accept the default values and click OK. Wait a few moments while transitions are optimized.

Choose starting clips:

Next, you must designate the possible starting clips for the simulation.

NoteIf you loaded the motion flow graph panda_crowd.mfe instead of creating the graph from scratch, the starting clips might or might not be selected depending on whether the system had to look for clips upon opening the graph. In this case, use this procedure to ensure the starting clips are selected.
  1. In the toolbar at the top of the Motion Flow Graph dialog, click the Select Random Start Clips button. Hold down the CTRL key and choose panda_walk, panda_walk_fast, panda_walk_slow, and panda_loiter.

    The selected clips are displayed in purple with a probability value (100). This means there is an equal probability that any one of these clips will be selected as the starting clip for the simulation.

    The selection of panda_loiter as a possible starting clip means a biped can start the simulation by standing and waiting for other bipeds to pass by before it starts moving.

    Next, to share the motion flow network among all the bipeds, you need to save it and then reload it with the Shared Motion Flow dialog.

  2. On the Motion panel, In the Motion Flow rollout, click the Save File button. Save the motion flow network as my_panda_crowd.mfe.

    Next, you'll set up a shared motion flow.

Set up a shared motion flow:

The motion flow graph must be “shared” among all bipeds. For the best results, each biped sharing the motion should be of the same scale. The black and brown fathers are the same size, as are the two mothers and two children. You'll create three separate motion flows, pairing up father, mother, and child bipeds.

  1. In the Motion Flow rollout, click the Shared Motion Flow button.
  2. In the Shared Motion Flow dialog, click the New button to add a shared motion flow, and change its name from SharedMoFlow0 to Fathers.
  3. In the Shared Motion Flow dialog, click the Add button, and use the Select dialog to add Black_Papa_Biped and Brown_Papa_Biped to the shared motion flow.

  4. In the Parameters group, click the Load .mfe button, and open the my_panda_crowd.mfe file you saved previously. Wait a few moments while the graph loads.
  5. Click Put Multiple Bipeds In Motion Flow.

    This turns on Motion Flow mode for the bipeds listed in the dialog. Bipeds must be in Motion Flow mode in order to work with a crowd simulation.

  6. Click OK to close the dialog.

Set up the remaining shared motion flows:

  1. Click Shared Motion Flow again.
  2. Click New to create another shared motion flow named Mothers, and apply it to Black_Mama_Biped and Brown_Mama_Biped. Put these bipeds in Motion Flow mode, and click OK to close the dialog.
  3. Click Shared Motion Flow again. Create another shared motion flow named Children, and apply it to Black_Baby_Biped and Brown_Baby_Biped. Put these bipeds in Motion Flow mode.
  4. Click OK to exit the dialog.

    The Shared Motion Flow button appears with a white circle, indicating that the currently selected biped is part of a shared motion flow network.

  5. Close the motion flow graph, if it is open.
  6. Save your work as my_biped_crowds03.max

Next

Setting Up Behaviors