Page 1 of 1

(1.9pre 772) Items spawning at wrong heights

Posted: Sat Aug 09, 2014 12:37
by DaveDemons
I've been a doom mapper for around 10 years now, but I've only noticed this bug several months ago.
I'm not sure if this is a GZDoom, or GZDoom builder bug, but I wasn't able to get much help at the GZDoom builder forum.

For reasons unknown to me, items placed near edges of raised floor heights spawn in mid air, or at the height of a different sector on the map. The way I've been testing for this bug is by covering the map with a layer of items, so that it's easy to see the affected areas.
Adding, or removing geometry in the map will cause these glitches to change location. I suspect that the node builder might be causing this.

The test map was made using GZDoom builder r1996 and it's in UDMF format.
Spoiler:
Spoiler:
Spoiler:
Here's a link to the test wad
https://www.dropbox.com/s/1bpbkyorulf3n11/test.wad

I'm on widows 8.1 64bit

Re: (1.9pre 772) Items spawning at wrong heights

Posted: Sun Aug 10, 2014 20:00
by NeoHippo
I remember your Silo pwad MAP02 had a similar problem.

When I look at your present test.wad map in the Preview Mode, I notice that some barrels highlight while others do not.
And sure enough, switching back to the map editor and moving barrels around, some barrels are stacked on top of each
other. I would suggest to make certain that there is only one barrel in each location.

Plus, there is no need to have such short linedefs. My suggestion is to make linedefs longer. Too easily something can go wrong. Especially on simple sectors such as this, for example

Image

Having done that, the barrels no longer 'float'.

[edit]
It appears that the barrels are affected by the proximity to the linedefs. Moving barrels away from the sector fixes the
floating in air problem.

Re: (1.9pre 772) Items spawning at wrong heights

Posted: Mon Aug 11, 2014 10:18
by DaveDemons
I've been scratching my head over this for a while, but I finally pinpointed the cause of this problem.
I intentionally made those sectors with a high amount of linedefs to clearly show this bug. This problem can show itself with much simpler geometry, there's more to it though.

I've made a really clear example of this. There are two test wads with a rectangular sector in the middle. They contain 128 linedefs which isn't an unusually high amount and their length is 4 on two of the sides and 11 on the other two. There's a layer of non overlapping barrels covering that sector. There are no errors.

In test1.wad everything is locked to a grid and when played, the barrels spawn as expected at their correct heights.
https://www.dropbox.com/s/xmycewiaucyfjlj/test1.wad

In test2.wad I've rotated that sector so that it is no longer locked to the grid and when played the barrels become possessed.
https://www.dropbox.com/s/zqxmkb547ifhghm/test2.wad

Re: (1.9pre 772) Items spawning at wrong heights

Posted: Mon Aug 11, 2014 11:21
by Graf Zahl
I reduced the latest test map to only contain one single barrel so that I could actually see something in the debugger.

The cause of this glitch is that ZDoom needs to emulate some strangeness of Doom's original thing spawning code that had its own ideas of what's supposed to be 'front' and 'back' of a line. And that code gets hopelessly confused with your mass of extremely short lines due to loss of precision in the following two lines:

Code: Select all

	left = FixedMul ( node->dy>>FRACBITS , dx );
	right = FixedMul ( dy , node->dx>>FRACBITS );
Replacing those with floating point math cures the problem.

Re: (1.9pre 772) Items spawning at wrong heights

Posted: Mon Aug 11, 2014 11:54
by DaveDemons
Thank you, I can now sleep at night.