Player Location in an Open World
Jump to navigation
Jump to search
Since agents run in steps, we can easily monitor to see if a trainee moves steadily through a sequence of steps without missing one, but what if we want to monitor the trainee's actions in an open world scenario? Here we will go through a simple sequence of Cyclic Steps that will leave us with an example of how we can monitor the trainee's open world actions, even while we have them following our structured Virtual Instructor agent.
In this session we'll create an agent that continuously tells the trainee whether they are at a safe distance from the crate while also going through a couple different simple steps for the trainee to complete.
- First we should add a Hummer and a Crate to the scenario so go to View > Entity Type, search for Hummer in the "Find" box, then drag and drop the Hummer that you want into the scenario. Follow the same instructions to add a Crate.
- Next, since the Hummer is the one we are going to be controlling, that's where we want to add a Virtual Instructor agent, so make sure the Hummer is selected and go to the Agents tab in Entity Settings. Right-click in the blank area and select New > Virtual Instructor.
- Now the first thing we'll do is set up the cyclic steps to run continuously in the background. Refer to this tutorial and follow it thoroughly to get the first cyclic step set.
- Since we now have a cyclic step that will make the Crate explode if we're within 10 feet, we also want to go ahead and make a cyclic step that will give us some kind of warning. So add a new step, right-click on the step name and select Do Cyclic. Now right-click Instructions > Add Flow Control > Continue, then right-click Relative To > Set Relative Entity and select the Crate. As you can see, we're setting the step up almost exactly like the one above it, the only difference is that this step is just a warning. So let's continue and right-click where it should now say Relative to "Crate 1 1" > Add Attribute and select ATT_GET_DISTANCE_FROM_ENTITY_METERS but this time we'll set the range to be 0 < X < 50, giving it a larger perimeter.
- Next, right-click Continue > Instructional Aids > VI Guidance and add some dialogue telling the trainee to keep their distance from the Crate. (Be sure to check Display Continuously in the VI Guidance).
- Finally right-click the VI Guidance and add a small Timeout.
- We also want to give the trainee dialogue when they're at a safe distance from the Crate so we'll create another step to do just that. The good thing about this, is that since it's simply a few small changes from this last step, we can copy and paste this step and make the changes there. So make sure you have this step selected and use the CTRL C and CTRL V functions to create a new step and place it just below the original.
- There are two things we need to change in this step. First, right-click on the attribute ATT_GET_DISTANCE_FROM_ENTITY_METERS and change the range to 51 < X < 9999. This just changes the step to monitor for any time when the trainee is out of the range of the other cyclic steps.
- Next we must change the dialogue to match the new conditions, so right-click on the VI Guidance > Edit and change the dialogue to tell the trainee that they are at a safe distance from the Crate. These two new steps should now look like this.
- Now that we have all of those cyclic steps running in the background, let's set up the steps where we actually instruct the trainee. Let's create a new step, keeping in mind that since this step will not be cyclic, it will be the first step that the trainee actually sees happening.
- Once we've created the new step, right-click on Instructions > Instructional Aids > VI Guidance and add some dialogue telling the trainee to stay away from the Crate.
- Next, repeat the step and tell the trainee to put on the parking brake.
- Now right-click on Instructions > Add Flow Control > Continue and right-click Status. Here we'll set the agent to monitor for whether the parking brake has been set or not, so select the attribute ATT_IS_PARKING_BRAKE_ON and set it to Check if Equal to True.
- After this, we'll set a dialogue to tell the trainee that they've done the correct actions, so right-click on Conditions > Instructional Aids > VI Guidance and tell them they've set the parking brake
- The final step should look something like below. It's important to keep in mind that this is just an example of how the agent can perform these actions. You could set multiple Crates/ Vehicles/ whatever entities you want to explode/ move/ react however you deem necessary if our trainee encounters them in the scenario. And all of this can be calculated while running a "normal" training sequence like waiting for the trainee to set their parking brake.


