Fritzbot Goal Tracker
From Bots-United Wiki
Contents[hide] |
Intro to the FritzBot ET Goal Tracker
FritzBot waypoints are filled with actions (goals) for the bots to find and use. Not all actions are available at the beginning of a round, some actions stay active for an entire round, and some actions may never become active. When, where, why, and how these actions become available is up to the waypointer to define. As maps become populated with 50, 100, or even 256 actions, management of them becomes increasingly difficult. The first tool developed to aide in the management of the goals is the Goal Tracker.
What it is
Simply put, the Goal Tracker is a numerical value that let's the bots know what actions are available at a given time. It is a reference that starts at 0 and increases as certain events occur in a map. If any actions share the same goal number as the value of the Goal Tracker (/goal_num in console), they are considered to be active. Conversely, if they do not share the same value as the Goal Tracker, they are considered to be inactive.
What it is not
The Goal Tracker is not a mechanism to turn actions on and off at a definitive time. Waypointers cannot manipulate the value of it and it updates itself based on certain events. It is not a method to entirely manage actions / groups if a map is not completely linear. Linear maps are those that have have definitive steps to complete, while future steps cannot be completed ahead of time (by humans or bots). Most RTCW maps are very linear, while most ET maps are not.
How it works
As stated before, the Goal Tracker is a numerical reference value that lets the bots know what actions are available to be used. The value of the Goal Tracker can be found using the /goal_num command in the console.
It increases its value by one when the following events occur:
- Dynamite destroys an objective
- Objective is stolen (i.e docs or gold crate)
- Major Construction is built
It decreases its value when the following events occur:
- Objective is returned
note: the goal tracker will only update itself if actions are set up for the dynamite and construct events in the current or future goal number. For steal events, the goal tracker updates whether or not you have an action for it.
As the value gets updated based on the objectives being completed, any actions that have the new value's action_goal defined (goal num) become active. And any actions that had the old value become inactive. This happens because in order for actions to be available, they must have the same goal number value as the current Goal Tracker value.
How to use it
Using the Goal Tracker is the process of enabling / disabling actions based on the Goal Trackers value. Actions can be enabled / disabled using two methods: non-scripted and script controlled.
Non Scripted Method
The non scripted method is the simplest way to activate and deactivate actions in maps with a linear game flow. To do this, the waypointer sets each actions action_goal to the predicted Goal Tracker value at a given time during game play. Because the Goal Tracker value starts at 0, any actions the waypointer has set to action_goal 0 will be available at the beginning of the round. When an event occurs that updates the goal tracker, those action_goal 0 actions become inactive (unless set to active forever) and any actions the waypointer set to action_goal 1 will become available.
However, this method is very limited and depends on a specific order of events occurring. If a Goal Tracker updating event occurs before the waypointer expects it to, the whole map flow will be broken for the bots. For most ET waypoints, this method is only used for goal 0 actions.
Script Controlled
The script controlled method provides the most flexibility and control. It provides a means to enable / disable actions based on events occurring regardless if the Goal Tracker is updated or not. Activating an action in the aiscript sets the actions goal number to the current Goal Tracker value. Deactivating an action in the aiscript sets the actions goal number to -1 because there is no risk of the Goal Tracker reaching that value.
This method does not ignore the progress of the Goal Tracker, it provides a means to add or remove actions from the available action pool. If you activate an action via the script in goal 1, and the Goal Tracker updates to 0 or 2, the activated action will no longer be active (exactly as it would via the non scripted method). If the Goal Tracker value becomes 1 again, the action will again be active. This makes management extremely difficult in complex situations. Action_active 1 is the solution.
The script controlled method takes advantage of the active forever action flag (action_active 1). With this flag, once an action is activated, it can only be deactivated in the script. This happens because as the Goal Tracker updates itself, it looks for all actions with the active forever flag set and updates those actions goal number as well.
This may seem complicated, but in practice it is simple if you follow two rules for script controlled actions:
- Set action_goal to -1
- Set action_active to 1
By doing this, you can be sure that the action will be activated when you want and that it will stay active (until deactivated in the aiscript) even if the Goal Tracker updates.
Dynamite Actions
Dynamite actions are a special case when working with the Goal Tracker. There are four unique things about them that a waypointer should understand:
- If two or more dynamite actions start out in the same Goal Tracker state (value), only the first one will update the Goal Tracker
- Once a dynamite action becomes available, it will remain active forever (even if it's not set to action_active 1) until either it is completed or turned off in the AI Script.
- When Dynamite actions are completed, they are 'killed' the same way the command kill_action works; their types and group will be set to -1. This ensures that they can never be turned on again
- In order for a Dynamite action to update the Goal Tracker, it must be in either the current or future Goal Tracker state.
note: if any dynamite actions start out in goal_num -1, most likely the entire map (other than goal 0) will have to be script controlled
Putting it all together
Most ET maps use the non scripted method for Goal 0 actions and the scripted method for the rest. The scripted controlled method makes management of seemingly complex scenarios simple. An example is the waypoints for Fueldump. There are 168 actions within 23 groups. All 168 actions are set to active forever and all actions not available at the start of the map are set to action_goal -1. The actions are then turned on or off based on events in the map without the waypointer worrying about what the Goal Tracker value might be at a given time.
The same simple rule applies for any number of actions or groups; if the actions goal number shares the value of the Goal Tracker value, it's considered active. Setting the action_goal to -1 and action_active to 1 simplifies the process of ensuring that script controlled actions are available at the correct time.