Single Player Bot Updates:
Today, I tackled some of the problems with playing in single player with bots. One of the biggest problems reported was that the bots do not pickup health. Unfortunately, the current way the bots pickup and use health from L4D2 is based on a weapon system and since our current health system is pickup INSTANT health… I started to create a new survivor bot behavior check. Some design constraints..
- Don’t wander too far off to find health
- Continue fighting while in combat unless health is critical and close
- Highest behavior priority goes to helping actual players in trouble or incap before worrying about bot health
- Keep the bot threshold at 60% health before breaking into health scavenge mode and bogarting all health from players
So, the base behavior system for collecting objects is very robust in L4D2, and I have gotten very familiar with the bot code over the past two years. I decided to add a throttled update check ( 1-3 seconds) in the “SurvivorBehavior::Update” loop with prior design constraints. Then, the next hurdle to overcome was a tracking system to find out what health was available, where it was on the NavMesh for path building, and ensure that the health was actually reachable. Our current health system is very dynamic since it can drop from any enemy at any location, so I decided instead of actively searching the environment for available health… instead to keep an active global list that is updated on health creation and destruction. This made it very low cost performance wise and efficient. A few hours of code later range checking, navmesh storage, and now the bots are running around and picking up health.
The next issued I addressed today was when the warriors’ legs were blown off they would start crawling. However, the current bot aiming and weaponfiring system was shooting at the warrior as if it was still standing up. One crawler left alive could wipe out all of the bots, as they are more deadly than the regular warriors. This was a quick fix, just added some checks to see if the warrior was a crawler and if so roughly aim the gun towards the ground with a random spray factor. These issues are now fixed and ready for the next update.
