Building a lightweight version of the engine from source

I am trying to build the engine from source in a way that it is lightweight and suitable for small projects and game jams. I also feel that I don’t really need all the features of the engine that are there in the source. However, when I started deleting the modules, I felt afraid to delete too much since there are so many modules and I am not familiar with most of them. I referred to the documentation about the modules that I thought are not useful, but there is not much documentation when it comes to the individual modules. I would be grateful if someone who has the knowledge of the source code or who has done this kind of thing could help me figure out a way through this.
For example, I know that modules like “core”, “engine” or “RHI” are absolutely necessary and cannot be deleted. I also know that I will not be using “advertising” or “EyeTracker” modules and can safely delete them. I plan to move the other modules that are not absolutely necessary but are useful to have into the plugins folder (like “foliage” or “cloth”).

In my opinion, if you are making a game jams, you have better not do modify the engine. Because most of engine’s game feature you will need in game or later dev.(Maybe you can cut off the Foliage/cloth or something else. And there’re mostly the thirdparty pulgins or modules that actually you can disable it). And the final packing game, the uesless modules will auto remove.
If you building a small project that no depends on game feature(like AbilitySystem/Physics/Animation/XR/ and such on), make a custom lightweight builds of engine is a better choice. And mostly that will have a huge modifty, and this requre you understand how the UHT/UBT and Blueprint VM working.When you understand how the UHT/UBH/VM working, the lightweight builds version is just the time and patient problem. If you want make a custom build of editor, that requres you have a good practised with slate(if you same exp with HTML or WPF, Slate will be easy).

Just a few advices, if you really need to cut some of the engine modules:

  1. Do not bother cutting modules from the editor build. End users will gain absolutely nothing from that.

  2. If you want to slim down the game build, do so on a later stage of development when the majority of the game is complete and you are sure that you will not need the features you are cutting. Removing an engine module generally requires modifying a substantial amount of the engine code and getting the module back after it was removed might be difficult or might introduce unexpected issues (especially in a case with a large number of removed modules)

  3. As usual, modifying the engine might introduce unexpected issues. Be careful about that, and ask yourself whether you really need to do so before you actually start doing it. Not to discourage you from experimenting, just be aware of the risks.

And here’s the typical algorithm for removing a module:

  1. Search *.Build.cs and *.Target.cs files for the name of the module you are willing to remove. Note that some of them might be referenced from plugins. Remove or comment out all the references to the module.

  2. Rebuild the engine. Read all the build errors and fix them one by one. This is a tedious work. Remove/comment missing header file references. Remove/comment functionality that depends on the features provided by the removed module. You will need at least basic understanding of the structure of the engine and how different features are integrated.