集成阶段 1d:设置可视调试

通常,Navigation Lab 的现场可视调试功能对于确保成功集成以及对 Gameware Navigation 的一般性应用至关重要。

例如:[Tutorial_FirstIntegration.cpp 中的代码]

bool MyGameWorld::Initialize()
{
    ...
    const KyUInt32 databaseCount = 1; 
    m_world = *KY_NEW Kaim::World(databaseCount);
    
// Visual debugging is disabled in Shipping 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.
#ifndef KY_BUILD_SHIPPING
    // 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::DoNotWaitOnStart );

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

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

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

测试

测试可视调试系统是否正在运行:

  1. 启动您的游戏。
  2. 启动 Navigation Lab。
  3. 在 Navigation Lab 中,单击左上角 Remote Application 工具箱中的 Connect 按钮。

    在显示的对话框中,输入运行游戏的主机 (如果 Navigation Lab 与您的游戏在同一台计算机上运行,则输入 localhost)的 IP 地址。输入您在游戏代码中为可视调试系统配置的相同端口号。最后,在对话框中单击 Connect 以设置连接。

如果 Navigation Lab 成功连接到游戏: