BeamNG.drive Script AI: Advanced Tutorial & Techniques

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up everyone bngf plus here in today's video i wanted to talk about script ai manager in bemidji drive and some of the more advanced tips and techniques that you can use with it i've done a couple of videos already using script ai including how you can set up realistic police chases as well as using motorcades and convoys if you haven't seen these videos already you might want to check them out as it goes over the basics of getting started using the tool so in this video we're going to go over a few more techniques one is how we can fix timing issues when things aren't working quite right two is how we can use timing to our advantage to create various crash scenarios things like t-bone crashes intersection crashes etc and three how to create crashes such as pileups using script ai that don't necessarily require timing to start things off let's just go ahead and create a very simple script ai situation where the blue car is going to attempt to overtake the green car on the highway to get to the script ai manager we're going to open the world editor by pressing f11 and under the tools menu gameplay we're going to select script ai manager where we can select one of the vehicles to record a path for in this case we're going to want to make sure the green car which is the coupe is selected as we're going to record its path first we're going to press the record button and if i press shift c on the keyboard it's going to bring me back to the vehicle and i'm going to unpause and start driving the car just like i normally [Music] would now that we're done recording the path we're going to press stop recording and if we hit the play button we can see what the playback looks like for that car taking a pause here and before we reset this vehicle's path and move to the next one one of the first recommendations i want to give is that you use the pause functionality frequently this is important when you're working with multiple vehicles to ensure that when you restart the path of the first vehicle and go to record the path for the second one that the first vehicle isn't already started so that you're trying to record a vehicle while the other one's already moving let me show you what that looks like now after pressing on restart replay for the first car it's going to bring it back to its starting point the reason we do all this while the game is paused is because we don't want the first vehicle to start driving while we're recording the path for the second one otherwise everything's going to be out of sync when we go to play it back so now let's unpause the game and record the second vehicle just like we did the first one so now back to our original scenario we're gonna try driving and having the second car pass the first car once both vehicle paths have been recorded we're going to press the play button at the top of the screen here again with the game paused that's going to put both vehicles in their starting position and when i unpause the game we can take a look at what this looks like [Music] pausing once again obviously you can see this isn't the path that was recorded but actually the path itself is okay it's just the timing of things didn't quite work out what we saw was the blue card didn't go all the way around the green car instead it started to cut in too early and clipped the back of the green car and spun it out this means that we can actually fix this using the existing paths without having to re-record both vehicles let's go back to our starting point by pressing play all and if we think about what we just saw essentially the green car got a little bit too far ahead which meant the blue car didn't have enough time to get around it we can actually fix this by giving the blue car a little bit of a head start over the green car to do this i'm going to unpause the game and after about half a second or so i'm going to pause the game once again so obviously as you can see both cars got started now if i flip back to the green car i'm going to press on restart replay while the game's paused and that's obviously going to bring it back to its starting position and we can see behind it the blue car has already gotten a bit of a head start we can even see how this is playing out in the script ai window we can see that the green car has a playback of zero percent meaning it's just getting started whereas the blue car is at a playback of five percent so it's already started its path we'll talk a little bit more about these percentages and how they can be helpful later on in this video so now let's unpause and take a look at what the path looks like with the blue car having a little bit of a head start so as you can see this time it was successful and it was just a matter of making that very small timing change when starting out the vehicles this may not work in every situation and there may be times where you need to re-record the entire script ai path but if you're noticing the path seems to be good and things are just a little bit off like we saw before it might just be a matter of adjusting the timing to make things work staying on the subject of script ai timing let's take a look at how we can use it to our advantage to create various crash scenarios alright so here we are on the east coast map and the situation i want to create is this white car is going to go straight ahead run through the stop sign and cause a t-bone accident in the intersection let's take a look at how we can set this up so let's start off simple and we're going to open up the world editor by pressing f11 and tools gameplay script ai manager like we did before and we currently have the white car the moon hawk selected so i'm going to press record i'm going to press shift c to lock the camera onto it and i'm just going to drive it through the intersection at this point it doesn't matter that there's no oncoming traffic because we're going to adjust the timing for all of that in just a moment so now that i have the path recorded i'm gonna press stop we can even replay it just to make sure everything looks good okay and i'm gonna press restart replay and i'm gonna stop playing it for now while we set up the other oncoming traffic so on the road that's perpendicular to the one that has the white car i've set up some cards that we can use as traffic we'll need to record script ai paths for each of these vehicles just like we did before so i'm going to quickly go through that and set up some script paths you're probably noticing that i'm letting the vehicles crash down at the end of the road here um that's because it doesn't really matter what happens at the end because the actual crash is going to happen back at the intersection so we don't really need to worry about how things end down here so now with everything reset and paused i just wanted to show you what the script ai paths look like on the road so you can see the yellow one is the white car that's going to be coming across and the various colors over here are from the traffic that's going to be coming down the road we might end up being lucky in that if we simply just play this all back it might result in a crash like the one we're looking for but to demonstrate that we do have some control over the timing of things i want to specifically try and target having the white car crash into this white pickup truck so i have the camera position back at the intersection and let's take a look at where things stand now without adding in any sort of timings so i'm going to press play all in the script ai manager and i'm going to unpause the game alright so as you can see the car has obviously missed all of the oncoming traffic so now we need to get into adjusting some of the timings so back to the earlier concept that we spoke about around giving a specific vehicle a head start over another one in this case we actually need to give our oncoming traffic a little bit of a head start so to do this i'm going to press play all which is going to reset all of the vehicles so now this time instead of guessing a number of seconds that we need to wait before we reset the car i'm going to watch the percentages specifically i'm going to take a look at the percentage of the pickup truck and i'm going to start off by picking a specific percentage that the pickup is at when i'm going to reset the moonhawk let's say as a starting point we're going to let the pickup get to 10 before we pause the game and reset the car if it doesn't work out we can always make adjustments so i'm going to hit play all and unpause the game i'm then going to pause it when the pickup gets to 10 percent and i'm going to reset the moon hawk which is the car and i'm going to unpause it and we'll take a look at what that looks like so you can see still it's a little bit early so we're gonna pick a new percentage i think maybe 15 percent might make sense and we'll try it again so again i've paused the game when the pickup's at 15 i'm gonna reset the car and unpause the game and we'll see what happens so there we go we now know that 15 is the number that we want the pickup truck to be at before we reset the car in order to get the crash we want in the intersection and now because we know it's going to work we can actually close the world editor go into photo mode and position the camera where we want it to be so if i just put the camera there approximately because we saw the pickup in the car kind of fall down into this ditch and now if i continue playing it back we should get the crash we're looking for at the camera angle we want now the last concept i wanted to show you will hopefully sort of tie everything that we've done up until now together and that's going to be how we can do a highway pileup style crash with traffic to start things off i've already created a simple crash scene using script ai and the two vehicles on the screen let's take a look at what that looks like before we add in additional vehicles and traffic so pausing it right there we can see that the crash worked out pretty well and the timings are already set so all we'll need to do is play back those two vehicles and the crash will be successful while this is fine as it is let's now look at how we can add traffic to the highway that will contribute to the pileup crash so now with those two vehicles reset i've added in some additional vehicles behind the van that we can use as traffic starting with the first car and with the game paused i'm gonna play back the van script ai path but not the hatch this is because i don't want any interference or collisions to happen while we're recording the traffic path so if i hit record and start driving just like i want it to you saw the van take a little bit of a swerve which obviously indicates that this is where the collision is going to occur so at this point i've paused the game and i'm going to stop the recording for this first vehicle it's also important to remember just like before to click on more and uncheck loop that way the vehicle is not going to keep resetting and playing it over again it's just going to stop when it finishes its path now at this point all of the script ai paths have been recorded including for the traffic vehicles and with the display path checkbox checked you can actually see on screen what each of the vehicle's paths will look like leading up to the crash scene before we get started i'll uncheck the display path close the world editor and the other thing i want to do is go into the environment setting and right down here at the bottom i'm going to clean up any tire marks that were left from when i was recording the paths with the camera now in position let's go ahead and hit play for all of the vehicles and we'll take a look at what this looks like so that worked out pretty well by just having script ai playback all of the vehicles that we recorded and having them crash into the pilot one of the things you may have noticed is this beige colored car braked very late going into the pileup this is somewhat unrealistic as in reality he probably would have seen the pile up happening and tried to stop much sooner so keeping this in mind let's replay all of the vehicles and i'm going to pause the game when i think some of the vehicles at the back such as the beige car should be breaking [Music] pausing the game right here it should be pretty obvious to the red and the beige cars in the back that a pileup is happening in front of them so rather than letting script ai play their paths out i'm going to open up script ai manager in the world editor and for those two vehicles etki and midsize i'm going to stop their paths early this is also a good opportunity to change the camera angle while the game's paused pausing once more you can see it was a much more realistic reaction to the pileup rather than driving straight into the pileup and braking very very late both of the vehicles braked early causing them to spin out before they crash using the same concept that we just discussed of stopping some of the vehicles early the other thing we can do is we can actually take control of one of the vehicles after we've stopped at script ai path and drive it ourselves to avoid the pilot so once more i'm going to click on the stop plane beside the etk i and the mid-size but this time instead of letting it play out i'm actually going to switch over to the mid-size vehicle here and i'm actually going to drive it myself i've even switched over to the interior view just to show you that you can use many different angles when playing back script ai and recording your scenes the advantage to this as you probably noticed is that you have much more control over the braking this allowed me to bring the car to a much more gentle stop rather than having it spin out like script ai did this is just one simple example of creating a crash scene using script ai and pilots you can obviously vary things like the number of cars speed etc but hopefully this gets you started hopefully you enjoyed this video and i definitely plan on doing more videos with other script ai concepts so if you have any other questions or ideas feel free to leave me a comment below as always i appreciate your feedback and suggestions and we'll see you in the next video
Info
Channel: BNGF Plus
Views: 297,409
Rating: undefined out of 5
Keywords: beamng, beamng.drive, beamng fun, beamng-fun, beamng crashes, beamng script ai, beamng tutorial, beamng script ai tutorial, beamng script ai manager, beamng traffic, beamng ai traffic, beamng how to ai, beamng traffic how to, beamng how to add traffic, beamng traffic on map, beamng ai crashes, beamng movie making, beamng how to make videos, beamng accident scenarios, beamng scenarios, beamng how to, beamng how to record, beamng t-bone, beamng intersection crashes
Id: KXOL9BlmWIM
Channel Id: undefined
Length: 14min 33sec (873 seconds)
Published: Tue Apr 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.