PolyObject

From SRB2 Wiki
Jump to navigation Jump to search

A PolyObject is a group of linedefs that can move horizontally, creating the illusion of freely movable sectors. Because SRB2's rendering system relies on pre-calculated information (which is created during the nodebuilding process), normal level geometry is forced to be static. PolyObjects offer a way to circumvent this: The level geometry for the PolyObject is created outside of the main map, while in the map itself it is only represented by a single reference point. During runtime, the game dynamically inserts the PolyObject at the reference point. The reference point can be moved around in the map, thus creating horizontally moving level geometry.

PolyObjects can interact freely with the player and other Objects, and they will carry solid Objects standing on top of them. However, they should never collide with each other or static walls, which will lead to rendering errors. They can move across sector boundaries, but visual glitches may occur if a PolyObject moves into a sector with different properties from the one in which it spawned. PolyObjects should always be convex, since concave PolyObjects are rendered incorrectly, but this can be circumvented by splitting the concave object into multiple convex PolyObjects. In these cases, you can use the parenting feature to manipulate them as a single PolyObject, parenting each additional segment to the first.

Setup

See also: PolyObject tutorial
Player standing on a moving PolyObject.

At the point in the map where you want the PolyObject to spawn, place a PolyObject Spawn Point. Each PolyObject is referred to by a unique ID, which you can choose freely. Set the Angle of the spawn point to this ID. Then, the level geometry for the PolyObject must be created outside the main map. First, draw a sector that will contain the PolyObject. Give this sector the same properties (floor height, ceiling height, flats and light level) as the sector in which you placed the spawn point. Inside that sector, draw the PolyObject itself so that all linedefs face outwards. The sector that they enclose will be called the PolyObject sector from now on. Its floor and ceiling height set the floor and ceiling height of the PolyObject. Each linedef's middle textures will be rendered as the PolyObject's textures on that side – the front middle texture is displayed on the outer side, while the back middle texture is displayed on the inner side. If the PolyObject has flats and is intended to always be solid and opaque, the inner sides will not be visible, so the back middle texture can be omitted. By default, the textures are drawn only once, even if they do not stretch to the full height of the PolyObject. To tile them until they fill the entire height of the PolyObject, check Flag [10] / Repeat Midtexture / Effect 5 on every linedef.

Place a PolyObject Anchor somewhere within the PolyObject sector or the surrounding sector and set its Angle to the PolyObject's ID. When spawning the PolyObject, this is the point that overlaps with the spawn point. For rotating PolyObjects, this point is the axis that the PolyObject will rotate around. Give one linedef of the PolyObject linedef type 20 and set its tag to the PolyObject's ID. This is the PolyObject's First Line; it is used to identify the PolyObject.

The properties of the PolyObject are set with linedef type 22, PolyObject Parameters. This is optional – if you leave out the parameters linedef, the PolyObject will spawn with default properties. Among other things, the PolyObject will be tangible and opaque, and its flats will not be rendered. To set up a parameters linedef, create a new control sector, give one of its linedefs linedef type 22 and set the linedef's tag to the PolyObject's ID. To make the PolyObject render its flats, check Flag [9] / Solid Midtexture / Effect 4 on the parameters linedef. The PolyObject sector's floor and ceiling flats will be used as the bottom and top flats of the PolyObject, respectively.

The following linedef types are used for PolyObject setup:

  • Linedef type 20: First Line – Must be given to one of the PolyObject's linedefs for identification.
  • Linedef type 22: Parameters – Sets the parameters for a PolyObject.
  • Linedef type 30: Waving Flag – Used to shift parts of the PolyObject back and forth, creating a waving effect.
  • Linedef type 31: Displacement by Front Sector – Used to scroll a PolyObject in a particular direction, by changing the heights of the linedef's front sector.
  • Linedef type 32: Angular Displacement by Front Sector – Used to rotate a PolyObject in a particular direction, by changing the heights of the linedef's front sector.

The following Thing types are used for PolyObject setup:

Actions

PolyObjects are able to perform actions through the use of linedef executors. SRB2 includes 13 types of linedef executors for PolyObjects, which allow them to move, rotate, disappear/reappear or change their translucency.

PolyObjects can trigger linedef executors just like regular sectors. To do this, give the desired trigger sector special to the PolyObject sector and tag it to a trigger linedef. If Flag [6] / Not Climbable is set on the PolyObject's Parameters linedef, linedef executors can be triggered when a player explicitly lands on the PolyObject (as opposed to just standing on the PolyObject, or stepping up/down onto it from elsewhere). In this case, no sector special is needed – any trigger linedef with a tag of 32000 plus the PolyObject's ID will be triggered automatically.

The following actions can be performed by PolyObjects:

Flags

Certain linedef flags can be set on a PolyObject's Parameters linedef to control special settings:

  • If the [5] / Slope Skew / Effect 1 flag is set, only the outer sides of the PolyObject will be rendered.
  • If Flag [7] / No Midtexture Skew / Effect 2 is set, the PolyObject will be intangible.
  • If Flag [8] / Peg Midtexture / Effect 3 is set, the PolyObject will stop any movement if it comes in contact with a pushable Object.
  • If Flag [9] / Solid Midtexture / Effect 4 is set, the PolyObject's flats will be rendered.
  • If Flag [6] / Not Climbable is set, the PolyObject will activate any trigger linedefs whose tag is 32000 plus the PolyObject's ID when a player lands on the PolyObject (as opposed to just standing on the PolyObject, or stepping up/down onto it from elsewhere).

Furthermore, the Repeat Midtexture can be set on each of the PolyObject's linedefs to tile the textures on that linedef to fill the entire height of the PolyObject. Otherwise, the textures are only displayed once and not tiled. If Flag [10] / Repeat Midtexture / Effect 5 is set, it is also possible to specify an exact number of times that the texture should be repeated: For each repetition (in addition to the one time the texture is always drawn), 4096 must be added to the sidedef's X offset. For example, if the X offset is between 4096 and 8191, the texture is stacked twice, whereas if it is between 8192 and 12287, it is stacked three times. If the X offset is between 0 and 4095, the texture is tiled to fill the entire gap as described above.

Examples of PolyObjects in official levels

  • Greenflower Zone Act 2 features a set of PolyObjects near the end, on Sonic/Tails/Metal Sonic's part of the upper path. These use the Move by Waypoints action to repeatedly move along a square path.
  • In the first factory area of Techno Hill Zone Act 1, the upper path features two PolyObjects that move horizontally, using the Move PolyObject by Front Sector Displacement action for smoother movement.
  • Near the beginning of Techno Hill Zone Act 2 is a room where the player has to jump across platforms that are periodically obstructed by blocks that slide in and out of the walls. These blocks are implemented with PolyObjects that use the Move, Override effect. The movement is triggered once on level load with linedef type 399 and is then periodically repeated with the use of linedef type 450 and a timing effect.
  • There are two sets of PolyObject doors in Techno Hill Zone Act 2 that can be opened with nearby buttons: one in the Deton path, and one near the end of the level.
  • Deep Sea Zone Act 1 features several sets of pillars and walls that attempt to crush the player between them, using linedef executors to move towards each other as the player runs between them.
  • In Deep Sea Zone Act 2, the upper path in the first half of the stage a set of three horizontally-moving PolyObject crushers.
  • There are also two spindash-activated wheels in Deep Sea Zone Act 2 that open nearby PolyObject doors.
  • Near the end of Deep Sea Zone Act 2, after the waterslide section, there is a room lined with gargoyle doors: solving the puzzle reveals a couple of powerups hidden behind rotating PolyObject doors.
  • At the very end of Castle Eggman Zone Act 1, there are two wooden door PolyObjects that use the Rotate Right and Rotate Left effects to open, revealing the Signpost behind them.
  • Castle Eggman Zone Act 2 features numerous rotating PolyObject platforms: in the first tower at the start of the level, in the western outdoors area after the first Star Post, and at the very end of the level.
  • There are also several horizontally-moving PolyObject platforms in Castle Eggman Zone Act 2: in the eastern outdoors area after the first Star Post, and on both paths in the latter half of the level.
  • Underneath the big overhang in Arid Canyon Zone Act 2, there are three wooden PolyObject platforms, moving very slowly.
  • Arid Canyon Zone Act 2 has another wooden PolyObject platform on the west-most path, horizontally moving underneath rows of spikes that the player has to jump over.
  • At the beginning of Egg Rock Zone Act 2, the player has the choice between two rooms that both contain a button that opens the door to the rest of the level. The room to the right contains two sliding panels that the player has to navigate. These panels are PolyObjects that move with the Move by Waypoints effect, triggered on level load. The room to the left features five fans that the player has to navigate over. The fan blades are rotating PolyObjects.
  • At the beginning of the left path of Egg Rock Zone Act 2 is an outdoor room in which the player has to press a sideways button to open a door. This button is a PolyObject, slowly moving a fixed amount when the player gets close enough, giving the illusion that the player pushed the button.
  • On the left path of Egg Rock Zone Act 2 is a room with a large door that periodically opens and sucks players into space. Before the player can enter the room, the effect is demonstrated with three crates that are sucked into space. These crates are PolyObjects that move with the Move by Waypoints effect.
  • Right after the space suction room, there is a small room with several crushers, some of which are sideways. The right path contains a section with sideways crushers as well. These crushers are PolyObjects that move with the Move by Waypoints effect, triggered on level load.
  • Near the end of Egg Rock Zone Act 2, the player has to pass two rotating gears. These gears are made up of rotating, crushing PolyObjects. Since the gears as a whole would be concave, each cog is a separate PolyObject.
  • Aerial Garden Zone features small horizontally-moving PolyObject platforms throughout the level.

Parent/Child PolyObjects

PolyObjects can be linked to each other by associating a "parent" PolyObject with one or several "child" PolyObjects. This means that whenever a "parent" PolyObject is made to move or rotate, its "child" PolyObjects will automatically perform the same actions. This does not apply to the non-movement actions of linedef types 489, 490, 491 and 492.

To set up a PolyObject as a child of another, in addition to the normal setup, the control sector of the PolyObject's Parameters linedef should have its sector special value set to the PolyObject ID of the PolyObject to designate as its parent. Parent PolyObjects themselves can be set up as normal.

This feature is used once in SRB2 v2.2, by the first set of rotating platforms in Castle Eggman Zone Act 2.

See also