ZScript Discussion
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Re: ZScript Discussion
There are "units" corresponding to archives. It reads all the ZScript code from an archive, compile it, then move to the next archive.
Because of that, you can override stuff from an actor in the current unit, but not in a different unit -- for that, you still have to use DEHACKED, which is the only thing with that power.
Because of that, you can override stuff from an actor in the current unit, but not in a different unit -- for that, you still have to use DEHACKED, which is the only thing with that power.
Re: ZScript Discussion
Also, why is the concept of "private" and "protected" fields/methods introduced?
I can understand why these exist in C++, as public interfaces are supposed to be binary compatible and using undocumented/internal things will fail on slightest modifications.
But here in ZScript it will mean that it won't be possible to duplicate the behavior of existing stuff while a bit altering it. (/me looks at partially rewritten AActor::Tick)
#freethedata #pythonrules
I can understand why these exist in C++, as public interfaces are supposed to be binary compatible and using undocumented/internal things will fail on slightest modifications.
But here in ZScript it will mean that it won't be possible to duplicate the behavior of existing stuff while a bit altering it. (/me looks at partially rewritten AActor::Tick)
#freethedata #pythonrules
- 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 Discussion
Okay so I have no idea what I'm doing but based on the wiki this should work:
EDIT: so after googling that error message I tried
EDIT: totally unrelated to the above:
Spoiler:But it doesn't start. What in the world does "Class Actor cannot be found in the current translation unit." mean?
EDIT: so after googling that error message I tried
Spoiler:and it works. Does this mean there's no way to set up a custom function without making everything that uses it inherit from a common custom actor (thus preventing monsters and players from launching an identical attack without replicating the code or going back to the custominventory hack)?
EDIT: totally unrelated to the above:
Wouldn't this screw up the player prediction in multiplayer?Major Cooke wrote:Your best bet would be to have the player's speed at 0, and use the Tick function to measure for GetPlayerInput via ZScript. ...
- Major Cooke
- Posts: 8212
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: ZScript Discussion
First part: No, that's not doable... YET.
Edited part: Yup. Make a base class for something that can be replicated easily. I.e. basemonster or what not and have all monsters inherit from there for the time being.
Totes unrelated: Multiplayer doesn't even work right now. How the Hell should I know?
Edited part: Yup. Make a base class for something that can be replicated easily. I.e. basemonster or what not and have all monsters inherit from there for the time being.
Totes unrelated: Multiplayer doesn't even work right now. How the Hell should I know?
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: ZScript Discussion
So I've spent a considerable amount of time trying to fix a bug I've encountered while trying to port Hotline 666's bird's-eye view camera to ZScript. The movement was incredibly jittery when interpolation was on and the player would start freaking out whenever walking into a wall or corner. I've since rewritten a significant portion of the code, and now the movement isn't jittery, it just lags behind the player. The freaking out when walking into a wall is also still present (this never happened when using SetActorVelocity in ACS).
A video of the jittery movement I experienced previously can be seen below, along with an isolated example pk3 containing the slightly rewritten code.
Previously I had been using CheckPosition to fix the jittering against walls, but this causes +SLIDESONWALLS to stop working, which makes moving near walls a bit of a pain.
As for the camera lag/jitter, I have no idea how I should go about fixing it, I've tried for a few days to no avail. Any ideas?
A video of the jittery movement I experienced previously can be seen below, along with an isolated example pk3 containing the slightly rewritten code.
Previously I had been using CheckPosition to fix the jittering against walls, but this causes +SLIDESONWALLS to stop working, which makes moving near walls a bit of a pain.
As for the camera lag/jitter, I have no idea how I should go about fixing it, I've tried for a few days to no avail. Any ideas?
Re: ZScript Discussion
Also, in ZScript, what variables in the class are subject to SetUserVariable and/or UDMF thing user variables? None or any public?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49237
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
ZZYZX wrote:I'm trying to implement a third party ZScript parser here, and found a weird thing.
How come Shotgun class is defined before the class that it inherits from (DoomWeapon)? Is this normal? How does it work at all?
Actually quite simple. The code runs in a double loop, the inner one resolving all classes it can, and repeating the process as long as there's still classes to resolve. If it finds a class whose base class is not known yet it simply gets skipped. The same is also done for constants and member variables.
Re: ZScript Discussion
"translation unit" == "archive".Vaecrius wrote:What in the world does "Class Actor cannot be found in the current translation unit." mean?
You want to modify actor, you have to do it in gzdoom.pk3.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49237
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
No, that is not correct. A translation unit is one ZSCRIPT lump with all its includes. If you have two of them in a single archive it's two translation units.Gez wrote:"translation unit" == "archive".Vaecrius wrote:What in the world does "Class Actor cannot be found in the current translation unit." mean?
Re: ZScript Discussion
Why would you do that, though?Graf Zahl wrote:If you have two of them in a single archive it's two translation units.
Re: ZScript Discussion
Why not? It's still good to know the details on this.Gez wrote:Why would you do that, though?Graf Zahl wrote:If you have two of them in a single archive it's two translation units.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49237
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript Discussion
Gez wrote:Why would you do that, though?Graf Zahl wrote:If you have two of them in a single archive it's two translation units.
It's not about "Why" but that it's possible and needs to be cleared up.
- Major Cooke
- Posts: 8212
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
- Location: GZBoomer Town
- Contact:
Re: ZScript Discussion
This looks like you're performing a warp to the new place without interpolation, and then warping back to the old place with interpolation. cl_capfps disables interpolation, you are aware, correct?The Zombie Killer wrote:So I've spent a considerable amount of time trying to fix a bug I've encountered while trying to port Hotline 666's bird's-eye view camera to ZScript. The movement was incredibly jittery when interpolation was on and the player would start freaking out whenever walking into a wall or corner. I've since rewritten a significant portion of the code, and now the movement isn't jittery, it just lags behind the player. The freaking out when walking into a wall is also still present (this never happened when using SetActorVelocity in ACS).
A video of the jittery movement I experienced previously can be seen below, along with an isolated example pk3 containing the slightly rewritten code.
<SNIP>
Previously I had been using CheckPosition to fix the jittering against walls, but this causes +SLIDESONWALLS to stop working, which makes moving near walls a bit of a pain.
As for the camera lag/jitter, I have no idea how I should go about fixing it, I've tried for a few days to no avail. Any ideas?
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: ZScript Discussion
Yes, I'm well aware of that (hence why I used it in the video in order to demonstrate that the main issue was interpolation). When I used A_Warp previously instead of SetOrigin to try and ensure there was proper interpolation, the issue remained. Although now that I've rewritten some of the code, the issue seems to be the camera lagging behind the player rather than dodgy interpolation. I'm just not sure how I'd go about fixing it in a clean, non-hacky way.Major Cooke wrote:This looks like you're performing a warp to the new place without interpolation, and then warping back to the old place with interpolation. cl_capfps disables interpolation, you are aware, correct?
Re: ZScript Discussion
Is the interpolation still wacky if you only move without changing angles or vice versa?