Most performant way to build a house with multiple rooms

Hello, I have a general question. I have a library where I want to implement an easy way to build multiple connected rooms.
Before doing so I need to know what the best way to do so is.
I came up with or found the following solutions

  1. building a custom mesh eq.:
  2. building the rooms with primitives like boxes or planes (kinda like using lego blocks)
  3. building the room in something like blender and simply importing it

If the answer is “it depends” I would love to hear on what :smiley:

If you wish to have textures on the walls or floors, do not reccomend 1. 3 seems the easiest. Uvs are required in this case. Not easily built,no. 1.

1 Like

Ok, so … it depends :wink:
I can extend a little:

  1. It depends on if the rooms are ^ a ‘prefab’ or
  2. If those rooms have to be build ‘on the fly’ using user’s custom inputs (size, number of walls, angles)

Of course, in case your rooms are prefabs (of a given size, number of walls, shape, etc), you could go with the ‘prefab’ version. In other words, you can build your (static) rooms in either an external app (i.e. blender) and next import the mesh async on user click (or dispose of it on click) – or – create the room through a script (a bjs script) that will construct the object room (i.e. from planes or mesh writes) without the need/possibility of user input. In (both) cases, The user will have no acting on the room shape/size.

Things are quite different speaking about a room editor, where the user can define the size of the room, the number of walls, angle the walls, add holes, doors, windows, etc…
In this case scenario (something I participated for a dealer shop builder back in 2013 with Unity) things become (a lot more) complex. I believe it’s still totally do-able in BJS today. It will however require a lot of work to handle ‘the library’ and user inputs and constraints before even looking into the rendering details of the scene.

In short, in my opinion case A or case B are completely different projects.
Obviously working with ‘case A’ (prefabs) will require a lot less efforts :relieved:, even if multiplying the number of prefabs available to the user. Case B is an editor like project and you will likely come back to this forum a number of times before your work is done :tired_face:

Edit: Sry, just a thought with a delay as I was remembering my old dealership building project. :thinking:
You can also turn things around, in a way. Which would make it easier. Instead of ‘adding rooms’ (and surface) you could have a pre-defined surface/shape. The house. In this prefab, already shaped and sized house, have the user add library elements, such as ‘inside walls’. Means that the outer shape (house) would be pre-defined, but next the user can ‘divide’ the surface, creating rooms. That’s by far easier to do than the full editeable version.


Yes two things it will be, currently I am working on the prefab variant which can be seen First person movement | Svelte Babylon in its current state (I still need to figure out how to go up a ramp xD).

Later I think it would be great to add the possibility of building a room on the fly and/or via the library. This surely will require a lot of brain juice :smiley: