Step 5: View your simulation - AWS SimSpace Weaver

Step 5: View your simulation

The SimSpace Weaver app SDK provides different options to view the sample application. You can use the sample console client if you don't have any local support for Unreal Engine development. The instructions for the Unreal Engine client assume that you are using Windows.

The console client displays a list of entity events as they occur. The client gets the entity event information from the ViewApp. If your console client displays the list of events, then it confirms network connectivity with the ViewApp and activity in your simulation.

The PathfindingSample simulation creates stationary and moving entities on a 2-dimensional plane. The moving entities move around the stationary entities. The Unreal Engine client provides a visualization of the entity events.

Windows console client
Requirements
To connect to the sample application with the sample console client
  1. In a command prompt window, go to the folder for the console client (in the app SDK folder).

    cd sdk-folder\packaging-tools\clients\PathfindingSampleClients\ConsoleClient
  2. Use CMake3 to create a Visual Studio solution in this folder.

    cmake .
    Note

    Make sure to include the space and period at the end.

    Important

    Keep the command prompt window open for further steps.

  3. In Visual Studio, open the PathfindingSampleConsoleClient.sln that you created in the previous step.

  4. Select the RelWithDebInfo build configuration.

  5. Choose Build > Build Solution.

  6. In your previous command prompt window, go to the build output folder in the folder for the console client.

    cd RelWithDebInfo
  7. Run the client with the IP address and port number of your ViewApp.

    .\ConsoleClient.exe --url tcp://ip-address:port-number

    Your command prompt window should display numbers for entity update, delete, and create events, similar to the following example output.

    Note

    The IP addresses and port numbers in the following example output are placeholders. Provide the IP address and port number of your ViewApp to the console client. Provide the Actual port number if you want to connect to a ViewApp that runs in the AWS Cloud. Provide the IP address and port number 127.0.0.1:7000 when you connect to a ViewApp that runs on your local system. For more information, see Local development.

    
    ##PathfindingSample#ViewApp Message Reader##
    
    Added argument url:tcp://198.51.100.135:4321
    Some subscription arguments are missing, restoring defaults.
    
    *****
    Sample usage without a MoveStrategy:
    ConsoleClient --url tcp://198.51.100.135:4321 --subs-center-x 600 --subs-center-y 500 --subs-radius 50
    Sample usage with CircleMoveStrategy:
    ConsoleClient --url tcp://198.51.100.135:4321 --subs-center-x 600 --subs-center-y 500 --subs-radius 50 --subs-move-strategy circle --circle-center-x 500 --circle-center-y 500 --circle-speed 0.001
    
    *****
    Starting NNG client. NNG version: 1.2.4
    Creating socket ...done.
    Connecting to View App ... done.
    Initiating connection to tcp:// 198.51.100.135:4321 ... done.
    
    Receiving messages ...
    [2022-10-04 19:13:00.710] CreateEntity Count: 72
    [2022-10-04 19:13:00.756] UpdateEntity Count: 42
    [2022-10-04 19:13:00.794] DeleteEntity Count: 72
    [2022-10-04 19:13:03.690] CreateEntity Count: 11
    [2022-10-04 19:13:03.725] UpdateEntity Count: 2
    [2022-10-04 19:13:03.757] UpdateEntity Count: 2
    [2022-10-04 19:13:03.790] UpdateEntity Count: 2
    
    
    Note

    For troubleshooting guidance, see PathfindingSample console client fails to connect.

  8. Press CTRL +C to quit the console client.

Linux console client
Important

We provide these instructions for your convenience. They might not work in some Linux environments. These procedures are unsupported.

This procedure assumes that you are working entirely within a Linux environment. You can also view your simulation using clients built in Windows.

Requirements
  • CMake3

  • C compiler (already included in Amazon Linux 2)

  • Git

To connect to the sample application with the sample console client
  1. At a Linux shell prompt, go to the folder for the console client (in the app SDK folder).

    cd sdk-folder/packaging-tools/clients/PathfindingSampleClients/ConsoleClient
  2. Create a build folder.

    mkdir build
  3. Go to the build folder.

    cd build
  4. Use CMake3 to build the client.

    cmake3 ../ && cmake3 --build .
    Note

    Make sure to include the space and period at the end.

  5. Run the client with the IP address and port number of your ViewApp.

    ./ConsoleClient --url tcp://ip-address:port-number

    Your command prompt window should display numbers for entity update, delete, and create events, similar to the following example output.

    Note

    The IP addresses and port numbers in the following example output are placeholders. Provide the IP address and port number of your ViewApp to the console client. Provide the Actual port number if you want to connect to a ViewApp that runs in the AWS Cloud. Provide the IP address and port number 127.0.0.1:7000 when you connect to a ViewApp that runs on your local system. For more information, see Local development.

    
    ##PathfindingSample#ViewApp Message Reader##
    
    Added argument url:tcp://198.51.100.135:4321
    Some subscription arguments are missing, restoring defaults.
    
    *****
    Sample usage without a MoveStrategy:
    ConsoleClient --url tcp://198.51.100.135:4321 --subs-center-x 600 --subs-center-y 500 --subs-radius 50
    Sample usage with CircleMoveStrategy:
    ConsoleClient --url tcp://198.51.100.135:4321 --subs-center-x 600 --subs-center-y 500 --subs-radius 50 --subs-move-strategy circle --circle-center-x 500 --circle-center-y 500 --circle-speed 0.001
    
    *****
    Starting NNG client. NNG version: 1.2.4
    Creating socket ...done.
    Connecting to View App ... done.
    Initiating connection to tcp:// 198.51.100.135:4321 ... done.
    
    Receiving messages ...
    [2022-10-04 19:13:00.710] CreateEntity Count: 72
    [2022-10-04 19:13:00.756] UpdateEntity Count: 42
    [2022-10-04 19:13:00.794] DeleteEntity Count: 72
    [2022-10-04 19:13:03.690] CreateEntity Count: 11
    [2022-10-04 19:13:03.725] UpdateEntity Count: 2
    [2022-10-04 19:13:03.757] UpdateEntity Count: 2
    [2022-10-04 19:13:03.790] UpdateEntity Count: 2
    
    
    Note

    For troubleshooting guidance, see PathfindingSample console client fails to connect.

  6. Press CTRL +C to quit the console client.

Unreal Engine on Windows
Requirements
  • Unreal Engine 5 development environment

  • Microsoft .NET Framework 4.8 Developer Pack

  • Windows console client (see the Windows console client tab on this page)

Important

Other versions of Unreal Engine and .NET are not supported and might cause problems.

To connect to the sample application with the sample Unreal client
  1. The Unreal Engine client uses the NNG library from the console client. You must build the console client for Windows if you haven't already built it. For more information, see the Windows console client tab on this page.

  2. In a file manager window, go to sdk-folder\packaging-tools\clients\PathfindingSampleClients\UnrealClient.

  3. Open UnrealClient.uproject.

  4. If the editor asks you if you want to rebuild the UnrealClient modules, choose yes.

  5. In a text editor, open sdk-folder\packaging-tools\clients\PathfindingSampleClients\UnrealClient\view_app_url.txt.

  6. Update the URL with the IP address and port number for your view app: tcp://ip-address:port-number (it should look like tcp://198.51.100.135:1234).

  7. In Unreal editor, choose play.

Your Unreal editor should display a visualization of the simulation, similar to the following screenshot.


            The view displayed in the Unreal editor showing cubes and moving
              spheres on a plane.
Note

Depending on the power of your local development system, it could take a few minutes for the Unreal editor to display the simulation. During this time, the system might appear to freeze.

Use the W, A, S, D keys to move in the Unreal client. Hold the mouse button and drag the mouse to turn.

You can press the [ (left square bracket) key to decrease the size of the subscription area. You can press the ] (right square bracket) key to increase the size of the subscription area. The size of the subscription area determines the number of entities that appear in the client.

You can press the C key to create an entity in the simulation. The client sends a CreateEntity command to the view app. The view app will then create the entity and transfer it to the spatial domain.

You can examine the code for ViewAppDriver::HandleEntityCreationRequests in project-folder\src\PathfindingSample\ViewApp\Driver\ViewAppDriver.cpp to see how the app implements this process.