December 18, 2010

### Curves for Quake: Tips and tricks

This is a tutorial by czg:

Tutorial for making QBSP curves in WorldCraft

First off, I guess a lot of you have already tried out making curves yourselves, and done so mostly by making a cylinder template, and building your architecture around that. That’s fair enough, but lets have a look at how we can improve on that: I suppose what you have been doing, is a little bit like this:

Now, this might look good in the game, but to be completely honest, just about nobody will ever notice the difference between a 32 sided cylinder, and the 12 sided ones we are going to use here.

One other thing: Notice how all the brushes are rectangles with one of the sides skewed. These all hit the ‘upper’ wall at many arbitrary positions. This is not all that good, because of how QBSP works, it will most likely split many of the surrounding faces into many smaller ones, which could have been avoided, by doing this:

As you see, now all the faces are made of wedges that all have one common point, the upper right corner. We get the same shape, but only now there are no more arbitrary points on the upper wall that can cause weird splits in your BSP. However, the cylinder used as a template here does have quite a lot of random points itself. Basically, the thing we want it to do is stick on as large grid as possible, and that task is a whole lot easier if we make our cylinders with fewer sides, like 12. Now if we make a 12 sided cylinder in just about any editor; you’ll most likely end up with this:

Now this is good, because it sticks to the 16 unit grid (assuming this cylinder is 256×256 units) but can we do better? Try rotating this cylinder 15 degrees and then snapping all the vertexes to the grid like this:

So, now we have our cylinder template, and can get on to the fun part; building stuff with it.

In case you’re wondering, I’m building all my stuff in WorldCraft.

We’ll start off with the most basic of the basic, a corner that is smoothed out with a curve:

Well, there’s not much I can say about that, it’s really simply made. Just two wedges sitting in the corner. Next please!

Here we have two curve templates combined, and filled out in-between with brushes to form a curved wall. This forms another template for our more complex curves. Notice how the lines between the brushes (highlighted in red) also all have very simple height:width proportions; 1:4 , 3:3 and 4:1. Remembering this will make further curve making simpler to do, without having to create a template for you to work around every time.

Furthermore, this also helps us in creating the next object, a hollow cylinder, or a pipe if you will:

Well, I scaled this down to make it fit better here :-)

OK, there you have the basics of making good curves, and I’m sure most of you could have figured out this on your own easily. The problems (although there are really no problems) arise when we try to bend curves (or other arbitrary structures) around new curves. For the time being, we will be bending the cylinder we made in the previous example, which from the top down looks like this:

First let’s have a look at one of the most common mistakes that one might do here:

What a lot of people do, is make a template for the inner “wall” of the object that is to be bent, (highlighted in stripey red,) and then just skew the object along it. This looks OK on the inner wall, but as we go out from the center of the curve, it gets way out of proportion and ends up looking like a squashed banana. (I used the 4:1 3:3 1:4 cylinder to bend around here, because then the “banana” error becomes more evident.)
Now what you want to do, is this:

As you can see here, both the outer and the inner walls of the cylinder are in correct proportion to each other. Also notice how the lines highlighted in red all point towards the center of the curve, as opposed to the previous example where they just pointed in orthogonal directions. We could have arranged it so that it did the same thing in that example too, but look at how the width:height proportions of those lines would be: 0:8 4:7 7:4 8:0. With these proportions, you could never build anything thinner than 8 units and bend it. In the second example however, those proportions are the good old 1:4 3:3 4:3, which lets you bend things as thin as 4 units.

However, many will now probably think that it took me ages of vertex manipulation to get the result I wanted, but really, I didn’t even touch the vertexes. Here’s how I did it, step by step:

First I stretched out the piece of pipe I had, and clipped off the end of it towards the center of the curve I wanted to make, ending up with this:

Next I copied that segment of pipe, and clipped off the other end so I ended up with another piece, identical to what was already inside of the 256×256 square the curve was going to fit in:

Next up, I stretched that bit out, so it was long enough to reach the “corner” of the curve I was going to make, and skewed it so the start of it was flush with the end of the pipe I already had, ending up like this:

Then, you have to stretch the pipe vertically so that it is 9/8THS of it’s original height, which equals adding an extra 16 units to it’s height in this example. Now, you might not understand why this is necessary at once, but just bare with me, and it will all be explained in the next step.

Now the reason for the previous step being necessary, is as follows: When we now are going to skew the pipe downwards to make one segment of our finished curve, all the vertexes on the two already fitting ends would be skewed out of their place, because they are not placed “above” each other. When we scale it up to 9/8THS however, we make up for that and everything magically aligns perfectly when we are done:

Almost done now. The only thing left to do, is copy the entire thing, rotate it 90 degrees and flip it, and then we have ourselves a perfectly rounded pipe in a matter of seconds:

Well now you know how to create complex curves fast, easy and efficient, but there are two more things that you might want to know.

First off, if you’re making very large scale architecture, having only 12 sides in a curve may look very “blocky”, so how might you add extra faces to a cylinder and still keeping it neat? Easy, you just clip off 1/4 of the corners, like this:

This way you end up with a 24 sided cylinder, but then you can’t curve anything smaller than 16 units. Oh well. It still stays fairly good on the grid compared to what the editor might give you as a basic shape.

The second thing you might want to know, is really a bit dodgy and you shouldn’t use it unless you feel it’s absolutely necessary. It’s a way to create a spiral ramp, or helix if you like. The thing here, is that if you pull the vertexes on a standard quarter-pipe curve upwards, you’ll end up with an illegal brush because the inner and outer edges of it are of different length, and thus would need different gradients to not look awkward. Well, there is a way to overcome this, but it’s messy, and don’t say you learnt it from me, OK?

What you have to do, is clip the segments of the curve in two along the diagonals. This will make those illegal faces of the brush into triangle, which are impossible to make illegal. (Well, you can make those too illegal in WorldCraft, but I won’t go into that here. Is that editor 1337 or what?) Then you can displace the curve height-wise as much as you want, but be warned, if you have complex curves made up of many “rings”, you might get a headache when QBSP begins to hurl Terrible Errors Of Evil towards you. Also you are very likely to encounter Quakes magical invisible clip wall error with these, that makes the player think he cannot walk over certain faces and stops him in the middle of nowhere. A absolute no-no in deathmatch I would think:

There. Now I have thought you all that you should and should not know about making curves in Quake. Now go out and use them in the name of good!

czg – signing off.

Disclaimer: The original web page is unavailable.

﻿