An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Any utility that assists in the creation of mods, assets, etc, go here. For example: Ultimate Doom Builder, Slade, WadSmoosh, Oblige, etc.
Forum rules
The Projects forums are ONLY for YOUR 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.
Post Reply
User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by KECG »

Hi, all,

I am entirely new here (new to Doom modding too), but I'm not new to fiddling with graphics in javascript.

Thus: Arch Mage!

Just extract to "\Ultimate Doom Builder\UDBScript\Scripts\Examples\Geometry", select exactly two linedefs, twiddle the settings to your liking, and hit run.

UDMF only :(

Features:
* Very simple to use!
* Supports Lancet Arches!
* Seed Linedefs don't need to be parallel!
* Adjustable Subdivision!


It is best run on a preexisting transom (a chunk of lower ceiling above a doorway). You can expect a standard, semi-circular arch to be half of the width of the doorway in height, but once you start playing with the lancet setting all bets are off (it becomes a fractional function of sine).

Any advice on improvement would be cool.

P.S. The output is triangulated (and using vertex heights) because my primary interest is in "scooping" arches as depicted in the screeny.



UPDATE to V2: Now supports -=FLOOR ARCHES=- !!!
This allows for quasi-circular doorways, sewer-pipes, etc..
This should be run on two Linedefs on either side of a very short window; 16 units tall 64 up from the floor and down from the ceiling, and 128 wide, for example.


UPDATE to V3: Sinusoid vertex distribution!!!

* Linear and Sinusoid vertex distribution now optional, as per boris's suggestion.
* Linear is still useful for vertical texture bands of set width.
* V Scale now defaults to the inverse of Doom's vertical aspect ratio, making circles actual circles.

UPDATE to V4: Fixed a problem with vertex merging.

UPDATE to V5: Fixed my fix to the problem with vertex merging.
I created a brute force, internal welding function.
It now works predictably as long as the generated vertices are not closer than .125MUs, so don't try 35 Half Steps on a 64MU-wide arch :).

Much thanks to boris for their helpful testing. I now know enough to move on to more ambitious scripts. Voronoi fracturing of sectors will be next, I think :D.
Attachments
ArchMage_v5.zip
(1.79 KiB) Downloaded 177 times
archMage_Screenshot3.jpg
A bad example image
A bad example image
Last edited by KECG on Fri Oct 20, 2023 4:46 pm, edited 5 times in total.
User avatar
Nash
 
 
Posts: 17446
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: An Arch Generating UDBScript for UDB

Post by Nash »

KECG wrote: Thu Oct 12, 2023 8:39 pm Hi, all,

I am entirely new here (new to Doom modding too), but I'm not new to fiddling with graphics in javascript.

Thus: Arch Mage!

Just extract to "\Ultimate Doom Builder\UDBScript\Scripts\Examples\Geometry", select exactly two linedefs, twiddle the settings to your liking, and hit run.

UDMF only :(

Features:
* Very simple to use!
* Supports Lancet Arches!
* Seed Linedefs don't need to be parallel!
* Adjustable Subdivision!

It is best run on a preexisting transom (a chunk of lower ceiling above a doorway). You can expect a standard, semi-circular arch to be half of the width of the doorway in height, but once you start playing with the lancet setting all bets are off (it becomes a fractional function of sine).

Any advice on improvement would be cool.

P.S. The output is triangulated (and using vertex heights) because my primary interest is in "scooping" arches as depicted in the screeny.
Very nice.
User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

Re: An Arch Generating UDBScript for UDB

Post by KECG »

Thanks :)
boris
Posts: 742
Joined: Tue Jul 15, 2003 3:37 pm

Re: An Arch Generating UDBScript for UDB

Post by boris »

Just for the record, you can arch sectors with UDB's built-in tools, you can have a look at it in action in Bridgeburner's tutorial: https://www.youtube.com/watch?v=dioG0P0ywJo&t=378s. It requires support for plane equation slopes, though, so it doesn't work in ports that do not support that, like Zandronum. Also it doesn't work with lines that are not parallel to each other.

You could improve your script by adding an option to not make all sectors the same with, but have a sine wave width, so that the steeper parts of the slope have slimmer sectors than the flatter sections. Even with the same amount of sections you'll have a smoother slope, as this image shows: https://cdn.discordapp.com/attachments/ ... ectors.png (left side was created with your script, right side the sectors were created using the Draw Grid Mode and arched with the built-in tools)
User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

Re: An Arch Generating UDBScript for UDB

Post by KECG »

Thanks, boris.

Your comment on sinusoid line spacing is dead on :)

My primary goal was arches between non-parallel linedefs, so I'm glad not all of my work was redundant.

UPDATE!

Done now, and selectable under 'Distribution' (in version 3).
'Linear' is still useful if you want a series of columns of equal width for textures.

Also, Lancet Arches are a feature unique to my script, yes?
Last edited by KECG on Sun Oct 15, 2023 9:45 am, edited 1 time in total.
boris
Posts: 742
Joined: Tue Jul 15, 2003 3:37 pm

Re: An Arch Generating UDBScript for UDB

Post by boris »

There seems to be a problem with vertex positions when using the sinusoid distribution under certain circumstances, for example when trying to slope between lines that are parallel and 192 units apart. It draws vertices that are really close together, but not on each other. That results in the sectors not being triangular anymore, but having 4 sides.
KECG wrote: Sun Oct 15, 2023 5:34 amAlso, Lancet Arches are a feature unique to my script, yes?
They can be done, but not in one go. You have to first arch one side and then the other (or copy the first side). For example for this Insane Gazebo map the built-in arch tool was used: https://cdn.discordapp.com/attachments/ ... 165230.png

The built-in tool also works on 3D floors, which is not possible with vertex heights.
User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

Re: An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by KECG »

Wow! That's a super pretty screenshot :) I will continue fiddling. That 192 wide problem you mention is very concerning, and I will get on that as soon as I'm back on my desktop. Thanks so much for your attention.
User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

Re: An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by KECG »

Hi, boris,

I thought I was just getting suggestions from a helpful rando! I had no idea you're one of the people behind UDB :b (I did say I was new here). I literally just described UDBScript to a friend as "the most beautifully implemented internal scripting system I have ever seen." So, passing that along.

I'm using version 3.0.0.4114 (a9e05a0). I mention because testing it on a 192 wide sector (and a 384 wide one, for that matter) I can't replicate the miss-aligned vertices :( I tried moving the linedefs by .125 units off grid, and also rotating them, but the bug is illusive. How deep is your test arch? And how far is it from the origin? I'm thinking float decay, if that is a possibility.
boris
Posts: 742
Joined: Tue Jul 15, 2003 3:37 pm

Re: An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by boris »

KECG wrote: Mon Oct 16, 2023 3:27 pm I literally just described UDBScript to a friend as "the most beautifully implemented internal scripting system I have ever seen." So, passing that along.
Thanks! :) Most of the API is just a thin layer over the C# code, although there are some additions that make it more user-friendly and javascripty.

I recorded a video of the issue:

User avatar
KECG
Posts: 5
Joined: Thu Oct 12, 2023 8:08 pm
Preferred Pronouns: It/Its
Operating System Version (Optional): Windows 10 64bit
Graphics Processor: nVidia (Modern GZDoom)

Re: An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by KECG »

Hi, boris,

Thanks so much for the video. Even still, it took a while to replicate it. This boiled down to 'Float ~= Float' problem. I still don't know how the vertex merging works. I ended up rounding vertex positions to a thousandths place and all the problems went away-- For now!

Is there any access to the "Merge Dragged" functionality from scripts? Or some "weld to nearest" function I missed?

Thanks again :)
Attachments
ArchMage_v4.zip
(1.68 KiB) Downloaded 159 times
boris
Posts: 742
Joined: Tue Jul 15, 2003 3:37 pm

Re: An Arch Generating UDBScript for UDB (Gothic Arches Too!!!))

Post by boris »

Yeah, definitely looks like a precision problem. Vertices are already rounded (and merged) to 3 decimal places. There is https://biwa.github.io/udbscript-docs/V ... toaccuracy, but that would not do anything here, since that's run when using DrawLines anyway.

What you could do is to compute all the vertex positions once and then just draw lines between them.
Post Reply

Return to “Creation, Conversion, and Editing”