What restrictions apply for publishing papers with UE4?

I am using UE4 for my masters thesis. I am writing both C++ and Blueprint code as well as use many of the other features of UE4. As such I would also have to publish code and instructions on how to recreate the functionality. This will naturally include UE4 specific solutions and maybe even some source code from the Engine itself. What kind of legal restrictions do I have to watch out for?

The question is rather open as I am not that knowledgeable about legal matters.
For more info on my project, please refer to this link. Feel free to PM me.

You’re certainly free to talk and write about the engine. To the extent you want to include code from the engine in your paper, this is what the EULA says:

You are permitted to post snippets of Engine Code, up to 30 lines of code in length, online in public forums for the sole purpose of discussing the content of the snippet and not for the purpose of enabling non-Engine Licensees to use or modify any Engine Code, or to aggregate, recombine, or reconstruct any larger portion of the Engine Code.

This would apply to your paper(s) as well.

I might have to change a little bit of the rendering pipeline to make my project work. I do not know how many lines that would become, but if I surpass it, can I consult someone to maybe acquire the required permissions?