PolyObjects are sectors created outside of the main map that are spawned with the use of Things, thus making them able to move horizontally and rotate. Additionally, their visibility can be modified through linedef executors. This tutorial shows the setup of a basic PolyObject, usage of their actions, as well as more complex settings.
Contents |
To create a basic PolyObject, two linedef specials are needed: Linedef Type 20 is given to one linedef of a PolyObject to make the game recognize it as such, Linedef Type 22 is used to specify the settings of the PolyObject. Also required are two Things: the PolyObject Spawn Point and the PolyObject Anchor. These are used to specify where the PolyObject will appear.
The following basic terms appear when making a PolyObject:
Depending on what you want to do with your PolyObject, the Anchor can be placed in different points. For rotating or horizontally moving PolyObjects, it's usually best to have the Anchor in the middle, while swinging PolyObjects mostly have them to the side. For very complex PolyObjects, the Anchor might not even be in the PolyObject itself. To learn the basics of PolyObject creation, it's best to start with the most simple shape, which is a cube with its Anchor in the middle.
Start by placing the PolyObject Spawn Point where you want the PolyObject to appear in the map. The Angle of this Thing must be the PolyObject ID. This should be the next unused tag, which in the case of a test map would usually be 1. Then, create a sector outside the map that is big enough to contain your PolyObject sector. Since our test PolyObject is a cube, this sector should be a square that is bigger than the PolyObject. This is the surrounding sector, so it has to have the same attributes as the sector the Spawn Point is in. You can do this automatically by joining both sectors.
Inside this surrounding sector, create the PolyObject sector. In this case, it would be a simple square. It is very important to make all linedefs face outward. The notches in the middle of the linedef should face the surrounding sector, not the PolyObject sector itself. Now pick any linedef of this newly created sector and give it Linedef Type 20. The tag should be the PolyObject ID, which is again 1 in this case. In the middle of the PolyObject sector, place the PolyObject Anchor, again with a tag of 1. Floor height and ceiling height are also set in the PolyObject sector, simply as floor and ceiling height of the sector.
In its current state, loading this map would crash the game with an error message. This is because the PolyObject is missing a Parameter sector. To fix this, create a new control sector and give on of its linedefs Linedef Type 22. Both the tag of the linedef and the floor height of the Parameter sector should be the PolyObject ID (again, 1 in this case).
If you test the map now, it loads properly, but the PolyObject doesn't show up. Walking towards it stops the player anyway, because the PolyObject is there, but currently doesn't have any textures set, making it invisible. The textures are set as the front middle textures in the PolyObject sector, for every linedef separately: PolyObjects are regular sectors, not FOFs, so every linedef must have its own texture specified. Missing textures, however, don't produce glitches of any sort, they just stay invisible. Flats don't have to be set, since they are not displayed.
Because PolyObjects use middle textures, they are only rendered once by default. For example, if your texture is 128 fracunits high (which is the case with most textures) but your PolyObject is 256 fracunits high, only the upper half will have visible textures. To fix this, you must give every linedef the Effect 5 flag and set the front texture X offsets to the height of the PolyObject.
The PolyObject actions range from Linedef Types 480 to 491, and contains horizontal movement, rotation and visibility effects. They are set up like regular linedef executors, in a separate control sector, with a trigger and an executor. The tag of the executor is the PolyObject ID. For continuous movement or rotation effects that should be performed on level load, Linedef Type 399 can be used as the trigger.
There are four linedef types for horizontal PolyObject movement, each for slightly different purposes and with slightly different effects:
Note that moving PolyObjects out of the sector they spawn in might lead to rendering glitches.
There are five linedef types for PolyObject rotation, each for slightly different purposes and with slightly different effects:
There are three linedef types that control tangibility, visibility and translucency:
As an example of how to set up a PolyObject action, we choose the most versatile and useful, but also the most complicated effect: Move By Waypoints. The first part is similar for all actions, while the setup of the waypoints and the flag usage only pertain to this specific effect. For this tutorial we will choose three waypoints to properly showcase how the effect flags work.
Create a new control sector, tag one of its linedefs to the PolyObject ID and give Linedef Type 488. A second line should be either a regular trigger linedef or Linedef Type 399 if the action should be performed on spawn. Now, set the necessary atrributes in the sidedefs tab of that linedef. The front texture X offset sets the speed, 32 is normal. The front texture Y offset sets the waypoint sequence to use. If this is the first set of Zoom Tube Waypoints in your level, leave it as zero. For each new waypoint sequence, add 1. Each PolyObject should have its own waypoint sequence, as should every Zoom Tube.
Making a new control sector and giving one of its lines Linedef Type 488. |
Giving another line Linedef Type 399. |
For the purpose of our tutorial, place three Zoom Tube Waypoints on the map, it doesn't matter where. The Angle determines their order. The first waypoint has an Angle of 0, the second an Angle of 1, and so forth. For each new waypoint sequence, add 256 to the Angles of all waypoints belonging to it. The Z offset should be the center of the PolyObject, so if it is 128 fracunits high, the waypoints should be at 64, unless you want the PolyObject to move up and down as well. If you run the map now, the PolyObject will move from its Spawn Point to the first waypoint and then onto the next ones in ascending order, until it stops at the last one. If you want it to start at the first waypoint, simply place the Spawn Point at the same spot so that they overlap.
The flags of the control linedef control how the PolyObject will go through the waypoints. Through using and combining the Effect 1 to Effect 4 flags, several possibilities can be exhibited:
| Effect Flags | Behavior | Example |
|---|---|---|
| None | From first to last waypoint | Spawn Point - Waypoint 1 - Waypoint 2 - Waypoint 3 |
| Effect 1 | From last to first waypoint | Spawn Point - Waypoint 3 - Waypoint 2 - Waypoint 1 |
| Effect 2 | From first to last waypoint, then to first | Spawn Point - Waypoint 1 - Waypoint 2 - Waypoint 3 - Waypoint 2 - Waypoint 1 |
| Effect 1 and Effect 2 | From last to first waypoint, then to last | Spawn Point - Waypoint 3 - Waypoint 2 - Waypoint 1 - Waypoint 2 - Waypoint 3 |
| Effect 3 | From first to last waypoint, then directly to first | Spawn Point - Waypoint 1 - Waypoint 2 - Waypoint 3 - Waypoint 1 |
| Effect 1 and Effect 3 | From last to first waypoint, then directly to last | Spawn Point - Waypoint 3 - Waypoint 2 - Waypoint 1 - Waypoint 3 |
| Effect 4 | Loops movement (must be used at least with either Effect 2 or Effect 3) | Spawn Point - Waypoint 1 - Waypoint 2 - Waypoint 3 - Waypoint 1 - Waypoint 2 - Waypoint 3 - etc. |
MAP01, replacing Greenflower Zone Act 1.
MAP01, replacing Greenflower Zone Act 1.
MAP01, replacing Greenflower Zone Act 1.