Thok Barrier

From SRB2 Wiki
(Redirected from Thok barrier)
Jump to: navigation, search
File:Sample-thokbarrier.png
A simple thok barrier wall.

A thok barrier is simply an outer sector(s) that encloses the whole level. As well as looking more pleasant than normal walls, they also have the very important purpose of stopping the player from walking outside the level walls. All official SRB2 levels have them, as do almost all community-made maps.

Contents

Purpose

File:Bug-outsidelevel.png
A player walking outside the level.

The main reason behind the thok barrier is that it prevents glitches from happening in the game. Namely, a level without a thok barrier allows the player to speed outside the level, traditionally by thokking as Sonic. Even if they're inside the level, the camera can "leak" outside of the walls if the player is standing close enough to one. Knuckles also can't climb properly on the outermost walls if a thok barrier isn't there. On a lesser note, levels without thok barriers traditionally get cold responses from the community, resulting in constant, sometimes unpleasant, calls to make a thok barrier.

How to make a thok barrier

First, create a new level in your favorite map editor. Then, make one new rectangle sector. It can be any size; just make it reasonably large, such as 3000 units wide.

File:Tutorial-thokbarrier-1.png
But for this tutorial, we'll use a small 800x800 wide sector. Remember that you can always resize this later.
  • Then, make another sector inside of the first one. There should be a margin inbetween the two sectors. 64 units, or two gridlines in the default grid, is a good fit.
File:Tutorial-thokbarrier-2.png
A smaller sector inside of the first sector. The mouse pointer is highlighting one of the inner sector's lines.

Inside the inner sector is where your playable area, or the level room is going to be. Inside it, you can put any elements, such as rings or pits. The outer sector is going to be your thok barrier. You can't move into the outer sector or beyond it. Note that the lines, or walls, of the inner sector are the boundaries of where your player can walk. To make the thok barrier effective, lets edit the outer sector's properties!

  • Switch into the Sector Mode of your map editor. Select the outer sector and (in SRB2DB) right-click to edit its properties.
  • Set both ceiling and floor heights to 128.
    • A thok barrier must have the same ceiling height and floor height, though the height can be anything as long as it's equal to or below the level's ceiling. Outdoors areas usually have the height below.
  • Set the sector's graphics. Make the ceiling graphic F_SKY1.
  • Make the floor graphic GFZFLR01.
    • If the thok barrier's height is below the level's ceiling height, the ceiling graphic must be set to F_SKY1. The floor graphic can be anything.
File:Tutorial-thokbarrier-3.png
What your sector's properties will look like afterwards.

Great! Were you expecting more steps? That's your basic thok barrier. But let's not celebrate just yet; we have to set up the inner sector, too.

  • Close the outer sector's properties. Select the inner sector and right-click to edit that sector's properties.
  • Inside a correctly set thok barrier, the level sectors can be handled normally. That's to say that their floor and ceiling heights can be anything; platform or pit shapes can be drawn; and the level's floor and ceiling graphics can also be anything. Keep in mind that if the thok barrier's height is below the level's ceiling height, the ceiling graphic must be F_SKY1.
    • Make the ceiling 4096 units high. Make the floor 0 units high.
    • Set the ceiling graphic to F_SKY1.
    • Set the floor graphic to GFZFLR02.

If you already knew how to set up a simple level, that should be doable. However, a new trick here is to set the inner sector's walls differently.

  • Close the inner sector's properties. Switch into the Line Mode of your map editor.
  • Select the four lines of the inner sector. Right-click to edit the lines' properties.
  • Click on the "Sidedefs" tab.
  • In the "Front Side" box (the checkbox should be checked), set the Below texture to GFZROCK. The other textures can be left blank.
    • This step is important. If the inner sector's textures aren't set, the thok barrier will still work, but it will appear glitchy.
File:Tutorial-thokbarrier-4.png
What your linedefs' properties will look like afterwards.

Congrats! You're done! Now all you need to do is put a Player 1 Start in the inner sector, and maybe some rings and a spring, and then test the level!

File:Tutorial-thokbarrier-5.png
What your level will look like if done correctly.

Notes

  • Note the strip of wall to the far right. That's the thok barrier.
  • If you use the spring, you can spring above the wall; regular walls don't allow that.

Telling if a level has a thok barrier

If the level is outdoors, one can easily tell if the level has a thok barrier if there is a thin strip of outer wall that the player can't touch. Otherwise, thok barriers are easy to recognize in map editors; they're a noticeable "outline" that wraps around the level.

Personal tools