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

Re: ZScript and its impact on SBARINFO

Postby SanyaWaffles » Sun Jan 15, 2017 7:35 pm

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
SanyaWaffles
Navy Did Nothing Wrong
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: ZScript and its impact on SBARINFO

Postby Major Cooke » Sun Jan 15, 2017 10:20 pm

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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript and its impact on SBARINFO

Postby Matt » Thu Jan 19, 2017 5:30 pm

Is there any HUD stuff that can be done in ZScript right now? I don't really see anything on the wiki.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: ZScript and its impact on SBARINFO

Postby Graf Zahl » Thu Jan 19, 2017 5:32 pm

No. The necessary functions are not available yet.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript and its impact on SBARINFO

Postby Graf Zahl » Thu Jan 19, 2017 6:35 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript and its impact on SBARINFO

Postby Major Cooke » Thu Jan 19, 2017 7:10 pm

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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript and its impact on SBARINFO

Postby Graf Zahl » Thu Jan 19, 2017 7:21 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript and its impact on SBARINFO

Postby Major Cooke » Thu Jan 19, 2017 7:56 pm

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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: ZScript and its impact on SBARINFO

Postby Nash » Fri Jan 20, 2017 1:15 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: ZScript and its impact on SBARINFO

Postby jpalomo » Fri Jan 20, 2017 4:04 am

Would the fully scriptified status bar code look similar to how Strife's status bar looks in the source?
User avatar
jpalomo
 
Joined: 17 May 2010

Re: ZScript and its impact on SBARINFO

Postby Graf Zahl » Fri Jan 20, 2017 4:18 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript and its impact on SBARINFO

Postby Kinsie » Fri Jan 20, 2017 4:35 am

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
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: ZScript and its impact on SBARINFO

Postby Graf Zahl » Fri Jan 20, 2017 4:54 am

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: ZScript and its impact on SBARINFO

Postby Kinsie » Fri Jan 20, 2017 7:49 am

Okay, fair enough! That sounds like a good solution.
User avatar
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: ZScript and its impact on SBARINFO

Postby Xaser » Fri Jan 20, 2017 10:48 am

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?
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

PreviousNext

Return to Developer Blog

Who is online

Users browsing this forum: No registered users and 1 guest