Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sneezy McGlassFace

Drawing lines clockwise vs counter-clockwise, what's the deal?

Recommended Posts

You may have heard people talking about drawing sectors clockwise or counter-clockwise. That line has left side and right side. Back side and front side. What's all that mean? And were did it come from?

 

UDB, DBX, and vast majority of modern editors (best of my knowledge) don't care about the order you draw your lines in. It makes sure they're facing the right way, and flip them if necessary. But some editors do care. Eureka is my daily driver, a distant member of the DEU family. DEU and Eureka both care very much how you draw, so let me explain.

Every line is a vector between two points. The first vertex you place is the starting point, and the second vertex decides direction, and termination point.
It's decided that the right side of any line is the front. Marked by the little nipple that sticks out.
image.png?ex=65144af9&is=6512f979&hm=680


So if we have a 256x256 square room, all 4 lines must have their right side facing inward, because they're single-sided. If you have a single-sided line facing out into the void, you have a problem.
image.png?ex=65144af9&is=6512f979&hm=fc7

 

Notice the arrows. They all go in clockwise direction. To enclose the space within.
image.png?ex=65144af9&is=6512f979&hm=804

 

Now, let's make two things: Pillar and sector within sector.

 

1. Pillar
For the pillar to work, we need exactly the same thing as is but in reverse. There is sector all around, but we want to make a void inside to form a pillar. So we draw the lines counter-clockwise. For the lines to be facing out. The back side of one sided line is always facing the void

 image.png?ex=65144af9&is=6512f979&hm=564

 

2. Sector-in-sector
For sector-in-sector to work, it's more tricky. We draw lines clockwise, again. So the lines are facing inward, and create another sector.
Now, modern editors are smart but let's see what they do under the hood:
The big room sector has a reference 0. It's the first sector made, and the reference number didn't change. Now, every line in the second sector we just made must become double sided, possibly invisible, pass-through, and have most importantly: the back side face sector 0, and front face freshly made sector 1.

But Sneezy, I hear you say, I can have these two-sided lines facing outward as well. And you're very correct. But they need to be drawn first, and flipped later. If you're interested how flipping lines work, it's just swapping the starting and ending vertex references. So if you flip a line that goes from vertex 14 to 15, it will go from 15 to 14, and face the other way.
image.png?ex=65144af8&is=6512f978&hm=681


Sector 1 now has the same properties as sector 0, which surrounds it. Properties like brightness, flats on floor and ceiling, special type, tag number. Specials or other properties may not carry over.
This is what the ancient DOS and Win3.1 editors struggle with the most. Making sectors in sectors, and automatically, and correctly reference the side-defs. Eureka does a great job, DEU not so much. Luckily it allows you change the references as you please.

image.png?ex=65144af7&is=6512f977&hm=a96

 

Bonus Fun fact, you know about the secret stairway in E4M3, which triggers like 19 secrets with each step counting as one? This is why. The secret sector was built first, and the entire stairway carried over all the properties, including secret tag.

Edited by Sneezy McGlassFace

Share this post


Link to post

Nice summary!

 

I also use Eureka.

 

Heh - yes I'm frequently caught out by this - making void when I meant to make a sub-sector.  I tend to always draw clockwise, and then simply delete the sub-sector if I really do want void (a pillar for example).

 

If you do want a sub-sector with front-side OUT (a plinth for switches perhaps?) create the sub-sector (clockwise), highlight all linedefs, and hit 'w' (flip linedefs).

Share this post


Link to post

It does matter in DB and derivatives too, the primary side is placed right to the direction you draw by default as usual.

 

DB tries to detect what you're doing but it doesn't always work as expected.

 

Drawing new geometry outside existing geometry counterclockwise can lead to the "outside" of the map becoming a sector and you can imagine the only button you need after that is Undo, lol.

 

That said DB does tend to discard the new drawing if it cannot work out what you want but moreso, draw new geo clockwise in empty space.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×