Creating Command Line tools for Exporting/Level Processing?

I’m looking for some information on how I would go about creating an command line export tool for exporting ULevel data from unreal engine, so that it can be used to generate custom AI navmeshes for my server implementation as well as implement server-side collision tests/etc.

I’ll preface this by saying that I am currently making a large world game, that is using World Composition and multiple levels/streaming to establish the world.

Since I run a completely separate server/networking stack, I need a way to export out the collision geometry so I can generate navigation meshes on the server side of things.

After digging around through the code, it looks like creating such a custom collision geometry exporter would look something like this:

  • Load the MainWorld level (which uses WorldStreaming) from its .level package

  • Obtain the WorldComposition TileList with all of the streaming level packages

  • Load each package, get the ULevel

    • Obtain the AActors

      • Obtain all of the UPrimitiveComponents, LandscapeActors, etc

        • Perform some form of custom exporting logic to write them to disk to be used for processing

The issue I’m trying to figure out is how can I make some form of command line tool that I can run in CI/locally to create this output.

I’m an experienced C++ developer, so I have no problems writing the exporter in C++, but I am running into difficulty in what the correct approach would be to implement something like this.

A few of the routes I’ve been investigate are:

  • Python scripts in the unreal editor

    • This requires a running instance of the UE editor to run though, so this rules it out as a possible CI/automated tool.

  • AutomationTools

    • These seem to be designed more as post/pre build steps for building the Editor/packaging games.

    • I haven’t figured out how an AutomationTool can call into the UE4 C++ code yet however - or if its even possible. I assume since its responsible for creating the finalized package (.pak) files (I think), that it must be possible somehow.

  • Custom C++ project that uses the UE4 source code

    • This seems like the most probable solution, but I have a feeling that setting up the custom build environment variables that unreal needs to even get things to compile will be a huge undertaking.

    • I have a feeling that the UBT should allow you to create executable projects instead of just libraries used by the editor/game, and if thats the case creating the custom project/target might not be so bad.

I’d like to know if anyone else has had to do something similar to this, and if they wouldn’t mind sharing their experiences.

Thanks,
MS

Update: It seems like the UnrealBuildTool does support adding in standalong programs build ontop of unreal engine:

I will be attempting to give this a go, as it’s probably what I need to be able to build a command line exporter.

Ill keep this thread posted with progress.