Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navmesh hot reloading #317

Open
GeckoEidechse opened this issue Nov 3, 2022 · 0 comments
Open

Navmesh hot reloading #317

GeckoEidechse opened this issue Nov 3, 2022 · 0 comments
Labels
feature request Request for a new feature/enhancement

Comments

@GeckoEidechse
Copy link
Member

Suggested by @Mauler125 in https://discord.com/channels/920776187884732556/925135799798874192/1037664012579643412

//-----------------------------------------------------------------------------
// Purpose: hot swaps the NavMesh with the current files on the disk
// (All hulls will be reloaded! If NavMesh for hull no longer exist, it will be empty!!!)
//-----------------------------------------------------------------------------
void Detour_Reload()
{
    // Destroy and free the memory for all NavMesh hulls.
    for (int i = 0; i < MAX_HULLS; i++)
    {
        dtNavMesh* nav = GetNavMeshForHull(i);
        if (nav)
        {
            v_Detour_FreeNavMesh(nav);
            MemAllocSingleton()->Free(nav);
        }
    }

    // Reload NavMesh for current level.
    v_Detour_LevelInit();
}
ConCommand::Create("navmesh_reload", "Reloads the NavMesh for all hulls.", FCVAR_RELEASE, Detour_Reload_f, nullptr);

command hot swaps NavMesh for all hulls while the game is running. If you implement this in Northstar, you no longer need to restart the level to reload the NavMesh

@GeckoEidechse GeckoEidechse added the feature request Request for a new feature/enhancement label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature/enhancement
Projects
Status: No status
Development

No branches or pull requests

1 participant