HTA PROGRESS 002: Dynamic Traffic with Spawning and Waypoints

Channel:
Subscribers:
12,600
Published on ● Video Link: https://www.youtube.com/watch?v=T_eYkE42sBM



Duration: 6:05
1,812 views
7


This build is a major update to the traffic AI. All traffic cars are dynamically loaded prefabs that spawn based on triggers. The NPC cars then follow a predetermined waypoint system independent of each other. Built in collision avoidance, but still there are some bugs from cars ramming each other because some spawns are too close by each other. How the system works: Player car hits a trigger, the NPC prefab is instanced at the corresponding spawn point for that trigger futher down the road where the player cant see. Once the NPC car is out of range (either drives way ahead of the player or the player just a few car lengths past the NPC car) it gets garbage collected to try and optimize physics and save on frame rate. Right now FPS is really horrible and video capture makes it twice as bad on this machine.

Current scene uses no lights whatsoever. All false lighting is done with shaders made in Strumpy Shader with dark an light applied as an emissive layer controlled much in the same way as fake fog shaders. The difference here is the fall off direction is being manually controlled by float 3 variables to position the light and shadow as if it were coming from the sun or main directional light. The actual directional light in the scene merely holds the sun flare effect. The lighting channel of all shaders has been turned off (made into a lambert with no reaction to light) for optimization. Car shadows are the unity standard assets blob shadow. Entire scene created from scratch in Unity3D 3.5 free version for the purposes of practicing basic scripting and getting acclimated to the Unity environment.


Next step is to add more traffic to fill the whole test track and add more traffic types, e.g. family van, SUV, big rig.

All art and sound effects are just placeholder for now. Gameplay first, art last... even though its the fun part!







Tags:
Highway Race
Race Game
Game Development
Unity3D
Highway Race Game
Mobile
iOS
Android
Unity (game Engine)
Android (operating System)
Unity Free 3.5
AI
Traffic
Dynamic
Spawn
Race
Trigger
Waypoint
Way-point