Wall building in a level-editor

Yes, it’s a great game. I’m fascinated by its complexity.
Isn’t the math to do such an extrusion quite complex on a triangular mesh in order to not get any hidden faces or overlapping lines? I tried doing it in Blender for testing, but that was difficult.

Not really, but it was a bit tricky to find a general solution. I might publish the library when i have time, the simplest thing to with it is building the mesh. Maintaining the layout and the actual mesh are 2 different steps.

I’m not exactly sure how it is done in Sims exactly, it could be just based on a grid as you always are working in one and you’re limited to 2 axes + diagonal. For the mmo i’m using it for i use a raster and a few other restrictions too so people don’t get too crazy.

What you also want to avoid (especially with a different wall thickness) is edge cases where a thick wall would intersect into another wall, or 2 very steep joining walls sticking with their tip through another wall. You can either reject this or use a solution like caps, though you shouldn’t waste time thinking about union something another time, having always a wall baseline with it’s segments is managable. In my game you can also auto-lower or hide the walls where the camera is viewing inside, there needs to be a definition of what is a wall, the mesh is just a visual representation.

1 Like

It’s impressive. I don’t understand why I haven’t found more people doing it this way. Maybe it’s just too creative.

1 Like

Its not a problem I managed to solved before I gave up.

And this is how Sweet Home 3D solves it.

1 Like

Different thinkess isn’t a issue ^^ what i meant is a wall so thick, that it starts to absorb the wall of the other side of a room.

How did you deal with UV coordinates and texturing? I discovered a problem when one wall was twice as long as another, and repeating the texture wouldn’t solve it, as that would repeat it for the whole mesh, and mess up the shorter wall. I can’t see how changing UV coordinates for individual vertices could fix this either, as there are six vertices per plane no matter the length of the wall.

The segments lengths/offsets of the room outline are known, the wall texture is made for the minimum length a wall and can break at corners or relax/stretch across the patch to close seamlessly (distortion not visible if the texture isn’t too long, depending on how much it can vary there might be some displacement changes though when adding more walls to a room). When working restrictive in a raster with fixed units and a fixed wall thickness none of that is necessary.

There should be 4 ^^

Yes, everything is known. That’s not the issue. The issue is repeating the pattern in practice. I usually use texture.repeat(). But if I do that here, then it will repeat twice as much as required on a wall half the length. You meantion stretch instead of repeat, is that because you don’t tile your textures? I have a seamless texture for the smallest possible segment.

Each plane should be triangulated, but after tutorials on this particular subject I’m also seriously confused (but that’s for another thread). I might have misunderstood, but I’m unable to build a GeometryBuffer that’s not triangulated, and thus not able to build a plane which is not triangulated either.

In a indexed geometry you only define 4 positions/vertices and define the triangles connecting these.

The texture is repeated in the UVs not in the texture. When you build the geometry and a wall is 4 times the base length the UVs go from 0 to 4 plus the offset of the previous segment.

Oh! I’m new to the game.

That’s really cool! I didn’t know I could do that. I just thought of UV from 0 to 1. I don’t have much experience outside of 3D software where it’s just visual.

Hey, I also did a wall editor, but for now, its only capable of connecting two walls at a time. I basicly have a list of points, I calc the angle between two of them, make a quad and apply the rotation to it. After that im connecting the walls to each other, two at a time. I move the vertices of the quads to the calculated intersecting points, which works great.
But now I want to extend my editor, that each corner can have multiple walls connected with arbitrary angles as you did @Fyrestar. Each wall should still be a single mesh.

I started from zero and im kinda stuck here… I came up with nodes. Nodes can connect to other nodes. Then I can calc the angle and basicly do the same thing as before, make quads and rotate them. But there is the first issue, which node is the starting point and which the end, which node gonna draw the actual wall? This is solvable, but had gave me a little hadache.
The other problem im having is finding the walls that are directly next to each other, to calculate the intersection point.

Would be great if you could lead me in the right direction. Id be happy with any article or code you can give me.
This image made me look up how photoshop or any other vector graphics sw is joining multiple paths, but didnt find anything useful.