Can I create a level programatically?

Hi all, I’m new to UE but am an experienced software developer. I’d like to generate levels programmatically so they could be random rather than use the UI to place every wall and window.

It would seem like there could be two ways to do this:

  1. directly generate the compiled form of a level into the necessary file format. sometimes there are classes exposed that allow manipulation of the underlying file.
  2. Create C++ code that would itself do the creation upon compilation and execution. I’ve done a lot of ‘code generating code’ projects, sometime its the most effective way to avoid dealing with file formats.

Are either of these techniques supported?

thanks,

john