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

Weird level hack: Decoupling linedefs and segs

Recommended Posts

Hi, I've made a weird effect that I am not sure anyone has attempted before. I was thinking about how basically every modern 3D game has some variant of collision hulls - the detailed 3D models you see on screen are not actually what the games uses for collision detection, instead it uses simplified, invisible geometry that basically follows the actual geometry you see onscreen. It occurred to me that you could sort of do a similar thing in Doom.

First things first, play this WAD (MAP01) in any engine that more-or-less retains the original rendering code. That means doom2.exe (duh), Chocolate Doom, PrBoom, Doom Retro, Eternity, possibly some others:

https://www.dropbox.com/s/06x5jtp08uud1np/segroom.wad?dl=0

Try shooting, moving around, IDDT in the automap. Basically, as far as the collision detection / automap is concerned, you are in a square room, but as far as the renderer is concerned, you're in a bigger, wavy-walled room:



If you try loading the WAD in an editor, or for that matter in a port like GZDoom that basically regenerates all the segs from scratch, all you will see is the smaller square room.



Here's a brief overview of what I did for posterity.

First I made a level like this, and exported the THINGS, SEGS, NODES, SECTORS, and SSECTORS:



Then I edited the level to add a square in the middle, and exported the VERTEXES:



Then finally I deleted the exterior wall and exported the LINEDEFS, SIDEDEFS, and BLOCKMAP:



After all this, I had to do a little hacking. Because my editor automatically renumbered the vertices, I had to manually hex edit the LINEDEFS lump so that the starting and ending vertices were the proper ones (24 through 27 instead of 0 through 3, in this case). I also had to edit the SEGS lump, because all the segs were pointing to now-nonexistent linedefs, so I pointed them all to linedefs 0 through 3. Then I compiled them all into one Frankenstein WAD.

The result is that as far as the game's renderer is concerned, the level looks like the first screenshot, but as far as the collision is concerned, it looks like the second.

This is probably a totally pointless hack with no real world use. However, you could potentially use it to add scenery to a level that would be effectively impossible to see on the automap / in a level editor, which could provide a neat trick for something.

Share this post


Link to post

That's very interesting indeed.

And I actually see a potential interest of it: adding a kind of signature (like a secret room) to your level that very few people would be able to delete since it's not easily modifiable in a map editor.

That way you can be sure nobody will claim your work as his, or at least you have a proof that it's your, or that a particular level is a modification of yours.

Share this post


Link to post

It's not easily modifiable because all map editors delete all segs and the resulting orphaned vertices when opening a map, no questions asked.

Share this post


Link to post
Foxpup said:

It's not easily modifiable because all map editors delete all segs and the resulting orphaned vertices when opening a map, no questions asked.


Do you mean that if you were to open a map with a "signature room", let's call it, in a map editor, then save it, it will just erase that room altogether?

In that case, it's pretty useless indeed... :)

Share this post


Link to post
tomatoKetchup said:

Do you mean that if you were to open a map with a "signature room", let's call it, in a map editor, then save it, it will just erase that room altogether?

Some editors won't really save a map unless it was actually modified, but otherwise, yes.

Share this post


Link to post

couldn't you achieve a more or less similar effect using untextured double-sided impassable lines? i put them in decorative inlets a lot if i don't want players getting snagged on map geometry, though you could move them further away from the walls as in your example, i suppose

the main functional difference in play (i.e. ignoring back-end stuff like linedef count, sidedef count, etc., as the differences there are significant) is basically that projectiles would be blocked by the uncoupled segs/linedefs method, right?

that being said it is really cool from a technical standpoint

Share this post


Link to post
Hambourgeois said:

couldn't you achieve a more or less similar effect using untextured double-sided impassable lines?

the main functional difference is basically that projectiles would be blocked

That's right, and it's actually a significant difference (think about line of sight checks as well). However, Linguica's new method seems impractical to implement in common maps, as it requires hex editing accustomized to the particular map parts. That is, until there will be sophisticated level editors with special features to create separate "visual" and "collision" components of a Doom map and then hack the geometry lumps appropriately to make it work.

I agree that it is cool from a technical standpoint, definitely.

Share this post


Link to post

Neat hack! Things like this are half the fun of video games.

I used SLADE to hack an imp into the void between the square and the wavy wall. He can only detect me if my hitbox touches his. Then he wanders around and scratches me if I get too close. He tries to shoot fireballs at me when hat happens too. It's funny like a dog scratching at a glass door.

I was pleasantly surprised to see the imp's wandering was constrained by the linedefs the collision code doesn't otherwise see. Well, that was the case until I decided to noclip and try to kill him. Turns out projectiles don't work in the void.

Maybe someone can find a purpose for visible void monsters.

Share this post


Link to post

yeah, i didn't articulate it well, but my point was basically that, in the absence of advanced editing tools that let you easily mess with all the stuff linguica had to hack in with a hex editor, this isn't a practical technique for most mappers. especially given that most modern editors idiot-proof segs as described by foxpup.

that isn't to say it wouldn't be useful to get such tools, however.

Share this post


Link to post
Aliotroph? said:

I was pleasantly surprised to see the imp's wandering was constrained by the linedefs the collision code doesn't otherwise see.

Really? Are you sure? The blockmap only knows about the square room so it seems strange that a monster would notice the segs at all.

Although I guess the boundaries of the sector are at the outer wall... I guess I forget how the monster collision code works exactly.

Share this post


Link to post

The imp seems to just start walking circles around the square sector. It wanders a bit more in the corners, but never ventures out on its own. When I noclipped into the void the imp followed me around, but when i went back to the square it started circling again, but with a greater tendency to collide with the walls.

Share this post


Link to post
Aliotroph? said:

The imp seems to just start walking circles around the square sector. It wanders a bit more in the corners, but never ventures out on its own.

Couldn't it be a coincidence? Monsters usually don't wander far from the player in a situation like this.

Aliotroph? said:

When I noclipped into the void the imp followed me around

So he didn't actually collide with the walls, right? Here we go.

EDIT: I did the same experiment you did. I've seen the same things you've described. I think the seeming collision is a coincidence as I said before.

Share this post


Link to post
Hambourgeois said:

that isn't to say it wouldn't be useful to get such tools, however.

I don't see how it would be, honestly. You can make invisible collidable walls easily enough in the Doom engine so it's not like this provides anything more useful for that purpose. I racked my brain for a bit before making this thread to try and think if there was any legitimate use for this, but all I could think of was making wall detail in a gimmick contest where you had a linedef limit (lol)...

Sodaholic said:

Eternity's renderer is actually a total rewrite.

THANKS SODAHOLIC

Share this post


Link to post
Aliotroph? said:

The imp seems to just start walking circles around the square sector. It wanders a bit more in the corners, but never ventures out on its own. When I noclipped into the void the imp followed me around, but when i went back to the square it started circling again, but with a greater tendency to collide with the walls.


That sounds about right. Remember: Doom uses the BSP to determine an actor's sector, so the hacked BSP will be used for that. Of course the real linedef will still be used for collision testing so the Imp cannot pass that.

Share this post


Link to post
Graf Zahl said:

Remember: Doom uses the BSP to determine an actor's sector, so the hacked BSP will be used for that.

But doesn't every point on the map space, even if it's outside the map, still end up resolving to a sector? E.g. you can still be hurt by a damaging floor in certain spots even if you're outside the boundaries, which is how that E1M8 void glide demo is possible.

Share this post


Link to post

Yes. Technically nothing is outside of sectors. The BSP is used to divide the world into sectors.

Share this post


Link to post

I can see a use for this hack: depriving ZDoom and other such ports of detail that would only appear on ports that are faithful to vanilla.

Share this post


Link to post
Graf Zahl said:

That sounds about right. Remember: Doom uses the BSP to determine an actor's sector, so the hacked BSP will be used for that. Of course the real linedef will still be used for collision testing so the Imp cannot pass that.


Of course. My confusion is really over the nature of the AI. Do the monsters prefer to occupy the closest sector to the player at all times? It was strange to see it do laps instead of wandering beyond the fake walls. It hit them sometimes and partially passed through, but always turned around unless I walked out into the void.

Share this post


Link to post
printz said:

I can see a use for this hack: depriving ZDoom and other such ports of detail that would only appear on ports that are faithful to vanilla.



Ha, ha, ha!
You wouldn't think if this nonsense really caught on that something could be done about it to make it render as intended, would you?

This is typical Doom community attitude: Find a glitch and the first urge is thinking how to abuse it. Ugh...

Share this post


Link to post
printz said:

I can see a use for this hack: depriving ZDoom and other such ports of detail that would only appear on ports that are faithful to vanilla.

Hehe. Reminds me of a map by TimeOfDeath where he included some totally useless lines just to make it crazh in ZDoom.

Share this post


Link to post
Graf Zahl said:

Ha, ha, ha!
You wouldn't think if this nonsense really caught on that something could be done about it to make it render as intended, would you?

This is typical Doom community attitude: Find a glitch and the first urge is thinking how to abuse it. Ugh...


This is typical Graf attitude: Cry about anything that doesn't fit into a modern sourceport design. Even if it's a joke.

Share this post


Link to post
Randy87 said:

This is typical Graf attitude: Cry about anything that doesn't fit into a modern sourceport design. Even if it's a joke.



Joke or not, for source port developers it can be a major problem if some people who find something unexpected start abusing such an exploit instead of reporting it. I have lost count how many bugs can't be fixed for good due to this.

Share this post


Link to post
Graf Zahl said:

This is typical Doom community attitude: Find a glitch and the first urge is thinking how to abuse it. Ugh...

I would consider this one of the best aspects of the Doom community.

Share this post


Link to post

What? To make it impossible to fix serious bugs?
Or to abuse a bug to intentionally make an engine crash?

I'm not talking about finding some quirk and investing some time to understand it but specifically not to question and trying to understand the underlying causes of what happens and then create a mess.

And what I find inexcusable is to abuse glitches to make ports which are more sensitive to them crap out. And that's what some people here suggested.

That said, GZDoom won't be the victim of such pranks, I would take the time and implement a workaround, but I think a port like Doomsday would be in a far worse situation.

Share this post


Link to post
Graf Zahl said:

And what I find inexcusable is to abuse glitches to make ports which are more sensitive to them crap out. And that's what some people here suggested.

I dunno, "inexcusable" is such a strong term... it's not very nice, but it's a well delivered kick in the pants. Too often ports deviate from Doom, because their devs think they know better. Reminding them they're not allowed to redefine the standard can be worth it sometimes.

Share this post


Link to post

To be fair, not all ports aim to be Doom, or their aim can move away from being Doom. Some prefer just to expand to being a modern take of the idtech 1 engine or something based on it, with Doom compatibility.

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
×