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.

Subsectors in zscript

Postby Apeirogon » Thu Nov 14, 2019 6:08 pm

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.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Subsectors in zscript

Postby Rachael » Thu Nov 14, 2019 6:11 pm

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
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Subsectors in zscript

Postby phantombeta » Thu Nov 14, 2019 6:23 pm

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
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Subsectors in zscript

Postby Graf Zahl » Fri Nov 15, 2019 3:38 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Subsectors in zscript

Postby JPL » Fri Nov 15, 2019 12:13 pm

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
JPL
 
 
 
Joined: 09 Apr 2012

Re: Subsectors in zscript

Postby Rachael » Fri Nov 15, 2019 12:32 pm

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
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Subsectors in zscript

Postby Apeirogon » Fri Nov 15, 2019 12:57 pm

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 :( )
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Subsectors in zscript

Postby Apeirogon » Sat Nov 16, 2019 11:36 am

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".
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Subsectors in zscript

Postby Graf Zahl » Sun Nov 17, 2019 1:44 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Scripting

Who is online

Users browsing this forum: Awario [RSS] and 1 guest