ZDoom-Templated (map randomized at runtime from prefabs)
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
ZDoom-Templated (map randomized at runtime from prefabs)
Here's a POC script I made to test the limits of dynamic map generation.
On each level load the script will assemble the parts found in MAP01.wad into a map that makes sense (i.e. all parts are used and areas are matching).
Terminology:
1. Fragment — a single section/prefab; closed group of sectors
2. Area — a semi-closed group of fragments (may have connections to other areas)
3. Fragment portal — a line of certain size (width x height) and texture (TPLAREA# where # is 1-6). The line is converted into a line portal, so it must have empty space behind.
Fragments will be connected by fragment portals with matching areas. This allows making areas behind key doors, as illustrated in the sample.
Modes:
1. Static portals mode (currently default): will move sectors around physically and rotate them
2. Dynamic portals mode (can be switched by setting GENERATE_STATIC_PORTALS to zero): will create simple teleporters
Limitations:
- Dynamic lights are broken if two sectors occupy the same 2D space as a result of static portal linking (caused by GZDoom)
Supports:
- Slopes
- 3D floors
- Rotated / scaled surfaces
I believe even without fancy sector features this is already great for a nice gameplay experience, but I can't see myself mapping anything complicated anytime soon, so I'm releasing it as a resource and not as a level
This code can be reused freely with or without credits and you don't have to contact me about it (MIT)
You do not have the required permissions to view the files attached to this post.
Last edited by ZZYZX on Mon Aug 07, 2023 7:28 pm, edited 7 times in total.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: ZDoom-Templated (map randomized at runtime from prefabs)
Update! The new version will correctly handle texture scale, rotation and offsets on floors and ceilings of rotated static portals.
Slopes will still have issues because the pull request to enable fixing them is not there.
Also due to the same pull request texture coordinates will be completely wrecked, but hopefully this can be fixed even if the slopes are not merged.
I also fixed calculation of the center of a fragment, which heavily affected rotation of fragments (they were not where you'd expect them to be looking at the map, and could intersect with each other creating invalid geometry).
Slopes will still have issues because the pull request to enable fixing them is not there.
Also due to the same pull request texture coordinates will be completely wrecked, but hopefully this can be fixed even if the slopes are not merged.
I also fixed calculation of the center of a fragment, which heavily affected rotation of fragments (they were not where you'd expect them to be looking at the map, and could intersect with each other creating invalid geometry).
-
- Posts: 117
- Joined: Sat Apr 01, 2017 5:11 pm
- Preferred Pronouns: He/Him
- Graphics Processor: Intel (Modern GZDoom)
- Location: United States
Re: ZDoom-Templated (map randomized at runtime from prefabs)
I've played through the map a few times, and I love it! I think it functions neatly and I haven't encountered bugs. Beautiful concept and feature, I hope this map becomes popular!
-
- Posts: 237
- Joined: Tue Jul 31, 2007 10:56 am
Re: ZDoom-Templated (map randomized at runtime from prefabs)
This is really cool! I wanted to mention that I've noticed a few limitations with the static portals in this script that aren't usually a problem with static portals - reflective floors have visual glitches, dynamic lights don't pass through the portals, and I've seen the tops of some midtextured linedefs on the other side of a portal sort of cutting off when approached.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: ZDoom-Templated (map randomized at runtime from prefabs)
Haven't tested dynamic lights, midtextured linedefs definitely should not break though, that's weird.janiform wrote: ↑Sun Oct 16, 2022 9:59 am This is really cool! I wanted to mention that I've noticed a few limitations with the static portals in this script that aren't usually a problem with static portals - reflective floors have visual glitches, dynamic lights don't pass through the portals, and I've seen the tops of some midtextured linedefs on the other side of a portal sort of cutting off when approached.
-
-
- Posts: 1384
- Joined: Sun Oct 14, 2012 1:43 am
- Location: Ukraine
Re: ZDoom-Templated (map randomized at runtime from prefabs)
Update (suddenly)
I added plane slope rotation and enabled vertex offsets since latest GZDoom version allows those. Vertex slopes and 181 special slopes should work normally. Plane copy slopes will probably break if planes refer to different fragments (but that is expected).
1st post contains the new version.
Saw the dynamic light issue, it seems to be a generic issue with portals that are occupying the same XY space. The only good solution to this is using 3D shadowmaps which are not available yet
Or attempting to make levels in a way that they never can intersect (e.g. only doing straight passageways).
I think the script could attempt resolving portal connections in a way that 2D geometry never overlaps, by using a blockmap or so. The problem with this is that while possible it could easily cause unrecoverable "missing piece" problems, if the only possible solution is to overlap.
Easier is to introduce some kind of a custom dynamic light that only renders when you directly see it (or the fragment it's in). And then it will be pretty much like Build where you get visual artifacts if you see two sides of a portal at once.
3D floors cannot be added because 3D floors are not yet filled into the sector during preprocessing, and even sector tags are not available, so it's not possible to manually resolve 160 specials either.
Requires GZDoom patch.
UPD: Worked around this. Updated the archive yet again.
I added plane slope rotation and enabled vertex offsets since latest GZDoom version allows those. Vertex slopes and 181 special slopes should work normally. Plane copy slopes will probably break if planes refer to different fragments (but that is expected).
1st post contains the new version.
Saw the dynamic light issue, it seems to be a generic issue with portals that are occupying the same XY space. The only good solution to this is using 3D shadowmaps which are not available yet
Or attempting to make levels in a way that they never can intersect (e.g. only doing straight passageways).
I think the script could attempt resolving portal connections in a way that 2D geometry never overlaps, by using a blockmap or so. The problem with this is that while possible it could easily cause unrecoverable "missing piece" problems, if the only possible solution is to overlap.
Easier is to introduce some kind of a custom dynamic light that only renders when you directly see it (or the fragment it's in). And then it will be pretty much like Build where you get visual artifacts if you see two sides of a portal at once.
3D floors cannot be added because 3D floors are not yet filled into the sector during preprocessing, and even sector tags are not available, so it's not possible to manually resolve 160 specials either.
Requires GZDoom patch.
UPD: Worked around this. Updated the archive yet again.
-
- Spotlight Team
- Posts: 1089
- Joined: Mon Nov 25, 2019 8:54 am
- Graphics Processor: Intel (Modern GZDoom)
Re: ZDoom-Templated (map randomized at runtime from prefabs)
Interesting development, ZZYZX!