Is A ZScript Like ACS Replacement Possible?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
User avatar
22alpha22
Posts: 303
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Is A ZScript Like ACS Replacement Possible?

Post by 22alpha22 »

I have been thinking lately about ACS and how to overcome some of its inherent limitations in order to implement some features of my project and thus far I've found it easier just to have ACS call a ZScript class rather than to try to implement it directly through ACS, if that would even be possible depending on what it is I'm doing. This isn't ideal because it means I have to have at least two or more different text documents open, each using a slightly different syntax, with different limitations. I thought about trying to ditch ACS entirely for map scripting but then realized I would have recreate all of ACS's specific functions and that is just way too much.

Anyway it got me thinking, why is ACS even still a thing? ZScript came along and can do just about everything ACS can and so much more. ACS has to be pre-compiled, ZScript is plain text, ACS does not have true support for floats, doubles, or vectors, ACS can only pass scripts with a maximum of 4 arguments, the list goes on. The engine is clearly not nearly as limited as ACS is so why are we still stuck with it. For all it can do ZScript is still very unintuitive for map scripting as it was not designed to replace ACS for that, but why not? I suppose it probably doesn't matter much why not anymore as ZScript has been released into the wild for several years now so it is highly doubtful that the way it interacts with map data (sectors, lines, vertices, etc) will change. Zscript just isn't even remotely ideal for map scripting even if it does have way more potential than ACS.

How feasible would it be to create a map scripting language with all the flexibility of zscript or least the ability to overcome many of ACS's limitations while still maintaining ACS's ease of use when it comes to the actual scripting itself?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is A ZScript Like ACS Replacement Possible?

Post by Graf Zahl »

The main issue is that ZScript needs to be compiled at engine start, not at map start, so its code is global for the entire game session, not part of the map you play. We'd also have to export all existing ACS functions so that they remain usable. It's a lot of work, but not impossible.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Is A ZScript Like ACS Replacement Possible?

Post by Caligari87 »

Even so, that could be solved by having some boilerplate to abort / destroy an event handler or whatever if not on the correct maps.

The way I see it, there's two main functional blockers, at least from a modding perspective:

1. ACS has a delay() function which has no direct equivalent in ZScript. You can certainly achieve the same functionality with countdown variables or whatever, but it's not very user-friendly.

2. Most ACS functions are very "abstracted" for convenience. Opening a door is one function in ACS, but in ZScript requires manually setting up a thinker with obtuse undocumented methods. Again it's entirely possible to do, it's just not user friendly. Seems I'm wrong on this???!!??

Of the two, making zscript "wrappers" for the ACS functions would be relatively straightforward, if labor-intensive. I've been trying to wrap my brain around a way to easily abstract delays in ZScript (to avoid making timers manually) but haven't had much success.

8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is A ZScript Like ACS Replacement Possible?

Post by Graf Zahl »

Caligari87 wrote: 2. Most ACS functions are very "abstracted" for convenience. Opening a door is one function in ACS, but in ZScript requires manually setting up a thinker with obtuse undocumented methods. Again it's entirely possible to do, it's just not user friendly.
All ACS specials can be called directly from ZScript and even DECORATE so this simply is not true.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: Is A ZScript Like ACS Replacement Possible?

Post by Caligari87 »

... Interesting. Last time I tried to mess with altering floor heights in a map, I couldn't make it work from ZScript without considerable pain for some reason. Maybe I was missing the forest for the trees; maybe I assumed that since the ACS functions aren't exposed by name in the gzdoom.pk3 ZScript sources then they weren't available... and if that's the case I have the feeling I'm not the only one, because I've seen this idea repeated a lot by other fairly experienced people.
Spoiler: off-topic
8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is A ZScript Like ACS Replacement Possible?

Post by Graf Zahl »

No, there are no such functions and that is quite deliberate.
User avatar
22alpha22
Posts: 303
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: Is A ZScript Like ACS Replacement Possible?

Post by 22alpha22 »

Graf Zahl wrote:All ACS specials can be called directly from ZScript and even DECORATE so this simply is not true.
How do you call an ACS specific function from ZScript? I tried using SetThingSpecial from within my monster class and GZDoom reported it as an 'unknown function'.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is A ZScript Like ACS Replacement Possible?

Post by Graf Zahl »

SetThingSpecial is not a special but a built-in ACS function.
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: Is A ZScript Like ACS Replacement Possible?

Post by Matt »

Doesn't "<actorpointer>.special=<thing>;" work for that?

As far as functionality is concerned I can only think of complicated timed stuff that's always irritating to set up explicitly in ZScript but in ACS is just, like, "do this thing that's already set up to be animated, then wait X tics, then do this other thing".

For map-specific stuff for a single project one option is to create a custom actor that just sits there performing all of that level's level-specific ZScript scripts, maybe have the same actor class cover multiple levels and which one it is selectable using whatever parameters can be added while you're making the map. Not as elegant as having something dedicated for that one map but not terribly gross-hacky either in my view.
Post Reply

Return to “General”