Gez
Why don't I have a custom title by now?!
Posts: 12224
Registered: 0707 
Knas said:
Third question. How wide is the Doomguy in game? In the editor he's 32 and when I checked the wiki it said the radius was 16. But in the game he can't pass through 32 wide gaps.
It's a small bug, or at least inaccuracy in the Doom engine, that is responsible for that. Basically, there are tables containing the cosine, sine, and arctangent values for all possible angles in the game. There is, however, a finite number of angles that can be stored this way, and since the game uses a 32bit number to store an actor's angle, the maximum precision would require over 4 billion values. It's not really feasible, especially not in an engine designed in 1993.
So, the angles are converted into "fine angles" first, which are less precise so that there are only 8192 of them. Each of the fineangles corresponds to a full range of 524288 "normal" angles. A normal angle has a precision of about 0.000 000 084°, but a fine angle has a precision of "only" about 0.044°.
The finesine/cosine table is filled with values according to the angle in the middle of the range. So the finesine for angle 0 is actually the finesine for angle 262144... And likewise for all other angles.
This basically means that it is not possible to move perfectly along one axis. If you think you move straight north, you will also move very slightly on the eastwest axis. Your angle isn't a perfect 90°, it is more like 90.022°.
So if you have a 32unit gap right in front of you, which is aligned to the grid, and you try to move through it, what happens is that you'll also move a bit to the side. Which is blocked by a wall. So your movement is blocked.
In some conditions, though, you can still pass through the gap. So to be sure, if you want players to pass through a gap, make it at least 33 units, and if you want players not to pass through a gap, make it at most 31 units. 32 units is unreliable either way.
