Random House Generator

I am looking for suggestions on how to go about taking the modular pieces of a building (windows/doors/chimneys) as well as materials for walls/roofs/floors/ceilings and create a blueprint that will allow an environment artist to input a simple height/width/depth dimension and generate a unique structure.

I have some ideas on an algorithm I would use to figure out the positions of windows/doors but what I need help with is drawing the wall and roof planes.

Say I know I want to draw a wall from (0,0) to (0,1000) that is 10uu thick and 182uu tall and then texture it with ‘exterior_wall_mat’ from the blueprint, what would the approach be?

Oh boy… a random house. Random geometry, unless you’re really talented with math is very, very hard to do especially in an environment that exists in 3d space with not so… symmetrical environments around.

Well, first of all you’ll want to use this:

Use that in combination of a few different switch statements for the type of random houses. This should work out perfectly.

Anyways, to answer the drawing of a wall:
Go ahead and give that video a try. Basically take the shape/geometrical figure and put it into a function that places it in world and then mesh->SetMaterial(index, material). I would help you with Blueprints but unfortunately I don’t use them. :(, you could try asking in the blueprint section.

Anyways, best of luck!

Thanks for the reply but I was hoping to get some specific suggestions on how to draw walls in UE4 in C++?

Should I try to create a BSP in code and then convert it to a static mesh or is there a better approach to take?

@Mentos: This should get you closer to where you want to be.

Though I’m not so sure that I wouldn’t just have my artists generate an array of prefabs for walls and ceilings and the like, and procedurally build buildings out of them using scaling and whatnot.

I mean you could do that since there really isn’t a wrong or right way of handling it. Though from what I gathered on your post literally i’d take some shapes(meshes or geometry, in the end it depends on what works for you) and handle it via my method.

Sort it all out in a single class. The video I had linked shows the creation of a “pizza” object and handles it’s shape, ect. So you could build from that concept. The wiki-article that Requisite0 posted isn’t bad either but… I can see quite a few unfortunate flaws in that design later down the road as the author mentions from the top.

So you’ve got a few suggestions and ways of handling it. If you’re still stuck then let me know and i’ll probably cook something up for others who might be interested as well.

Good luck!

What I do is i have 400 x 400 x 20 tillable textured meshes and i just propagate for the value of the var for a single wall, this allows me to add some randomness into it as well like have an array of meshes that might have a big window or small window or no window, or big/small window with flower box, ect chose one and place it. all you need is basically 3 variables length, width, height and 2 arrays, for floor/ceiling and walls :slight_smile: maybe choose the middle /middle-1 for the door if needed. although this gives an emtpy shell. if you wanted floors you should take a look at random floor plan generators.

Hey guys thanks for the suggestions!

I think I’ll probably try my hand at using prefabricated walls/roofs/ceilings and trying to position and scale them procedurally and if that does not work out make an attempt at drawing them in code.

Im actually in the exact opposite place as u. Id like to figure out the approach in blueprints but already have the walls. Ive seen online that people are using nested for loops to input var(x)×var(y)×var(z). But it limits the house design to a perfect reactangular shape where id like the shape to be random with random sized rooms on a grid space between x number of grid spaces per room.