top of page

Senior Production Greenlight

Over the past couple weeks, I have been reworking the Mafia Car's AI for Cash Force. When coming into the project, I saw the AI originally worked off one Unreal blueprint. It was well commented, so I was able to find all that I needed.

For the first week, I dabbled in the Unreal Vehicle Movement to find a small solution to their problems while I worked on the bigger project, crowd flocking. This change was pretty small. The Mafia Car was just throttling forward while comparing the distance to the node, but it never slowed down for anything in front of it. This lead to a lot of the cars colliding into each other and wrecking. I added a braking method attached to the line renderer already in the blueprint. Another addition I added was turning off the throttle altogether when it was within a percentage of the total line renderer's length. This made the cars work exponentially better. There was only one problem left, the cars turning at cross intersections.

For the second week, I focused on the bigger picture, crowd flocking. I believe that, instead of using whiskers for the mafia cars, I could use a sphere collider to collect all the surrounding actors into one place. Normally I would do an EQS(Environmental Query System) but since we are using Engine 4.22.3, I was not able to get it running. Again, this didn't stop me since I was just going to use it to get information anyways. I also split the main components of the vehicle into three parts in a behavior tree: Steering, Throttling, and Braking.

For the braking, I just check to see if the Mafia Car is in front of the selected car by a 90 degree angle. The selected car will apply the brake by this function: (1-(distToCar/maxRangeOfCheck))*brakeModifier if the Mafia Car is within the angle. This is so the car will apply the brake more when it gets closer to collision. Another application I added was if the distance divided by the max range check was less than half the total, it would turn off the throttle altogether. I put the braking method at the back of the sequence so it could override the throttling task. For the throttling, I start off by making sure the Mafia Car won't go faster than its maximum speed. When it goes over the maximum speed, the throttle is turned off. When it isn't hitting the capacity of its speed, I set the throttle to the throttle value that was determined before I was on the project. The last thing I'll talk about is the steering method. The first part of the steering is checking whether or not the passengers have died. If the passengers have died then the car will pull over to the side of the road. If the passengers are safe then it follows the actual method. I take the surrounding Mafia Cars and check to see if they are to the left or right of the car. I then apply the following function to get the steering value: steeringValue=(1-dist/maxRange)*steeringModifier Does it look familiar? Well it poses the same solution as the braking. As a Mafia Car gets closer to the selected car, we want to pull further away from it. The thing that makes this method different from the braking is that the function is only half of the equation. Another thing we needed was for the car to stay on the path. So we check to see if the target navigation point is straight ahead of the car. If not it turns towards the area to where the navigation point would be ahead. This is easier to see in engine since it seems like the car is always trying to be on the shown line path from one point to another. With these two combined methods, the car will stay on path behind the van while also avoiding one another so there aren't any collisions. That's basically what I've done for the greenlight process in Champlain College's Senior Production class. If you have any questions send a comment and I'll be happy to answer.


bottom of page