User:Jazz/Sandbox2

From SRB2 Wiki
Jump to navigation Jump to search
Note
Another day, another tutorial.

Overview

Sector-based spike rows are basically what the name implies, spikes made out of sectors. They have a variety of advantages and disadvantages when compared with thing-based spikes.

Advantages

  • These have much better collision detection than rows of thing-based spikes.
  • They can be manipulated to make spikes that retract and pop up, like in the classic Sonic games.
  • They can be used to create spikes out of the SPEC09 and SPEC10 textures without importing any graphics.
  • They are much more versatile in that they can be used to make spikes than can move on floors, ceilings and even FOFs. These can be used to create full floor to ceiling spike crushers or even recreate the spike crushers from Marble Zone in Sonic 1. Spikes using things are much less flexible in this respect.

Disadvantages

  • Overuse will create large amounts of graphical lag in both rendering modes.
  • They are more difficult and more time consuming to create.

Tutorial

This tutorial will explain how to create a variety of different kinds of sector spikes.

Getting Started

In order to complete this tutorial, understanding of certain aspects of map and lump editing will need to be fully understood:

  • Advanced knowledge of the use of FOFs and FOF stacking.
  • Know how to turn auto-stitching on and off if using a map editor that supports it.
  • Understanding on how to import custom textures into a WAD.

Basic Sector Spikes

The first item on the tutorial is the easiest sector spikes to create: static floor spikes.

Grabbing Some Spikes

The easiest way to create a set of sector spikes is to copy and paste the sector spikes used in Greenflower Zone Act 1 and use them as the basis for your own creation. These spikes lie at the choke point between the hallway and the area containing the end of the level. Copy both the spike sectors and the control sector to its right. Open up a new map, create a thok barrier and paste the spikes and control sector into the map.

So, How Do They Work?

Sector spikes consist of four parts:

  • A control sector containing a Fake Floor linedef.
  • A rectangular sector holding the spike formations.
  • An array of 2 fracunit triangles that make up the center of each spike.
  • An array of three triangle clusters that make up the edges of each spike.

The Fake Floor is tagged to both the triangle clusters and the surrounding rectangle. This allows the player to see through what would otherwise be a solid rectangular sector to see each individual spike. The ground is rendered at the level of the ground around it, rather than rendered at the spikes actual height, which is 42 fracunits higher than the ground.

The rectangular sector buffers the spikes and gives them a clean and solid barrier for the player to collide with. This is one of the reasons why sector spikes have better collision detection than Thing-based spikes.

The cluster of triangles surrounding each main spike triangle gives each spike their distinctive edges. On each of the three triangles, the linedef that extends directly outward from the center of the spike has the SPIKE1 and SPIKE2 textures applied to its front and back middle linedefs respectively. These are then given Lower Unpegged properties and a -42 fracunit Y-offset. These cause the textures to align with the spike perfectly at the floor and at the top.

The center triangle is a simple 3-sided cylinder than creates the backbone of each spike. This is what gives each spike its distinctive dark gray center.

Getting the Spikes to Work

For the purposes of this tutorial, set the floor and ceiling heights of the general map to 0 and 256 respectively. Make both the thok barrier's floor and ceiling 256 as well. Feel free to texture the level in any style. After this is done, change the floor height of the sectors that were cut and pasted to 42 fracunits above whichever surrounding floor they are situated on. Change the floor flat of the triangle clusters and surrounding rectangle to fit the level. Do not change the flat on the center triangles.

Once this is done, change the sector tag of the triangle clusters and rectangle to one for the purposes of the tutorial. Change the sector tag of the control sectors linedef to one as well. Change the floor height of the control sector linedef to match the floor height of the area where the spikes are situated.

Once this is done, the spikes should appear properly in the new map. Feel free to run a test on the map and take a look. Stepping on top of the spikes should kill your character with the characteristic spike sound.

Movable Floor Spikes

Movable floor spikes can be used for one of two purposes:

  • Retractable spikes that pop out of the floor, then recede.
  • Spike crushers that pin the player between spikes and another solid object.

Each method has a slightly different method of approach.

Retractable Floor Spikes

Creating spikes that pop out of the floor than recede require a normal set of spikes, a control sector containing a Basic FOF Block linedef, as well as two back-to-back control sectors with two Continuous Floor Mover linedefs.

Tag the Basic FOF Block linedef to the same tag as your Fake Floor. This will provide the collision buffer for when the spikes go underground. The player will be able to walk over this area without taking damage, when the spikes have receded. Be sure to texture the block appropriately so that it looks exactly like the floor around it.

Next, tag one Continuous Floor Mover linedef to all spike sectors, except the base triangles. Tag the second linedef to the base triangles, as they are a separate sector tag from the Fake Floor. Set the floor of one control sector to 42 and the other to -42. This will allow the spikes to rise and fall constantly.

Test the map. The character should be able to run over the floor unharmed when the spikes are not visible.

Floor Spike Crusher

Creating a floor-based spike crusher is a bit more complicated than retractable spikes. These require a dedicated Fake Floor control sector and two sets of two back-to-back control sectors, one with two Continuous Floor Mover linedefs and the other with just one mover linedef.

Just like with the retractable spikes, tag the two Continuous Floor Mover linedefs to the required parts of the spike sectors. Set the floor height of one sector to 214 and the other to 42. This will cause the spikes to rise, fully contact the ceiling but not go through it, then move back down to the floor.

However, simply testing the map in this form will cause the spikes to appear to extend from the floor as though they were "spears" rather than spikes. This may be a desired effect if attempting to recreate the underwater spears from Labyrinth Zone in Sonic 1 for instance. If a solid crusher base is desired, continue to the next step.

Give the dedicated Fake Floor control sector its own tag. Tag the other floor mover linedef to it. Set one sector's floor to 172 and the other to 0. Notice that these values are the simply the other control sectors' values with 42 subtracted. This is so that the Fake Floor will always reveal the spikes, but not reveal anything below that point. That is what causes a solid "crusher" to appear.

Test the map. It should appear as a block jutting from the floor with spikes and their associated damage attached.

Ceiling Spikes

(Currently theoretical since I cannot test these from the location from which I am editing.)

Ceiling spikes have a similar function as floor spikes, except that the application will be different due to certain limitations in the current version of SRB2. Sector Type 4 which handles spike damage, only affects floors, not ceilings. Therefore a certain degree of "fudging" must be performed to get ceiling spikes to function properly.

What is this workaround you speak of?

First of all, in order to get spikes to render properly on the ceiling, a set of flipped sprite textures will need to be added to the WAD. These can be made manually by flipping them in MSPaint and resaving them, or simply downloading a copy here. (need to upload)

Once this is done, take a set of floor spikes and make a copy. Paste it elsewhere in the level. Change the sectors so that instead of jutting 42 fracunits up from the floor to jut 42 fracunits down from the ceiling. Tag a Fake Floor control sector to it and set the ceiling height to that of the sector surrounding the new spikes. (256 if you followed the previous parts of the tutorial.)

For the purposes of this tutorial and the included custom texture file, SPIKE3 is a flipped version of SPIKE1 and SPIKE4 is the flipped version of SPIKE2. Run a Find/Replace on the spike sectors and replace all SPIKE1 with SPIKE3 and SPIKE2 with SPIKE4. After this is done, set these linedefs to become Upper Unpegged with a Y-offset of -42. This will cause the spike textures to correctly align themselves to render downward facing spikes. After this is done, testing the map should show a set of spikes hanging from the ceiling. However, there will be two distinct problems:

  • When touching the floor underneath the ceiling spikes, the player will take damage.
  • When touching the actual spikes, no damage is taken.

To solve the first problem, change the sector type of the spike sectors to 0. The second problem is slightly more complicated to solve. Create three control sectors. Two of these will contain Intangible, Invisible FOF linedefs, and the other will contain a Trigger Each Time linedef. Set the floor and ceiling of both FOF control sectors to have their ceilings match the ceiling of the spike sectors and their floor to be 24 below that value. This will cause the combined spike/FOF mess to extend an even 64 fracunits from the ceiling.

Set one of the FOFs to have a sector type of Sector Type 11 which deals generic non-elemental damage to any player that enters it. Set the second FOF to have a sector type of Sector Type 974 which will trigger a linedef executor if any player enters the sector. With the third control sector containing the linedef executor, tag the executor to the Sector Type 974 control sector. Once this is done, add a Linedef_Type_115 and set its length to (lol I don't know yet.) When executed, this will play the spike pain sound.

Run the map. When contacting the spikes, the player should take generic damage and trigger the playing of the spike pain sound. This complicated method works around the limitation of a lack of ceiling spike damage hard-coded into the game.

Movable Ceiling Spikes

(And you thought the previous part was complicated. =P)

Spikes on FOFs

One-sided Spike FOF

Double-sided Spike FOF

Movable Spike Platform

The Future

Double-sided Polyobject Spike Platform

The heart and soul of the Vibrant Vendetta Zone. All will prostrate themselves before the almighty lord of floating hazards.