Exporting subsector data to zscript
Moderator: GZDoom Developers
-
- Posts: 13885
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Exporting subsector data to zscript
This is something I would do on my own but I don't know enough about the engine to confidently know what data needs to be moved out.
This is for the native ZScript port of TDBots:
https://github.com/coelckers/gzdoom/compare/tdbots
TDRR said that he needed the subsector data in order to effectively build the bot nodes in a level. The nodes would help the bots more intelligently navigate the levels than what means are currently available for this.
This is for the native ZScript port of TDBots:
https://github.com/coelckers/gzdoom/compare/tdbots
TDRR said that he needed the subsector data in order to effectively build the bot nodes in a level. The nodes would help the bots more intelligently navigate the levels than what means are currently available for this.
-
- Posts: 2150
- Joined: Thu May 02, 2013 1:27 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: Exporting subsector data to zscript
I personally feel like having access to the split, triangulated mesh of the sector planes would work better for that, as well as being useful for more things than just the bots.TDRR said that he needed the subsector data in order to effectively build the bot nodes in a level. The nodes would help the bots more intelligently navigate the levels than what means are currently available for this.
I'm also not sure if it's a good idea to export the subsector data in general, either. It's very implementation detail-y, and exporting it would lock their implementation into what it is now.
[Edit] Regarding the latter point, I just remembered these two threads: thread 1, thread 2. Graf confirms what I said about them being an implementation detail in both of them.
-
- Lead GZDoom+Raze Developer
- Posts: 49211
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Exporting subsector data to zscript
And nothing has changed here, all those points still apply.
-
- Posts: 825
- Joined: Sun Mar 11, 2018 4:15 pm
- Location: Venezuela
Re: Exporting subsector data to zscript
As long as this is actually done in the end, I'm fine with this. Subsectors are easier to work with for me, but if it'd cause issues then I'm fine with anything that doesn't just involve using the sectors straight as they are.phantombeta wrote:I personally feel like having access to the split, triangulated mesh of the sector planes would work better for that, as well as being useful for more things than just the bots.
-
- Lead GZDoom+Raze Developer
- Posts: 49211
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Exporting subsector data to zscript
What are you trying to do?
-
- Posts: 825
- Joined: Sun Mar 11, 2018 4:15 pm
- Location: Venezuela
Re: Exporting subsector data to zscript
The idea was to place nodes at the center of each subsector. Link them, and prune out all nodes with no links, or any that are in a place no player would be able to fit in. I assume something similar is perfectly possible with the triangulated mesh, I just don't know exactly how yet.
-
- Posts: 8205
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
Re: Exporting subsector data to zscript
I would also find this useful for making monsters that have an AI navigation route. Generally I have to place nodes by hand and painstakingly link them by TIDs or have them take off NOBLOCKMAP and do a trace to any that can be seen in order to record them.Rachael wrote:TDRR said that he needed the subsector data in order to effectively build the bot nodes in a level. The nodes would help the bots more intelligently navigate the levels than what means are currently available for this.
-
-
- Posts: 3159
- Joined: Sat May 28, 2016 1:01 pm
Re: Exporting subsector data to zscript
In my opinion it would be better to triangulate the sectors in ZScript (using earclip or constrained delaunay triangulation) specifically for the purpose.
The quality of BSP subsectors is affected by many things since they have to subdivide the entire map (with the painters algorithm for the software render), which can create local areas with an unexpected high count of subsectors. Those areas could make the navigation mesh behave buggy in the worst case scenario (the route of that the bots would follow could be very unintuitive). A recompile of the map, or GZDoom rebuilding the nodes with a new node builder, would alter how the game behaves. In short: while it is tempting to use this shortcut, it is not a good idea.
The quality of BSP subsectors is affected by many things since they have to subdivide the entire map (with the painters algorithm for the software render), which can create local areas with an unexpected high count of subsectors. Those areas could make the navigation mesh behave buggy in the worst case scenario (the route of that the bots would follow could be very unintuitive). A recompile of the map, or GZDoom rebuilding the nodes with a new node builder, would alter how the game behaves. In short: while it is tempting to use this shortcut, it is not a good idea.
-
- Lead GZDoom+Raze Developer
- Posts: 49211
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Exporting subsector data to zscript
Triangulating sectors in Doom is a non-trivial matter, because there's no sanity checks for proper construction. How would you try to handle maps with open sectors, either due to mapping bugs or render hacks?dpJudas wrote:In my opinion it would be better to triangulate the sectors in ZScript (using earclip or constrained delaunay triangulation) specifically for the purpose.
-
-
- Posts: 3159
- Joined: Sat May 28, 2016 1:01 pm
Re: Exporting subsector data to zscript
Personally I would just not support it. Automatic node layout of this sort assumes some level of sanity for the input data anyway - it will never work universally for any imaginable mod out there.Graf Zahl wrote:Triangulating sectors in Doom is a non-trivial matter, because there's no sanity checks for proper construction. How would you try to handle maps with open sectors, either due to mapping bugs or render hacks?
Keep in mind this entire thread is based on the premise that you can build a navigation mesh by placing points in the center of the subsectors and then do line tests to the centers of any touching subsector to see which paths are valid. That entire strategy only go so far. Also, as far as I know UDB uses an earclip triangulator for its sectors, so any map built in that thing would probably work just fine for this.
-
- Lead GZDoom+Raze Developer
- Posts: 49211
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Exporting subsector data to zscript
Some of the IWAD maps would be affected, there's several with broken sectors in there.
-
-
- Posts: 523
- Joined: Mon Apr 09, 2012 12:27 pm
Re: Exporting subsector data to zscript
I kinda wish there were a highly portable (plain C?) library for triangulating Doom level geo, since I've seen enough people reinvent this over the years, that could be used in both engines and editors/viewers.
-
-
- Posts: 3159
- Joined: Sat May 28, 2016 1:01 pm
Re: Exporting subsector data to zscript
I'm not sure what your point is. It isn't trying to render the maps, so if it simply closes any subpath for a broken sector that would probably be good enough.Graf Zahl wrote:Some of the IWAD maps would be affected, there's several with broken sectors in there.
-
- Lead GZDoom+Raze Developer
- Posts: 49211
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Exporting subsector data to zscript
JPL wrote:I kinda wish there were a highly portable (plain C?) library for triangulating Doom level geo, since I've seen enough people reinvent this over the years, that could be used in both engines and editors/viewers.
As long as all sectors are properly closed, any generic triangulator would do. All the problems here come from those maps which have mapping errors like several of the IWAD maps (id's original editor made it far too easy to create broken stuff), or use open sectors for render hacks. There's no simple way to even construct proper polygons here that could be fed to a triangulator.
-
-
- Posts: 17481
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Exporting subsector data to zscript
If the goal here is to make bots that can navigate the IWAD levels, why not create LevelCompatibility fixes to close off those opened sectors?