[ZScript] 3D Platform Actor (v2.2b)
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
I managed to update, but somewhat struggling to get all my own scripting in my test map updated to work with the new version (unreleased).
So, a quick question already, why is there no rotational direction parameter in FishyPlat_MoveToSpotAndRotate like in the functions that use interpolation points?
How do you rotate moving platforms that use map spots counter clockwise with this new version?
So, a quick question already, why is there no rotational direction parameter in FishyPlat_MoveToSpotAndRotate like in the functions that use interpolation points?
How do you rotate moving platforms that use map spots counter clockwise with this new version?
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
They rotate to match the spot's angle, pitch, and roll. The rotation direction taken is the shortest one available. That's the point behind that.
If you want a platform with TID 8 to go to some spot with TID 15 while doing a particular rotation
So 270.0 means rotate 270 degrees counterclockwise. -270.0 is 270 degrees clockwise.
If you want a platform with TID 8 to go to some spot with TID 15 while doing a particular rotation
Code: Select all
FishyPlat_MoveAndRotate(8, GetActorX(15), GetActorY(15), GetActorZ(15), true, 270.0, 0, 0, false, 70);
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
Ok, I got confused then with the new functions. Thought I had to use that one. Quite some changes overall.
I've updated the counter clockwise grouped movements (ACS) to that function. All good.
FishyPlat_Rotate doesn't work for me, I resorted to using FishyPlat_MoveAndRotate for those as well (even though they don't move). Works.
I've got three previously working 3DP platform sections with just 2 interpolation points that are now getting stuck at the second interpolation point and previously didn't. No code involved. Hitbox is properly aligned with the 3DP actor (model). I've set them to 'no clipping' to circumvent the issue, even though there's still a pixel space between 3DP actor hitbox and 3D floor. Weird. Could be an issue. Going to have to check that later with that debug tool we used last time. Other than that everything in my test map seems to be working now on the new version.
I did a quick test of the turret code. Yes, this is pretty much exactly what I was getting at, I've done my own very basic tests like that. Your example is already a big upgrade for me lol, thanks so much! I love the circular health drop on Death state. Anyhow, the actual difficulty (related to 3DP) that I'm really wondering about is how to align the turret (3DP actor) point in the direction it is shooting. =) By taking enemy code, it just shoots randomly. I can't even figure out how you can get the angle of the projectile it is shooting? That's the hard part I can't figure out if it will be possible with Gzdoom/3DP? So basically, the angle of the turret nozzle is aligned with the 3DP actor point angle and it remains there. Is it possible to change the turret point angle before it shoots? Yeah I know ... but it would be so awesome if it worked =))
Not sure what you meant with your other post about A_Chase. Need to do some reading ..
update:
Ok, I added a GLDEFS defined pointlight to my skullcubes (platforms) and it seems to work at first glance. Need to look into it more as I thought the effect would be stronger. I used offset 0,0,100 to center the pointlight in the cube and size 255.
So I also checked the continuous travel speed and it seems to work. I assume it won't be possible to have a fluent IP loop, right? Basically the platform's speed is a bit off around IPs and movement has its glitches. I can however clearly see moments where travel speed is indeed stable .. overall movement doesn't look as good though. Going to do some more testing later with less complex paths.
Aside from that, I've also noticed in the past month (in my actual map) that it is very difficult to make platforms follow a perfect circle of IPs (90° curve). It should be possible with 4 IPs (I thought), but rotation between IPs is a bit off. You can see it in the editor that it's more of an ellipse instead of a circle. It's close, but it's visually clearly off. The problem is less when you use 8 IPs, it decreases the error, but it's still jank. I wanted to have my airborne models follow certain perfect circular paths at a continuous speed, but the result is not too great. Rotational angle is off and it's clearly visual in game where the "IPs" are.
Will report back later on the action special.
Thanks again for all the hard work!
I've updated the counter clockwise grouped movements (ACS) to that function. All good.
FishyPlat_Rotate doesn't work for me, I resorted to using FishyPlat_MoveAndRotate for those as well (even though they don't move). Works.
I've got three previously working 3DP platform sections with just 2 interpolation points that are now getting stuck at the second interpolation point and previously didn't. No code involved. Hitbox is properly aligned with the 3DP actor (model). I've set them to 'no clipping' to circumvent the issue, even though there's still a pixel space between 3DP actor hitbox and 3D floor. Weird. Could be an issue. Going to have to check that later with that debug tool we used last time. Other than that everything in my test map seems to be working now on the new version.
I did a quick test of the turret code. Yes, this is pretty much exactly what I was getting at, I've done my own very basic tests like that. Your example is already a big upgrade for me lol, thanks so much! I love the circular health drop on Death state. Anyhow, the actual difficulty (related to 3DP) that I'm really wondering about is how to align the turret (3DP actor) point in the direction it is shooting. =) By taking enemy code, it just shoots randomly. I can't even figure out how you can get the angle of the projectile it is shooting? That's the hard part I can't figure out if it will be possible with Gzdoom/3DP? So basically, the angle of the turret nozzle is aligned with the 3DP actor point angle and it remains there. Is it possible to change the turret point angle before it shoots? Yeah I know ... but it would be so awesome if it worked =))
Not sure what you meant with your other post about A_Chase. Need to do some reading ..
update:
Ok, I added a GLDEFS defined pointlight to my skullcubes (platforms) and it seems to work at first glance. Need to look into it more as I thought the effect would be stronger. I used offset 0,0,100 to center the pointlight in the cube and size 255.
So I also checked the continuous travel speed and it seems to work. I assume it won't be possible to have a fluent IP loop, right? Basically the platform's speed is a bit off around IPs and movement has its glitches. I can however clearly see moments where travel speed is indeed stable .. overall movement doesn't look as good though. Going to do some more testing later with less complex paths.
Aside from that, I've also noticed in the past month (in my actual map) that it is very difficult to make platforms follow a perfect circle of IPs (90° curve). It should be possible with 4 IPs (I thought), but rotation between IPs is a bit off. You can see it in the editor that it's more of an ellipse instead of a circle. It's close, but it's visually clearly off. The problem is less when you use 8 IPs, it decreases the error, but it's still jank. I wanted to have my airborne models follow certain perfect circular paths at a continuous speed, but the result is not too great. Rotational angle is off and it's clearly visual in game where the "IPs" are.
Will report back later on the action special.
Thanks again for all the hard work!
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
"Rotate" just rotates and "Move" just moves; "MoveAndRotate" does both. Calling any of these functions right after another one will override the previous one. That's why there's generally three types.
I can't really help you there. There have been a lot of little under-the-hood changes that may have introduced some niche/edge case bugs, but that's just a guess on my part.
Yeah, Nash's RadiusDebug tool is super useful for this sort of thing.
Assuming it's similar to my example, all you have to do is call A_FaceTarget() somewhere in the "Missile" state sequencedoomzie wrote: ↑Tue Feb 21, 2023 4:45 pm I did a quick test of the turret code. Yes, this is pretty much exactly what I was getting at, I've done my own very basic tests like that. Your example is already a big upgrade for me lol, thanks so much! I love the circular health drop on Death state. Anyhow, the actual difficulty (related to 3DP) that I'm really wondering about is how to align the turret (3DP actor) point in the direction it is shooting. =) By taking enemy code, it just shoots randomly. I can't even figure out how you can get the angle of the projectile it is shooting? That's the hard part I can't figure out if it will be possible with Gzdoom/3DP? So basically, the angle of the turret nozzle is aligned with the 3DP actor point angle and it remains there. Is it possible to change the turret point angle before it shoots? Yeah I know ... but it would be so awesome if it worked =))
Usually like so:
Code: Select all
Missile:
MODL A 4
{
A_FaceTarget();
A_SpawnProjectile("YourTurretProjectile");
}
Goto See;
Granted it calculates the speed by assuming a linear travel distance to the next point, I don't know if there's a better algorithm that also accounts for spline paths. Anyway, I wanted overall movement speed to be consistent so at least there's that.doomzie wrote: ↑Tue Feb 21, 2023 4:45 pm So I also checked the continuous travel speed and it seems to work. I assume it won't be possible to have a fluent IP loop, right? Basically the platform's speed is a bit off around IPs and movement has its glitches. I can however clearly see moments where travel speed is indeed stable .. overall movement doesn't look as good though. Going to do some more testing later with less complex paths.
Getting a perfect circle out of however many IPs has always been a pain in the ass. I pretty much took PathFollower's spline path logic and slapped it on the platforms, because I don't have anything better. :vdoomzie wrote: ↑Tue Feb 21, 2023 4:45 pm Aside from that, I've also noticed in the past month (in my actual map) that it is very difficult to make platforms follow a perfect circle of IPs (90° curve). It should be possible with 4 IPs (I thought), but rotation between IPs is a bit off. You can see it in the editor that it's more of an ellipse instead of a circle. It's close, but it's visually clearly off. The problem is less when you use 8 IPs, it decreases the error, but it's still jank. I wanted to have my airborne models follow certain perfect circular paths at a continuous speed, but the result is not too great. Rotational angle is off and it's clearly visual in game where the "IPs" are.
EDIT: (Whoops forgot about this)
It's old gzdoom-ism I completely forgot about.Not sure what you meant with your other post about A_Chase. Need to do some reading ..
I thought I could use the named parameters feature and just declare the flags because it didn't matter that the default melee state is "Melee" and default missile is "Missile"
Code: Select all
A_Chase(flags: CHF_DONTMOVE | CHF_DONTTURN | CHF_NODIRECTIONTURN);
So you have to declare what melee and/or missile state you're gonna use if you want those flags to not be ignored.
Code: Select all
A_Chase(null, "Missile", CHF_DONTMOVE | CHF_DONTTURN | CHF_NODIRECTIONTURN);
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
I've now tested several game concepts that I had in mind for this 'feature' (with map spots). Simply said, you're awesome. It works. Thanks so much. =))FishyClockwork wrote: ↑Fri Feb 17, 2023 7:56 am - It is now possible to attach an "actor special" on a platform. The 5th argument on the platform is a tid of another actor that holds the actual special.
I can only ask you if there's a way to know that the player has left the platform? That would be the cherry on top for this. Is there a way to stop the script when player leaves the platform and/or launch another script? In some situations that would be great to have. No problem if it's not possible.
Really great work.
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
I've added a FishyPlat_HasPassenger(platTid, passTid) ACS function. Returns true if a platform with "platTid" is carrying a passenger with "passTid". Returns false otherwise.doomzie wrote: ↑Thu Feb 23, 2023 1:03 pm I can only ask you if there's a way to know that the player has left the platform? That would be the cherry on top for this. Is there a way to stop the script when player leaves the platform and/or launch another script? In some situations that would be great to have. No problem if it's not possible.
(Note that this will compare all platforms with platTid and all other actors with passTid until the condition is met.)
Passing 0 to either platTid or passTid is interpreted as the script activator.
I've added some examples in TEST03 (Test map #2) so you can check that out.
In your case I'm assuming the player is the script activator? If so, add something like
Code: Select all
if (!FishyPlat_HasPassenger(22, 0)) //22 is your platform - 0 is the player
Terminate; //End the script
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
Hey man, I'm not sure why I can't get it to work. I digged into TEST03 to see what I'm missing and all I can say is that my particular map situation is maybe somewhat different on my side. I'm actually making the platform move as soon as the player is on the platform. Like an automatic bridge activation. The platform doesn't move otherwise.FishyClockwork wrote: ↑Fri Feb 24, 2023 7:27 amI've added a FishyPlat_HasPassenger(platTid, passTid) ACS function. Returns true if a platform with "platTid" is carrying a passenger with "passTid". Returns false otherwise. (Note that this will compare all platforms with platTid and all other actors with passTid until the condition is met.)
Passing 0 to either platTid or passTid is interpreted as the script activator. I've added some examples in TEST03 (Test map #2) so you can check that out.
In your case I'm assuming the player is the script activator? If so, add something likeCode: Select all
if (!FishyPlat_HasPassenger(22, 0)) //22 is your platform - 0 is the player Terminate; //End the script
I tried to implement script termination (in my case stop movement) through FishyPlat_HasPassenger, but this function always return 0 (zero) in my script for the "special action":
Code: Select all
Print(s:"\cdPassenger=",d:FishyPlat_HasPassenger(0, 0));
Delay(105);
Print(s:"\cdPassenger=",d:FishyPlat_HasPassenger(intTID, 0));
Delay(105);
Code: Select all
----------------------------------------
Passenger=0
----------------------------------------
----------------------------------------
Passenger=0
----------------------------------------
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
Ok, I should point out that idle platforms don't look for passengers, meaning even though you're standing on one it doesn't mean you're registered as a passenger. That might be the issue. (This is deliberate because I'm not going to use BlockThingsIterators for idle platforms.) Try putting a Delay(1); after activating the platform and then use FishyPlat_HasPassenger.
Also, calling FishyPlat_HasPassenger(0, 0) will always return false.
EDIT: I'm going to change it a bit so any platform with "platTid" will be forced to do a BTI search at the moment the function is called.
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
I see, that explains it. Thanks already for your feedback. Take your time.
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
Code: Select all
function void FishyPlat_LeaveGroup (int platTid)
**Find all platforms with tid "platTid" and makes them leave their group.**
- platTid = TID of the platform(s) who will leave its/their group(s). If 0 then this is the script activator.
function void FishyPlat_DisbandGroup (int platTid)
**Find all platforms with tid "platTid" and disbands their group.**
TEST01 has an example of disbandgroup
TEST03 has an example of leavegroup
I did check.
First exercise though with these ACS functions.
In my own testing _LeaveGroup gives intended results, but _Disbandgroup does something weird. Can you still _MakeGroup after _DisbandGroup? My regrouped members move in the opposite direction after _DisbandGroup. Don't know. Trying to understand atm.
Just for the record, this made no difference. The special action is effectively triggered. Waits the time delay I set, then prints "0" and no code is executed in _HasPassenger.FishyClockwork wrote: ↑Fri Feb 24, 2023 4:56 pm Try putting a Delay(1); after activating the platform and then use FishyPlat_HasPassenger.
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
"DisbandGroup" does exactly that. It disbands the whole group. (Meaning it breaks up the group.)
It's like calling LeaveGroup on each group member.
It's like calling LeaveGroup on each group member.
I don't know what you're doing, but I'm assuming the platform you land on that triggers this has a non-zero TID, yes?
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
Yeah thought so from what I understand so far, but I had troubles with DisbandGroup. Currently doing for loop on each tid with LeaveGroup to break the group. Need to do more testing. My test is getting more advanced. Will let you know how it goes. Way cool feature.FishyClockwork wrote: ↑Sat Feb 25, 2023 11:14 am "DisbandGroup" does exactly that. It disbands the whole group. (Meaning it breaks up the group.)
It's like calling LeaveGroup on each group member.
Yes, it's tagged.FishyClockwork wrote: ↑Sat Feb 25, 2023 11:14 amI don't know what you're doing, but I'm assuming the platform you land on that triggers this has a non-zero TID, yes?
This may help
"Twin Bridge":
https://imgur.com/a/rM5VAyA
[imgur]https://imgur.com/a/rM5VAyA[/imgur] <-- how can you embed images??
[imgur]https://i.imgur.com/WZA0fo6.jpeg[/imgur]
Spoiler:
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
So if I'm reading that right, you're checking if the (presumably idle) platform has the player as its passenger before you send that platform to its destination? Okay, so the Delay(1); part is useless in that case.
I've changed the HasPassenger function so the platforms being checked will be forced to do a blockmap search for new passengers. I want you to fetch the latest commit and see if that fixes it.
I've changed the HasPassenger function so the platforms being checked will be forced to do a blockmap search for new passengers. I want you to fetch the latest commit and see if that fixes it.
-
- Posts: 94
- Joined: Sat Apr 30, 2022 4:26 am
Re: [ZScript] 3D Platform Actor (v1.1.1)
Yes.FishyClockwork wrote: ↑Sat Feb 25, 2023 1:39 pm So if I'm reading that right, you're checking if the (presumably idle) platform has the player as its passenger before you send that platform to its destination? Okay, so the Delay(1); part is useless in that case.
Ok.FishyClockwork wrote: ↑Sat Feb 25, 2023 1:39 pm I've changed the HasPassenger function so the platforms being checked will be forced to do a blockmap search for new passengers. I want you to fetch the latest commit and see if that fixes it.
So, I presume the rotation functions only accepts rotational values between -360 and 360 (like in the editor I presume)? To rotate 1080°, you need to call Rotate three times? Just to be sure. Thanks..
-
- Posts: 786
- Joined: Wed Feb 23, 2011 11:04 am
- Preferred Pronouns: No Preference
Re: [ZScript] 3D Platform Actor (v1.1.1)
I think you can get away with 1080° just make sure "exactAngs" is false. (I'm assuming you want to rotate in one direction?)
Give it a try.
Give it a try.