Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Sign in to follow this  
BigDickBzzrak

Opening overflow, what's that exactly?

Question

Ran into one of those today. Viewing openings is one of the options in DB2's Visplane explorer, but I haven't found too many mentions on that subject on DW.

 

DoomWiki has literally four sentences about openings, in the "static limits" page:

 

Quote

Openings/Solidsegs

The number of alternating regions of solid and transparent linedefs have some esoteric limits. If this exceeded, for instance with too many fenceposts, the game will crash. Like most things in the engine, openings are stored in a static array. Its dimensions are defined as "SCREENWIDTH * 64", giving a maximum total of 20480 for the vanilla resolution of 320x200.

From this crude description, I figured out that I had to delete some midtextures, that solved the problem. But that's not enough for me. I want to know what causes them.

 

tl;dr -- What the hell are openings?

Thank you, Doom gurus.

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 2

Sprites and middle textures are the last thing that Doom's renderer draws onto the screen. After it has already drawn all solid walls and all floors/ceilings, it begins drawing sprites and middle textures over them. The purpose of openings is to make sure that no sprites and middle textures will be drawn over walls or floors/ceilings that are perspectively in front of them.

 

While the renderer is drawing solid walls and floors/ceilings, it already checks which sprites and middle textures are going to be drawn later. When processing a particular sprite or middle texture at this point, the renderer may determine that, in order to make sure that the sprite or middle texture will be drawn properly, it will need to remember some information that is only available now in the middle of the process of drawing solid walls and floors/ceilings, but will no longer be available when drawing sprites and middle textures. So it will allocate space in the array of openings and store this information there, to be used later when the sprite or middle texture will actually be drawn.

 

The array of openings is really just an array of numbers. Each particular number stored into the array tells some information about the rendering/clipping of a particular column of pixels on the screen when drawing a particular sprite or middle texture. It's either the index of column in the sprite/texture's graphic that should be drawn in the given column on the screen, or the y coordinate that the renderer may not draw above, or the y coordinate that the renderer may not draw below. It seems that, depending on factors, 0 up to all 3 of these values may be allocated and stored (in different ranges of indexes in the array) for each column on screen per sprite or middle texture (but each one is either stored for all columns or not stored for any column of a given sprite or middle texture). Therefore, predicting the total number of openings would be hard.

 

The opening overflow happens when the renderer ends up allocating a greater part of the array than the array's size, which is "64 * screen width", usually sufficiently high but not foolproof enough if there's a lot of sprites or transparent middle textures in view.

 

P.S. The thread linked by EarthQuake contains a lot of incorrect info, even the most basic and general info and assumpions that people made in it are incorrect, including what I said in that thread myself. I didn't understand openings back then, in fact it was only today that I've looked into them in detail in the source code. Now it seems to me that nobody in the thread understood them at all.

Edited by scifista42

Share this post


Link to post
  • 1

Edit: Okay, I was close.

 

I think Maes explains it quite elegantly here: 

Keep in mind this is a renderer limit, so there are multiple situations where a MAXOPENINGS overflow can occur. It doesn't necessarily have to do with level geometry. I do believe that complex/alternating transparent patterns in textures can contribute to the openings limit, which explains why simplifying transparent regions of a texture can make the error go away.

 

Edit: Okay, I'm done editing now. :P

Edited by EarthQuake

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
Sign in to follow this  
×