How can I use Navmesh data in Server Side?

How can I use Navmesh data in Server Side?
We are making Mobile RPG with Unreal Engine 4. So, server need Navmesh data for Monster AI Pathfinding.
When I use Unity they have plugin for RecastNavigation.
I saw in the Quick Start Guide “Create a NavMeshBoundsVolume” about generating Navmesh.
Is there no way to export navmesh data created by NavMeshBoundsVolume?

need+1…

need+2…

Tricky but quite obvious if you think about it.

Your server is responsible for doing all actual actions. The client may try to guess what’s happening but will always obey the server.

This means the map itself needs to be on the server itself. In other words. The nav mesh is on the server. And it only matters how / where you access the navigation calculations.

If you use (for example) “SimpleMoveTo” on an event that’s server only, it will be executed on the server and will use the navmesh the server already has.

I think you got a wrong point. I mean was i need to exported navmesh data created by “NavMeshBoundsVolume” in editor

The whole map should be on the server. Including information from the “NavMeshBoundsVolume”.

A listen server obviously uses exactly the same map as a client. And a dedicated server simply has no render-pipeline and a few other optimizations.

But map data, especially for physics and navigation, is stored on the server by default.

What exactly do you want to export? It’s generated once and stored together with the map. Alternatively you can force generation of the nav mesh during runtime in the Project settings as well.

We are not using dedicated server. We made a custom server use c# with socket. So, exactly i need navmesh data for the c# recast module. Anyway i just want to know way to export navmesh data if possible. Actually i don’t know about that dedicated server how they work. But As you said dedicated server already have all information related map included nav mesh. Maybe i can use that server only for the navigation calculation.

Alright your question got me confused.

You are writing a custom server 100% unrelated to Unreal Engine right?

In that case that’s not supported. You’ll have to dive into the engine source code and fetch the recast data yourself.

i have writen an editor plugin which can export the dtNavMesh’s data to file, but seems UE4 doesn’t use the dtTileCache for tile and temp obstacle manage. so even my server loads the dtNavMesh’s data, it still can’t dynamicly add/remove obstacle, i don’t know why UE4 do that on its own, it’s impossible seperated for server usage.

Is that plugin public?

If so could you post a link? A lot of people seem to look for this topic.

It’d certainly be better than nothing at all!

the plugin is easy, you can search “Extend the editor” for full example source, i only add a toolbar button for export operation. the key code is getting the dtNavMesh instance from UE4, then you can save any data within it(but no tilecache):

class ARecastNavMeshTrick : public ARecastNavMesh
{
public:
const FPImplRecastNavMesh* GetRecastNavMeshImplTrick() const { return GetRecastNavMeshImpl(); }
};

void ExportNavMeshData()
{
UWorld* World = GEditor->GetEditorWorldContext().World();

const ANavigationData* NavData = World->GetNavigationSystem()->GetMainNavData(FNavigationSystem::DontCreate);
const ARecastNavMeshTrick* NavMeshData = Cast<const ARecastNavMeshTrick>(NavData);
const FPImplRecastNavMesh* RecastMesh = NavMeshData->GetRecastNavMeshImplTrick();
dtNavMesh* DetourNavMesh = RecastMesh->DetourNavMesh;

FString TempFilename = FPaths::GameSavedDir() + World->GetMapName() + ".navmesh";
FTCHARToUTF8 Filename(*TempFilename);


bool b = hztool::navmesh::save_navmesh(Filename.Get(), DetourNavMesh);
if (b)
{
	FPlatformMisc::MessageBoxExt(EAppMsgType::Ok, TEXT("export navmesh ok!!!"), TEXT("TestCommand"));
}

}

hi. thanks your code, but I don’t understand this code line.

bool b = hztool::navmesh::save_navmesh(Filename.Get(), DetourNavMesh);

where is funtion in project … plz help me

that’s your own save function, you can save a dtNavMesh to your custom file for server-side loading.

可以将你插件打包发份给我吗 我现在kbe卡 UE4导航网格这 不知道怎么弄了 邮箱 469419752@qq.com

Hello I have the same problem. so I think I need your help, I save a dtNavMesh to my custom file. but recastNavMesh cannot understand it correctly. so May I see your code about How to save dtNavMesh to custom file

have you solved it? I have the same problem