Expose subsectors to ZScript

Moderator: GZDoom Developers

User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm

Expose subsectors to ZScript

Post by JPL »

In native code each sector has a list of its subsectors, but this isn't exposed to ZScript (and there's no SubSector struct on the ZScript side). I realize that subsectors are more of an implementation detail than sectors/linedefs/vertices etc, but I have a specific project that could use this, and I can think of other possible uses that let modders reason about map geometry in a more granular way (than Sectors which can be very large and complex, ie "all things in a sector" isn't very specific). Creating a Seg struct for ZScript would also be useful as it lets us see eg which vertices are part of a subsector.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expose subsectors to ZScript

Post by Graf Zahl »

Absolutely not! The subsectors are strictly part of the render data. Plus, in order to support maps with non-GL nodes which may feature some node building quirks, the engine keeps a copy of the original subsectors and nodes - but not the vertices because they are not needed to get a sector from a point.

Aside from that we cannot rule out that at some point in the future a subsector-less renderer may be implemented and exposing those to scripting would pretty much make that impossible.
The playsim actually never bothers with subsectors, with the sole exception of running P_PointInSector and that will have to remain so.
User avatar
Rachael
Posts: 13926
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Expose subsectors to ZScript

Post by Rachael »

He probably was not clear in the original post, would this data be unavailable to the UI side of ZScript, as well?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49226
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expose subsectors to ZScript

Post by Graf Zahl »

The subsectors should be off limits to everything except the renderer. It is an implementation detail of how the renderer processes its data and should never ever be used for anything else, convenient as it may be.

Exposing this in any way to mods will create a hard locked dependency on the current rendering algorithm and may prevent future changes in this area that may require a different type of low level data.
User avatar
Rachael
Posts: 13926
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Expose subsectors to ZScript

Post by Rachael »

The use case that he quoted for me in creating this suggestion is as thus:

Code: Select all

[5:35 PM] jplebreton: asking partly because my old WADbot project uses a very out-of-date gzdoom i hacked to support its weird way of combing maps for screenshots, and i'd rather reimplement all that in zscript rather than maintain my terrible C++
[5:39 PM] jplebreton: fwiw, what the wadbot-gzdoom does is, when you run a ccmd called "goodshot" it warps the player to the center of every subsector in the map, faces the center of its sector, records the "scene complexity" (ie the kind of stuff stat renderstats displays, vertices walls flats and sprites), then finds the 3 most "complex" scenes in the map and takes screenshots from those saved PoVs.
(edited for relevancy)

This was why I suggested he come here with it, because I initially had the same argument you did. It's a valid, if not unorthodox, use case for it, but I can understand the logic behind still denying it if even this idea is too out of league - I just figured it's what made it worth suggesting in the first place, for your consideration.
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm

Re: Expose subsectors to ZScript

Post by JPL »

Graf Zahl wrote:The subsectors should be off limits to everything except the renderer. It is an implementation detail of how the renderer processes its data and should never ever be used for anything else, convenient as it may be.

Exposing this in any way to mods will create a hard locked dependency on the current rendering algorithm and may prevent future changes in this area that may require a different type of low level data.
Very sound explanation, thanks for providing it! I completely understand. It's quite possible I can find other ways to get what I'm after without subsectors.

Return to “Closed Feature Suggestions [GZDoom]”