Subsectors in zscript

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Subsectors in zscript

Post by Apeirogon »

Does there are any access to subsector from zscript? Or at least access to subsector some actor is in?
Because there are subsector field on actors on c++ side, but I see no trace that it exported to zscript.
Last edited by Apeirogon on Fri Nov 15, 2019 5:05 am, edited 1 time in total.
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Subsectors in zscript

Post by Rachael »

No, why do you need subsector access? Why can't you just use a regular sector?

This keeps coming up and I really have to wonder why anyone needs to access subsectors at all. It's a completely render-side function and it has nothing to do with anything outside of that. Even internally, actors use sector and line data, not subsectors, to do their stuff.
User avatar
phantombeta
Posts: 2089
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Subsectors in zscript

Post by phantombeta »

Rachael wrote:No, why do you need subsector access? Why can't you just use a regular sector?

This keeps coming up and I really have to wonder why anyone needs to access subsectors at all. It's a completely render-side function and it has nothing to do with anything outside of that. Even internally, actors use sector and line data, not subsectors, to do their stuff.
That's... Not really entirely true. IsPointInMap uses the render nodes internally, and that's a data scope function. They would actually be rather useful for anything that needs convex polygons of the sectors.
The reason they shouldn't be exported to ZScript, however, is not due to being useful or not, it's simply because doing so would make it impossible to change the implementation if necessary. (And would also lock GZDoom into having to use subsectors, which could very well change someday)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Subsectors in zscript

Post by Graf Zahl »

Precisely that. Subsectors are an internal implementation detail, exposing that would lock the engine to its current render method for all eternity.
With the current advances in graphics hardware it may well happen that the current render flow will eventually be scrapped because it'll be faster to process maps in larger chunks.
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm
Contact:

Re: Subsectors in zscript

Post by JPL »

See this prior discussion, where I wanted to get subsectors (because they're a smaller unit of spatial division than sectors that was useful for a particular thing I wanted to do): viewtopic.php?f=18&t=58060

Not contradicting anything the devs have said here to be clear; the reasoning seems entirely sound.
User avatar
Rachael
Posts: 13571
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Subsectors in zscript

Post by Rachael »

What I think would be better is if the mod makes its own subsectors - that way if they do get removed from the engine as phantombeta alluded to, the mod continues to work afterward.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Subsectors in zscript

Post by Apeirogon »

For homemade subsectors you should also also create some way to check is actor in sector subsector X, like creating zscript side blockmap or something more complex like bsp or k dimensional trees.
And this move you away from you original goal (I want use subsector to do X, not create subsector system and subsystems for system from scratch....life is pain :( )
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Subsectors in zscript

Post by Apeirogon »

Graf Zahl wrote:With the current advances in graphics hardware it may well happen that the current render flow will eventually be scrapped because it'll be faster to process maps in larger chunks.
Forgot to ask, but isnt they/it, graphics hardware, already fast enough to process levels without using of bsp and/or similar thing? Maybe not for something complex like community chest, but for default dooom/doom 2 levels.
Carmack said in 98, when released doom source, something like "on modern (as for 1998) hardware you can draw entire level, and still have fast enough rendering".
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Subsectors in zscript

Post by Graf Zahl »

It depends on the size of the level and also the amount of dynamic content - and of course on the hardware you are using.

On a modern graphics card you can render the entire level in one go - but try to do the same with currently supported low end hardware and things look very different.
The reason why we had to split off GL 2 support last year was that one render optimization that traded less CPU work for more GPU work caused severe slowdowns on such weak hardware.

No, in 1998 hardware was not fast enough for that. Intel's hardware wasn't even good enough for that in 2010, and lowest end stuff today still isn't.
Post Reply

Return to “Scripting”