Integration Phase 1d: Setting up Visual Debugging

The live visual debugging capabilities of the Navigation Lab are crucial to ensuring the success of your integration, and your usage of Autodesk Navigation in general.

For example: [code from Tutorial_FirstIntegration.cpp]

bool MyGameWorld::Initialize(bool doVisualDebugTutorial)
{
    ...
    const KyUInt32 databaseCount = 1; 
    m_navWorld = *KY_NEW Kaim::World(databaseCount);
    
// Visual debugging is disabled in Release builds. Even though the symbols and functions are available, they do nothing.
// Guarding this code is not necessary, but is recommended in order to prevent useless computations.
    KY_UNUSED(doVisualDebugTutorial);
#ifndef KY_CONFIG_RELEASE
    if (doVisualDebugTutorial)
    {
        // Create a configuration object for the visual debugging server
        Kaim::VisualDebugServerConfig visualDebugServerConfig;

        // Set up its class members
        const KyUInt32 serverPort = Kaim::VisualDebugServerConfig::DefaultServerPort(); 
        visualDebugServerConfig.UseNavigationLab(serverPort);
        visualDebugServerConfig.SetWaitOnStart( Kaim::VisualDebugServerConfig::DoWaitOnStart );

        // Activate visual debugging
        KyResult startResult = m_navWorld->StartVisualDebug(visualDebugServerConfig);
        if (KY_FAILED(startResult))
        {
            return false;
        }
    }
 #endif
    ...
}
...

void MyGameWorld::Update(float deltaTimeInSeconds)
{
    if (m_navWorld->GetVisualDebugServer())
        m_navWorld->GetVisualDebugServer()->NewFrame(m_gameFrameIdx);
    ++m_gameFrameIdx;
    ...
}
...

void MyGameWorld::Destroy()
{
    ...
    m_navWorld->StopVisualDebug();
    m_navWorld = KY_NULL;
}

Testing

To test that the visual debugging system is working:

  1. Launch your game.
  2. Launch the Navigation Lab.
  3. In the Navigation Lab, click the Connect button in the Remote Application toolbox, located at the top left.

    In the dialog box that appears, enter the IP address of the host running your game (or localhost if the Navigation Lab is running on the same computer as your game). Enter the same port number you configured for the visual debugging system in your game code. Finally, click Connect in the dialog to set up the connection.

If the Navigation Lab connects successfully to the game: