PolyObjects

From ZDoom Wiki

(Redirected from Polyobject)
Jump to: navigation, search

Since the use of a precalculated BSP for rendering forces vertical level geometry to remain constant, it is impossible to move a structure on the X and Y axes in vanilla Doom. ZDoom addresses this problem by providing PolyObjects. A PolyObject consists of a group of connected one-sided lines contained in a single subsector.


Making a polyobject is fairly simple, though it may seem hard at first (when I first started making them they seemed tough anyway), once you get the hang of it you'll be able to crank them out in no time. Since this requires some visual aid, I'll supply a few images. These are taken in WadAuthor for those curious.

Image:Poly01.png

First we need the actual map. I'll make a sliding door polyobject (arguably the easiest kind), so we'll need two rooms with ceiling heights of 192 and a middle corridor (which is where the polys will appear) with a ceiling of 128. All floors are at height 0.

Image:Poly02.png

Next you need to construct the polyobjects. These can actually be constructed anywhere in the map, but for simplicity it's best to place them close to where they'll appear. You can place them in a 'dummy' sector if you like, but it's probably most efficient to place them right in the sector they'll appear in (especially if you use Doom Builder which won't place polys in the right spot for you in 3D mode). For simplicity (and space) I'll place them in a dummy sector in this example. Note that the polyobjects are 'solid' columns composed of only 1-sided linedefs.

The lines marked in yellow should be Polyobj_StartLine which takes three arguments, the polyobject number, mirrored polyobject and the sound it makes while moving (defined in SNDSEQ). For the top poly you should use polyobject number 0, and for the bottom you should use number 1 (though any number from 0 - 255 would do). Since these polys will mirror one another (their actions will be the same, only in reverse, poly1 will open to the right and poly0 will open to the left for example) you should place the opposite poly number in the second field. Sound isn't important to us now, so just leave it zero.

Image:Poly03.png

Now you have to place polyobject anchors and start spots. These will determine where the polyobjects actually get placed on the map. First place the anchors, which have DoomEdNum 9300. These should be placed within the polyobjects as you have them drawn on the map (or close to the edge), like in the image. The only important thing about the anchors is their angle, which should correspond to the polyobj number. So the anchor at the top has angle 0 and the anchor under it has an angle of 1.

Image:Poly04.png

Next we place the start spots. These are placed in a similar way to the anchors; in a place where you want the polyobject to appear in game relative to the anchor. So in this case we placed the anchor in the center of the poly, so we want the start spot placed in the center of where we want the poly to appear, as shown in the image. Start spots have the DoomEdNum 9301 or 9302 if you want the polyobject to crush the player.

Image:poly05.png

Now comes the tricky and also the most important part. PolyObjects need to be within their own subsector. If you don't know what a subsector is, it's not really important, but the best thing to do is either have each polyobject be within its own sector or to put a line between the two (in this case). The subsector the polyobject resides in must also be convex. For a subsector (or just a sector) to be convex all the lines that make up its shape must be a round or square sort of shape. I believe a more mathematical (but not much) definition is that all points along the outside of the shape must be able to connect with any other point (not on the same line) without crossing through any other lines. Keep polyobjects in a rectangular sector and you'll be just fine though. Note the changes I made to the map in the screenshot. The offshoot areas are where the polys will go when they slide, preventing them from shifting into void area and keeping them from bleeding (which is most undesirable).

Image:Poly06.png

Finally, you probably want the polyobjects to actually open. This is quite simple, just give the wide sides of the polyobjects the Polyobj_DoorSlide special, with the arguments 0, 32, 128, 64, 105 which are polyobj number, speed of movement, angle (defined at the ZDoom editing ref), distance to move and delay before the polys shift back to their original position (in tics, 105 is 3 seconds (35 tics per second)). You need not worry about polyobject 1 in this case because it will mirror whatever polyobject 0 does. That's it, you're all done!

Image:Polyexample.zip

For specials related to PolyObjects, see the following topics:

See Also

Tutorials

Personal tools