Jump to content
What you need to know about Doomworld and the GDPR Read more... ×
Search In
  • More options...
Find results that contain...
Find results in...
Xegethra

Can't get train to follow line smoothly. (Got it now, but need some help on some refinement.)

Recommended Posts

I'm trying to make a train follow the tracks. I managed to get it to do this but it does so very unconvincingly, jerking about and spinning around all the while. This is my first attempt at anything 3D modelled and indeed, anything that follows a path. I am using patrol points and thing set goal to do this.

 

I have tried using a_chase, and a_wander, they both have similar results except a_chase has the train try to follow the player and a_wander has it going in whatever direction it wants....even if thing set goal is telling it where to go. I'm really not sure how to get it to follow the patrol points and ignore, completely the player and anything else for that matter.

In both a_chase and a_wander i tried to use the flag CHF_NORANDOMTURN, but in either case it will crash on load. With a_Wander it gives me this error,
"Script error, "GTADoom V4.7.wad:DECORATE" line 18:
You cannot pass parameters to '('"

And with a_chase i get the message "1 errors while parsing DECORATE scripts" I used the wiki to find out that flag, and I wanted to try it.

Leaving them blank loads the wad but has the train go haywire.

https://zdoom.org/wiki/A_Chase
https://zdoom.org/wiki/A_Wander


I made a quick video showing what it does.

 

 


ACTOR TrainCarriage1 15060
{
  Radius 44
  Height 58
  +FLOORCLIP
  +SOLID
  +NOBLOOD
  Speed 10
  States
  {
  Spawn:
    POL5 A 1 A_Look
    GoTo See
    
  See:
    POL5 A 1 A_Chase (0, 0, CHF_NORANDOMTURN)
  Loop
  }
}

ACTOR TrainCarriage1 15060
{
  Radius 44
  Height 58
  +FLOORCLIP
  +SOLID
  +NOBLOOD
  Speed 10
  States
  {
  Spawn:
    POL5 A 1 A_Look
    GoTo See
    
  See:
    POL5 A 1 A_Wander (CHF_NORANDOMTURN)
  Loop
  }
}

Edited by Xegethra : Got spoiler wrong, again.

Share this post


Link to post

One small suggestion: I wouldn't use patrol points for precise movement as they still allow the actor to wander about a bit. Instead set the actor's speed to 0 and use an Actor Mover and Interpolation Points to set the path.

 

As for the spinning, I believe there's a Decorate function that makes the actor face the direction of travel. Perhaps start with that.

Share this post


Link to post

This has helped a lot thank you! Thanks a bunch


I'm not entirely sure why it sticks on that corner though, there are a couple more points for it to go to, I wanted to test it to at least the platform. It looks as if it doesn't like the raised sector, could be wrong. (I was, it was an interpolation point below the tracks I had missed.)

*edit*

Alright, so I have the train going around the track, it loops forever like it should do. But what of the other carriages I want to follow it? I tried setting it all up, and the 3 other carriages do follow the tracks like the first one does....however due to them not being solid because they need to get past some level geometry, they all just ride the tracks within one another. How do I get it so that they don't merge into one another and stay behind?

I'm a bit confused about the hit boxes, as models use a sprite as a hidden actor and that sprite uses a square hit box...I really don't know how to make an oblong hitbox for the trains. Which further makes things complex as I don't want pedestrians/players walking through the trains, I don't want the trains going through each other but I do want them passing level geometry such as building corners and so on. I maybe could perhaps shrink the models lengthways a little bit so they miss these level obstacles so I can them make them solid, but that doesn't get past the problem of the sprites hitbox they rely on, which is nowhere near the shape of the model. I can get the right height sure, but as the hitbox is scaled equally length and widthways I can't really do it as far as I know, but it won't rotate as the model does so that's another thing.

*edit again*

So it seems rotating and irregular shaped hitboxes wont happen. To much for the engine they say. Well, maybe in the future as newer Doom engines come out that expand things further perhaps....oh well, at least i can have a non solid single carriage train.... 

One cheap hackey idea is to have an invisible sprite with a hitbox that takes up a third of the carriage size and have three of those sitting inside the carriage. They could follow their own interpolation points that are situated closely to the ones the carriage follows. It would be jankey as Hell but I could make it a death object...you touch you die so you don't get stuck on it or anything. I would have to create another 3 tracks worth of points for each third to stop them merging I think.

Ahh didn't work, they keep getting stuck on each other, no matter how many ways I try to separate them. It'll just have to be the non solid single carriage trains then. Still, it's something that's only meant to be a visual thing anyway so the way it has to be is at least serviceable. 

Edited by Xegethra : Better video.

Share this post


Link to post

I like the ambient sounds of the people at the end of the video.

Share this post


Link to post

Yeah they insult you as they spawn in.

These are my trains currently. There are four of them circling the track. All my attempts at getting carriages to follow each other had failed...so I left them single. I also had trouble making them interact with anything, such as spawners to make it look they are dropping off passengers, whether I make them solid or not they didn't trigger anything off. I might try it again though.
 

 

Share this post


Link to post
On 27/01/2018 at 11:46 AM, Xegethra said:

Yeah they insult you as they spawn in.

These are my trains currently. There are four of them circling the track. All my attempts at getting carriages to follow each other had failed...so I left them single. I also had trouble making them interact with anything, such as spawners to make it look they are dropping off passengers, whether I make them solid or not they didn't trigger anything off. I might try it again though.

 

Could you make the train solid and trap an actor inside a box with no textures on the sides to make it undetectable from the outside, then use that actor as the trigger for the stuff you want? I think there maybe an issue getting the actor to stay in the hidden box though.

 

E.g.

train.png

 

 

But I think it's looking good and going around the corners a lot smoother. Was thinking you could have carriages behind using an offset but the problem would be going around corners. I wonder if it's worth the effort as it already looks good as it's an ambient thing not the whole map.

 

Edit:

Now my imagination is going wild and I'm thinking that if the hidden box was put close enough to the front of the train then a rocket or BFG orb could kill an actor in it. If this actor had a unique ID with BOSSKILL you could use this to trigger an action like the train stopping (or in the script for the train checking for the existence of the unique ID to continue). The action could be something like the release of a load of police lol. Chaos!

Edited by alowe

Share this post


Link to post

Well, I think I managed to get it working. I just could not get the trains to activate the linedefs, at all...whether they were solid or not. I realised they had no monster property assigned to them. So I put it on and what do you know....they disappear and don't load with the map....so, I wonder what if I put the ismonster tag on them instead....now they show up...but still refuse to activate linedefs. They too eventually stop loading in, after changing nothing about them. So I put the other monster property back onto them and they show up again....I have no clue why. But I hope it holds up, it would be an absolute chore to have to keep flip flopping them all the while.

Oh well, this is it when it works. It's a simple set up, there is a copy of the normal pedestrian spawners but with a smaller radius and it is activated by the linedefs the train runs over and then deactivated by another linedef when it pulls off. The spawner only spawns when it "sees" the player much like the others in the map...so pedestrians won't spawn when there are no players around and after a certain distance, the pedestrians despawn. So the platform uses this system too, but is doubly activated by the train as well. And as there is no guarantee of anyone spawning, sometimes even if the player is in the radius, no spawning will occur. So it's kinda like some of the time you'll see them get off the train, others you won't. There are copies of each platform spawn with their own id so they only activate at once when they meet a train, and not all at the same time.

 

Share this post


Link to post

Very nice. Even the announcements are as clear as real life lol

Share this post


Link to post

Hah yeah. I tried to source as many sounds as I could from the GTA series in general. The announcements come from GTA 3. Thought I would "liven up" the platforms a little more.

*edit*

Alright, now I have come up with a system for the player to "travel" on the train, it is somewhat elaborate but it works, I just need some refinement on it but I'm not sure how to achieve it. Here is a video showing this off. Namely the camera and the way you trigger it all off. what I would really like for the camera is to have a series of interpolation points the camera will follow alongside the track. I want the camera to instantly snap to the next one as it watches the train go by, similar to GTA 3, but without the panning. However the camera keeps on gliding from point to point, losing track of the train....If I could stop it doing this and have it just snap, then hold in place..then snap again, that might play out much better.

 

Edited by Xegethra

Share this post


Link to post
On 31/01/2018 at 9:26 PM, Xegethra said:

Hah yeah. I tried to source as many sounds as I could from the GTA series in general. The announcements come from GTA 3. Thought I would "liven up" the platforms a little more.

*edit*

Alright, now I have come up with a system for the player to "travel" on the train, it is somewhat elaborate but it works, I just need some refinement on it but I'm not sure how to achieve it. Here is a video showing this off. Namely the camera and the way you trigger it all off. what I would really like for the camera is to have a series of interpolation points the camera will follow alongside the track. I want the camera to instantly snap to the next one as it watches the train go by, similar to GTA 3, but without the panning. However the camera keeps on gliding from point to point, losing track of the train....If I could stop it doing this and have it just snap, then hold in place..then snap again, that might play out much better.

 

Since I've never used cameras in a map I don't have any experience. But, could you have more than one camera then set which one is being used by some trigger?

 

The internal of the train needs a little work. Is it possible to use one way mid textures for windows so you get a feeling of movement (other then the Flintstone style ground moving along?

 

Also, I haven't quite understood if you need to move between the carriages inside the train to make it work. Would also be nice if there was an inside-of-train sound when on the train to confirm you're on it.

 

But, you're taking this further that I thought would work. Nice!

 

And I like how each train has it's own unique graffiti on the side. 👍👍👍

Share this post


Link to post

Well, you're not meant to see that, that's just how it works. It serves as a place for Doomguy to get trapped in, as if he went into the train, I structured it so that hopefully any other players that may wish to use the other trains, would be kept separate and stay "with" their respective train. The camera that follows it works, but is wonkey as Hell.
 


But yeah, I think I'm done with it and I just do something else to it. I have yet to test it in multiplayer, but so far so good. All that really bothers me, is how it is all triggered. the linedef that activates it, can be used even though it's on the floor and the train isn't there....which if someone accidentally triggers it, that would be screwy. I did at one point have a wall that pops up with the switch on it when the train comes...but I soon discovered even then while the wall is down that the switch can still be used....

Edited by Xegethra

Share this post


Link to post
1 hour ago, Xegethra said:

... I did at one point have a wall that pops up with the switch on it when the train comes...but I soon discovered even then while the wall is down that the switch can still be used....

Use GetActorFloorZ for such an occasion. eg

 

script 2 (void)
{
   if (GetActorFloorZ (0) >= 128)
      {
         if(lineside() == LINE_FRONT) 
         {
              //do stuff;
         }
      }
}

 

Share this post


Link to post
15 hours ago, Kappes Buur said:

Use GetActorFloorZ for such an occasion. eg

 


script 2 (void)
{
   if (GetActorFloorZ (0) >= 128)
      {
         if(lineside() == LINE_FRONT) 
         {
              //do stuff;
         }
      }
}

 

Whether a switch is accessible is dependant on whether it is physically reachable (ignoring the z axis).

You can choose when switches are inaccessible by placing a physical barrier in front of them (or doing it in script). I haven't done scripting in Doom so the solutions I find are always non-scripted.

 

E.g.

Switch1.png

You might think that having a physical barrier in front of your switch would prevent you from being able to activate it but in my experience not always. The game doesn't model z-axis actions very well so sometimes you can activate switches that seem to be inaccessible (or monsters can). I think it might also depend on the source port you use.

 

To be absolutely sure the switch cannot be accessed (and sometimes, not even then) you need to cut off all z-axis routes to the line the action is triggered from.

 

E.g.

Switch2.png

Even if the barrier in front of the linedef with the trigger is higher, this doesn't mean your switch won't trigger. I tested this recently with a Cyberdemon and a barrier that was hundreds of units higher than the monster (but crucially didn't reach all the way to the ceiling). The monster still easily reached right over the obstruction and activated the trigger (in this case a teleport). I had to redesign that part of the level to achieve the desired result.

 

I've noticed that ZDoom has some options on how it interprets some variables that have a height element (involving player height, clipping, switch triggering etc).

 

Edit:

I like the way the camera works with your train. I don't think it's wonky at all. To me it's scenic. You get a good view of the city and how and where the train goes. Even makes a good screen saver while you're away from the computer :o)

Edited by alowe

Share this post


Link to post

The first video seems like normal train behavior to me. By the way I really like what you are doing with this project. Great idea and even better execution.

Share this post


Link to post
On 02/02/2018 at 5:11 AM, Kappes Buur said:

Use GetActorFloorZ for such an occasion. eg

 


script 2 (void)
{
   if (GetActorFloorZ (0) >= 128)
      {
         if(lineside() == LINE_FRONT) 
         {
              //do stuff;
         }
      }
}

 

This took way too long for me to figure out. But I got it, one for activating the line and another for deactivating it again. Works perfectly thank you!

 

@mgr_inz_rafal and Halfblind
Why thanks. I'm gonna focus a little more on pedestrians next, now that I think I've done all I can with the trains.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×