ZScript and its impact on SBARINFO

Here, developers communicate stuff that does not go onto the main News section or the front page of the site.
[Dev Blog] [Development Builds] [Git Change Log] [GZDoom Github Repo]

Moderator: GZDoom Developers

SanyaWaffles
Posts: 800
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: ZScript and its impact on SBARINFO

Post by SanyaWaffles »

Kinsie wrote:I'm curious to see what comes of this, if not immediately than when canny scripters whip up some "libraries" for advanced HUD manipulation.
I'd love to see this.

Another thing I'd like to see is some ability to have in-game controls. Like I want to make a playerclass that changes it's attributes (damage resistaince/speed/weapons the player has access to), but I'd like to have a wheel or a selection box of some sort. Even if I have to write all the code myself in ZScript, right now with SBARINFO and even with ACS it's limited.

I'm not sure if that'll be able to be done, but I can hope. It can be done simply by using a few keybinds and print/logs for now.

Still, I am excited for what the future holds.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript and its impact on SBARINFO

Post by Major Cooke »

You have your user1-4 keys. You'll be able to make something out of it but there won't be things like extra key detection without doing a bit of hackery on your part.

If we're lucky, Graf might even know how to implement rotatable graphics. :mrgreen:
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: ZScript and its impact on SBARINFO

Post by Matt »

Is there any HUD stuff that can be done in ZScript right now? I don't really see anything on the wiki.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript and its impact on SBARINFO

Post by Graf Zahl »

No. The necessary functions are not available yet.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript and its impact on SBARINFO

Post by Graf Zahl »

So...

One hour of examining the code, and one thing is clear: Trying to refactor this is a completely pointless endeavour. I think the best that can be done here is writing a thin scripted wrapper so that the virtual functions can be exported to the script side, but all the rest left as it is. But that should be enough to export the relevant parts of the base status bar. I think the best to be done with this code is to leave it alone and never touch it again. Maybe eventually I may be able to extract some widgets but it's probably more advisable to develop a clean scripted widgets library once the framework is standing that doesn't build on SBARINFO at all.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript and its impact on SBARINFO

Post by Major Cooke »

Oh wow, you're already on that part now? So is your plan to develop a new framework after what little sbarinfo stuff can be exported, or is there something else between that which must be done?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript and its impact on SBARINFO

Post by Graf Zahl »

No idea yet. I just started to evaluate the SBARINFO code a bit more closely and this is definitely beyond my tolerance level. I don't think there's much to extract here, it's probably better to start fresh. Ultimately there will be two ways to build status bars: Either with direct draw command or by placing some widgets onto the bar that do some stuff, but I'll probably leave part of this to more creative people who are better at that - I'll just provide the framework for them.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript and its impact on SBARINFO

Post by Major Cooke »

Ah, you mean like having someone else develop wrappers/functions for it. Only trouble is, that may wind up being beyond everyone else.

But if it means we can much more easily do things like shuddering huds and more, then I'm down for doing that. It would also be neat if we can change things like health bar filling/emptying to go in more than just horizontal/vertical directions.
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ZScript and its impact on SBARINFO

Post by Nash »

Vaecrius wrote:Is there any HUD stuff that can be done in ZScript right now? I don't really see anything on the wiki.

Well, there IS screen.DrawHUDTexture (look at the Wings of Wrath in gzdoom.pk3) but that's quite limited and only useful for placing a static graphic on the screen.

Fun to mess around with for about 5 minutes but I wouldn't do anything serious with it and rather wait for the full set of tools to be available.
User avatar
jpalomo
Posts: 771
Joined: Mon May 17, 2010 9:45 am

Re: ZScript and its impact on SBARINFO

Post by jpalomo »

Would the fully scriptified status bar code look similar to how Strife's status bar looks in the source?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript and its impact on SBARINFO

Post by Graf Zahl »

Major Cooke wrote:Ah, you mean like having someone else develop wrappers/functions for it. Only trouble is, that may wind up being beyond everyone else.

But if it means we can much more easily do things like shuddering huds and more, then I'm down for doing that. It would also be neat if we can change things like health bar filling/emptying to go in more than just horizontal/vertical directions.

Ultimately a status bar is just a rectangle you define with virtual coordinates and then drawing stuff on it. What will be needed is some drawing functions, means to get to the needed info comfortably (meaning writing some wrapper functions that make it easier to get to the values) and maybe some animator widgets. Of course, since full ZScript is available, many crutches to get to the info in the player's inventory are not even necessary because it is readily accessible.

The main problem with SBARINFO has always been that it had to work in a rather rigid and inflexible framework which caused some hideously complex internal code, just have some fun looking at the DSBarInfo::Draw and DrawString function. Awful - just truly and utterly awful.
Nash wrote:
Vaecrius wrote:Is there any HUD stuff that can be done in ZScript right now? I don't really see anything on the wiki.

Well, there IS screen.DrawHUDTexture (look at the Wings of Wrath in gzdoom.pk3) but that's quite limited and only useful for placing a static graphic on the screen.
Guess what: That's what it was made for! It gets used in the fullscreen HUD code for Strife as well so it seemed reasonable to do a separate export for it to get the powerup icon stuff out of the way quickly.
jpalomo wrote:Would the fully scriptified status bar code look similar to how Strife's status bar looks in the source?
Yes and no. Of course I'd like to add some higher level functionality, too (i.e. replicate SBARINFOs functionality in a saner fashion), but at the low level you could do an entire status bar that way, if I export all the needed functions.

Oh, btw, I already wrapped the entire SBARINFO stuff in an abstract wrapper, so it won't impact any of my work ever again, all I need to deal with is that wrapper class. :)
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ZScript and its impact on SBARINFO

Post by Kinsie »

Graf Zahl wrote:Oh, btw, I already wrapped the entire SBARINFO stuff in an abstract wrapper, so it won't impact any of my work ever again, all I need to deal with is that wrapper class. :)
Does this mean that older, SBARINFO-based mods will still work in the future, quietly translating to ZScript equivalents?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript and its impact on SBARINFO

Post by Graf Zahl »

It means the code was shoved out of the way, never to be touched again, with just a thin wrapper connecting it to the rest of the engine so for future changes to the framework it's just that wrapper that needs to be touched but not the whole implementation. SBAINFO is 150kb source code and it's not the prettiest stuff, so the less I have to deal with it, the better.

In a way it reminds me a lot of the old menu code in that it has over time cancerously grown into a virtually unmaintainable state - and it needs a gargantuan efford to resanitize it. But unlike the menu code it is not necessary to replace it, it's enough to supersede it and shove it aside - just like DECORATE was handled for ZScript. To be blunt: It's a waste of time trying to sanitize this if it works just as well to just forget about it and let it do its stuff in a little sandbox that's properly encapsulated.

I rather build the new statusbar framework on the existing Strife statusbar and the old, abandoned code for the other ones that eventually got replaced with SBARINFO.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ZScript and its impact on SBARINFO

Post by Kinsie »

Okay, fair enough! That sounds like a good solution.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: ZScript and its impact on SBARINFO

Post by Xaser »

Indeed -- I'd be quite content to start with DrawTexture+DrawText and build the rest up from there. A good library of useful shortcuts can follow afterward.


Since we're on the general topic of drawing stuff to the HUD, one thing I'd like to be able to do in the future is draw some scripted widgets around the player's crosshair that scale with it (i.e. respects 'crosshairscale', 'crosshairgrow', etc.). Will this be eventually possible in the new way of doing HUD things, or will something like this require additional work/features/whatnot?
Post Reply

Return to “Developer Blog”