RadiusDebug - Visual Actor radius utility [ZScript/DECORATE]

Post your example zscripts/ACS scripts/etc here.

RadiusDebug - Visual Actor radius utility [ZScript/DECORATE]

Postby Nash » Mon Jun 04, 2018 1:16 pm



RadiusDebug is a simple utility I use to see a visual representation of an Actor's radius in the world. This works on any Actor - not just monsters. Basically, if a thing could hold inventory, it will work.

Usage is super easy, and can be used with both DECORATE and ZScript! Here are examples for both of them.

DECORATE:

Code: Select allExpand view
// Just give RadiusDebugMe to enable RadiusDebug on an Actor.
// Take RadiusDebugMe away from it to disable it.
// Simple!

Actor TestZombieman : Zombieman replaces Zombieman
{
    States
    
{
        Spawn:
            TNT1 A 0 NoDelay A_GiveInventory("RadiusDebugMe")
            Goto Super::Spawn
    
}
}


ZScript:

Code: Select allExpand view

class TestZombieman 
: Zombieman replaces Zombieman
{
    override void BeginPlay(void)
    {
        // This enables the radius debugger...
        RadiusDebug.Enable(self);

        // ... and this would disable it.
        // RadiusDebug.Disable(self);

        Super.BeginPlay();
    }
}


I've also attached a test event handler that'll make every monster in the level show their radius. Just load TestRadiusDebugHandler.pk3 after RadiusDebug.pk3 to check it out.

Works in both OpenGL and the software* renderer.

* model rendering in software only works starting from GZDoom 3.5.0 onwards

Feel free to use this any way you like. No need to ask for my permission. Credits would be cool. Have fun!
Attachments
RadiusDebug.pk3
20th December 2018 Update
(6.68 KiB) Downloaded 76 times
TestRadiusDebugHandler.pk3
(523 Bytes) Downloaded 88 times
Last edited by Nash on Wed Dec 19, 2018 1:25 pm, edited 4 times in total.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Enjay » Tue Jul 24, 2018 4:28 am

I just tried it with map20 in Doom2. It provides interesting and potentially useful information.

Image
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Kinsie » Tue Jul 24, 2018 5:37 am

I've wished for this to be an engine feature for yeeeears now.
User avatar
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby dodopod » Mon Dec 17, 2018 3:15 pm

I would suggest one small change. As you can see in the screenshots, monsters' heads tend to poke out the top of the radius box. According to the Doom Wiki:

However, height and width units do not quite agree. The 1-meter interpretation would imply that the Doomguy is one meter wide, or at least cannot pass through an opening narrower than one meter, which would be to exaggerate his muscularity. The discrepancy is likely related to the fact that pixels in Doom's original video modes were rectangular: because pixels were taller than they were wide, and each map unit was proportional in size to a pixel of an in-game texture, flat, or sprite, height units were larger than width units. A more realistic interpretation (if there is any such thing) is perhaps that one "width unit" (w) corresponds to 5/6 of a "height unit" (h).


So, it would be more accurate if you change the line

Code: Select allExpand view
Scale.Y = double(Height);


to

Code: Select allExpand view
Scale.Y = double(6 * Height) / 5;


Here's a comparison:

dodopod
 
Joined: 04 Oct 2017

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby camper » Mon Dec 17, 2018 3:48 pm

It looks like 3d blocks, only without textures.
User avatar
camper
 
Joined: 25 Feb 2018
Location: Tatarstan

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Gez » Tue Dec 18, 2018 6:46 am

Now make a gun whose projectile uses A_RadiusGive to give RadiusDebugMe items, and you can call it RadiusRadiusDebug.
Gez
 
 
 
Joined: 06 Jul 2007

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Nash » Tue Dec 18, 2018 11:28 am

dodopod wrote:I would suggest one small change. As you can see in the screenshots, monsters' heads tend to poke out the top of the radius box. According to the Doom Wiki:

However, height and width units do not quite agree. The 1-meter interpretation would imply that the Doomguy is one meter wide, or at least cannot pass through an opening narrower than one meter, which would be to exaggerate his muscularity. The discrepancy is likely related to the fact that pixels in Doom's original video modes were rectangular: because pixels were taller than they were wide, and each map unit was proportional in size to a pixel of an in-game texture, flat, or sprite, height units were larger than width units. A more realistic interpretation (if there is any such thing) is perhaps that one "width unit" (w) corresponds to 5/6 of a "height unit" (h).


So, it would be more accurate if you change the line

Code: Select allExpand view
Scale.Y = double(Height);


to

Code: Select allExpand view
Scale.Y = double(6 * Height) / 5;


Here's a comparison:



This only works correctly if the project's PixelRatio is at "Doom" settings (1.2). For projects with PixelRatio 1.0, your fix looks wrong on them.

level.pixelstretch can be used to retrieve said setting. Can you figure out how to fix this into the calculation? I suck at maths.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby dodopod » Tue Dec 18, 2018 2:26 pm

Nash wrote:This only works correctly if the project's PixelRatio is at "Doom" settings (1.2). For projects with PixelRatio 1.0, your fix looks wrong on them.

level.pixelstretch can be used to retrieve said setting. Can you figure out how to fix this into the calculation? I suck at maths.


In that case the line should be:

Code: Select allExpand view
Scale.Y = double(Height) * level.pixelStretch;
dodopod
 
Joined: 04 Oct 2017

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Nash » Wed Dec 19, 2018 1:23 pm

20th December 2018 Update:

- Proper height scale calculation
- Update size every tic so that Actor death height, and any other real-time changes will be reflected. This might be a little expensive, but because RadiusDebug is a development aid, I am not going to bother to optimize it

Download link in first post
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby gramps » Wed Dec 19, 2018 3:06 pm

Hey, that's pretty neat!

I'm just gonna throw an idea out there; not really related but this brings it to mind. I'd love to see an add-on with a toggle button that freezes time, and then draws a box like that around anything you point at, and also pops up all the stuff from the "info" console command in a nice little overlay thing. I've found myself using "freeze" and "info" a lot during some experimentation and something like that would speed things up quite a bit.
gramps
 
Joined: 18 Oct 2018

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby TDRR » Sat Dec 22, 2018 9:27 pm

Can you also add A_RadiusGive radius viewing? Even if it's just for RGF_CUBE.
User avatar
TDRR
putting jelly on this hot dog
 
Joined: 11 Mar 2018
Location: Venezuela

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby dodopod » Fri Dec 28, 2018 2:03 pm

I made a custom event handler, which displays actor radii depending on a CVar. Just like with TestRadiusDebugHandler.pk3, load RadiusDebugCVar.pk3 after RadiusDebug.pk3 to make it work.

RadiusDebug can be set to either:
  • None
  • Monsters
  • Pickups
  • Solids
  • Shootables
  • All

Oh, by the way, calling RadiusDebug.Disable() doesn't work for me.
Attachments
RadiusDebugCVar.pk3
(1.63 KiB) Downloaded 25 times
dodopod
 
Joined: 04 Oct 2017

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Nash » Mon Jan 07, 2019 8:29 am

I have a few cool ideas to make this mod even more useful and actually universally auto-load ready (meaning you can just leave it in your autoload, and turn it on or off with a button toggle/option menu), and I can also add useful text info about what you are pointing at - but I'm going to way for GZDoom to add "extends Actor" functionality first (which will be technically possible, last I understood it).
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: RadiusDebug - Visual Actor radius utility [ZScript/DECOR

Postby Kizoky » Mon Apr 22, 2019 4:53 pm

I edited dodopod's code, so now you'll get a menu + and when you change the setting in the menu the box will be attached to the actors in real time
No need to reload the level

Spoiler:
Attachments
RadiusDebug_Menu.pk3
(7.73 KiB) Downloaded 6 times
User avatar
Kizoky
I smell like gravity
 
Joined: 14 Nov 2011
Location: Around weirdos, I'm the biggest weirdo among them
Discord: Kizoky#0375
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support


Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest