Jump to content
IL-2 Series Forum

How to create continous vehicle traffic on a given road?


Recommended Posts

Posted

Hi all,

Would like to ask if anyone can help solve this little problem I have in the ME.. I want to create logic that generates a constant flow of trucks/vehicles on a road (i.e a new truck is spawned every minute or so and proceeds along the road. This is done until such time as we tell it to stop) This seems like a simple problem at first - you just create a group with the truck and its waypoints, and then spawn a new instance of the truck every minute and tell it to proceed to the first waypoint. The problem is, the waypoints (for some reason!) are not instanced (i.e. they are not unique to that instance of the truck) so, when you spawn the next truck and tell it to go to the first waypoint, any other spawned trucks will ALSO try to drive to the first waypoint again! In other words, activating any waypoint will tell ALL instances of the truck to follow it, and not just the one which was last spawned. 

One way around this is to copy-paste the whole group many times and just activate one at a time.. this is the only way I currently know of to do this but its messy and wont create an infinite stream of vehicles.. it will only create a number of trucks equal to the number of groups I copy-paste, so I want something more generic and "clever" than that. Does anyone have any cunning ideas to achieve this?

Posted (edited)

I think the solution would depend on the road distance that needs to be populated with traffic (20km, 50km, 100km +), also how many vehicles are you thinking (having too many of them will be a burden), also - is it just one road or a network of roads? 

In my missions I often use the loop routes, where I connect the vehicle's waypoints into a loop dozens of kilometers long and the vehicle travels back and forth along the same route. Looking from the air it can give an impession of continuous traffic.          

Btw, I have found that separate vehicles require individual waypoints, you can't place just one set of waypoints on the road and make various vehicles use it. 

Edited by Vendigo
  • Thanks 1
Posted
13 minutes ago, Vendigo said:

I think the solution would depend on the road distance that needs to be populated with traffic (20km, 50km, 100km +), also how many vehicles you are thinking (having too many of them will be a burden), also - is it just one road or a network of roads? 

In my missions I often use the loop routes, where I connect the vehicle's waypoints into a loop dozens of kilometers long and the vehicles travel back and forth along the same route. Looking from the air it can give an impession of continuous traffic.          

Thanks @Vendigo the loop idea is a good one, that could definitely help in some cases. I am not looking to have more than maybe 25-50 vehicles running at any given time, and I dont really know yet how long the road would be.. I am still in the concept stage where I am trying to figure out if there is a way to do it before I start building the logic.. 

Having thought about it a bit more, its a tricky problem because each waypoint is a distinct object in the mission and is linked to the vehicle (and also any other instances of that object), so you kinda have to create a different set of waypoints for each vehicle.. they cant "share" one set of waypoints without messing with each other.. and you cant even Target Link other trucks to the lead one to cut down on the number of waypoints  because you cant spawn Target Linked groups (why do we still have this problem 15 years after RoF launched!?). I really dont have an elegant solution to this yet.. 

Posted

Hi there

I'm struggeling with the limitations since 'Riss of Flight'
And to be honest...

The only way to implement what you want is:

copy as much instances of the entire logic for a convoy
as often as needed

What means:
all waypoints ... for every instance

And to make them 'chain'
either by timer
or by 1st (...) waypoint reached by a convoi

You'ld have the startup for every 'following' convoy be triggered
- either by a timer (started when the first convoi starts and starting the timerof the next one...)
- or when a conyoy reaches a waypoint and initiate the next instance....

And all requires massice use of recources and manual configuration (or a massive script doing that...)

Deci

  • Thanks 1
AEthelraedUnraed
Posted (edited)

This is actually quite similar to the problem I need to solve in the next iteration of the Nachtjagd campaign I just published... except that there, I need a constant flow of bombers that appears wherever the player is in the bomber stream. I've solved it in the following way:

  1. For each bomber, I have an individual spawn point and route.
  2. The spawning is triggered by a CheckZone that checks for the player.
  3. This links to a secondary "passthrough" timer MCU, which in turn triggers the spawner itself.
  4. As soon as 14 bombers have spawned (adjustable), ALL those passthrough MCUs get disabled. The CheckZone MCUs themselves always stay active.
  5. A bomber is deleted when out of range.
  6. As soon as a bomber disappears (out of range or destroyed), all "passthrough" MCUs get enabled again. Since CheckZones only re-enable themselves when the player is out of range, this guarantees no aircraft suddenly spawn right in front of the player.
  7. Copy paste a few hundred times, along the entire route. I've written some scripting logic to do it for me.

Disclaimer: This hasn't been fully tested yet.

I think this is actually the best way to do something like this and make it both scalable and usable in missions where you don't know the player's position beforehand. @Jaegermeister I'm interested to know if you see any issues with this.

Edited by AEthelraedUnraed
Jaegermeister
Posted (edited)
On 6/3/2026 at 5:47 PM, AEthelraedUnraed said:

This is actually quite similar to the problem I need to solve in the next iteration of the Nachtjagd campaign I just published... except that there, I need a constant flow of bombers that appears wherever the player is in the bomber stream. I've solved it in the following way:

  1. For each bomber, I have an individual spawn point and route.
  2. The spawning is triggered by a CheckZone that checks for the player.
  3. This links to a secondary "passthrough" timer MCU, which in turn triggers the spawner itself.
  4. As soon as 14 bombers have spawned (adjustable), ALL those passthrough MCUs get disabled. The CheckZone MCUs themselves always stay active.
  5. A bomber is deleted when out of range.
  6. As soon as a bomber disappears (out of range or destroyed), all "passthrough" MCUs get enabled again. Since CheckZones only re-enable themselves when the player is out of range, this guarantees no aircraft suddenly spawn right in front of the player.
  7. Copy paste a few hundred times, along the entire route. I've written some scripting logic to do it for me.

Disclaimer: This hasn't been fully tested yet.

I think this is actually the best way to do something like this and make it both scalable and usable in missions where you don't know the player's position beforehand. @Jaegermeister I'm interested to know if you see any issues with this.

I don't see any problems with the aircraft generation at all. You could also use a proximity trigger to the player for activating the bomber formations, but I think it would be about the same in the end.

I would set it up as a single spawn controller with proximity to the player and have that control all of them, but that's just me. Then you wouldn't have to place check zones for each formation, just the formations themselves and link them to your counters. When I say "spawn" I am referring to "activate" actually because they are formations, but you knew that. A pass through timer from each formation activate trigger could disable the proximity activate trigger and another pass through timer from each formation deactivate trigger would reenable it. 

There is no reason this wouldn't work for vehicles as well, but you would have to position individual waypoints for each column and I can see this as taking a lot of time. I just use separate groups and link them to the player with a check zone when in and out of range and it is simple enough.

 

Edited by Jaegermeister

Ryzen 7 7800X3D Raphael 4.2GHz CPU/ 32GB DDR5-6000 PC5-48000 CL36 RAM / Sapphire Nitro+ Radeon RX 7900 XTX 24GB GDDR6 GPU / ASUS Tuf Gaming B650E MB / 2x 1 TB Samsung 970 EVO+ M.2 HD / MSI 1000 Watt PS / HP Reverb G2 VR / TM Warthog Joystick / Moza MTQ Throttle / Saitek Pro Flight Rudder / MaxFalcon 20 Keypad Emulator / BBI-32 Leo Bodnar USB switch panel / Windows 11

Posted

Thanks for the input everyone! I think the main thing I was trying to avoid was copy-pasting the same logic hundreds of times and then trying to co-ordinate the timing of the spawns between the hundreds of groups, but I dont see a way around this tbh. I also wanted to avoid having like 500 trucks inactive at the mission start (which you would need if you are using TL groups), and then only activating them as they are needed because even inactive objects use resources.. I will play with the checkzone or proximity logic as well, but I do prefer to try make player-agnostic logic which you can just import/paste into a mission and not have to link it to anything, but I can maybe use the checkzones to disable vehicles if the player leaves the area to save some CPU time..

I quite like @Vendigo's loop idea.. that can at least give the illusion of more vehicles than actually exist.. its a pity we cant really have 2-way traffic in GB, otherwise it could be cool to send the trucks back along the same route.. Anyway.. will play around with it this weekend and see what I can come up with. Thanks again! 

Posted
9 minutes ago, Flashy said:

its a pity we cant really have 2-way traffic in GB, otherwise it could be cool to send the trucks back along the same route.. Anyway.. will play around with it this weekend and see what I can come up with. Thanks again! 

Actually, the trucks can avoid the oncoming traffic, so in fact it is possible to make them move back and forth along the same road. 

 

Posted
4 minutes ago, Vendigo said:

Actually, the trucks can avoid the oncoming traffic, so in fact it is possible to make them move back and forth along the same road. 

 

In my testing they veer off the road and end up in the grass when something comes the other way, and sometimes they even veer into each other 😅.. so what I meant is you cant really create a continuous flow of two way traffic like you would have on something like the Voie Sacrée around verdun in WW1.. 

Posted

Yes, if we have two trucks approaching each other, they both veer off the road once they come within a certain short distance, but they continue moving at slow speed and once they have passed each other, both return to the road and move on at normal speed. Sometimes they might collide, especially if the initial speed is high, but it is a rare occasion. I would say that 95% of the time they are able to avoid an accident, and they never get stuck or disoriented in the grass on the roadside. 

So I am certain that oncoming traffic works fine, I have used it many times, actually I think I use it in every mission. 

 

 

  • Like 2

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
×
×
  • Create New...