Omni-bot Script Goals
From Omni-bot Wiki
| Main Page | Omni-bot Script Goals |
Contents |
Script Goals
Script goals are a feature of 0.7 and so are not yet available in the latest public release.
Intro
New to Omni-bot 0.7, scripted goals have gotten a complete makeover, along with the internal goal system.
Several large changes are the result of this new system
- Drop-in goals - In 0.66 scripted goals had to be added to the bot profile(def_bot.gm). This sucked, so it's gone. Script goals are now independently dropped in to a folder and they are loaded automatically. This also makes it much easier to share custom bot goals from users.
- Smaller, faster, easier, more reliable - More helper functions, events, and callbacks have been added, resulting in easier to write scripts that are smaller and run faster. What previously needed yield loops to accomplish is now done with events, making it much faster. Reliability is much improved. No more being unsure of missed cases where your goal can leave the bot in an unknown state(the dreaded standing around bug of <= 0.66).
- Easier Debugging - The new Debug Window contains a high level picture of the behavior tree of the bot, using icons and colors to represent the activity that is going on in the bot. At a glance, you can see what behavior the bot is running, disable or tweak properties of them in real time, and enable debug drawing of specific states.
Script Goals
Script goals are located in the scripts/goals folder of the Omni-bot installation folder, under the relevant game. For example, for Enemy Territory it is et/scripts/goals. They can alternatively be placed in global_scripts/goals where they will be loaded in any game.
All script goals must have a prefix of goal_ in the filename. This prefix is what the bot uses to load all script goals that exist in that folder.
During the initialization of the bot, all files in the global_scripts/goals and scripts/goals folder starting with goal_ will be loaded once to create a template for a goal. When a bot is added to the game, all script goals that were previously loaded are cloned and added to the bots behavior tree, which can be seen in its entirety in the Debug Window.
When the goal_* scripts are run, the value of this in the scripts is the script goal object itself, and it is up to the script to define the necessary functions for the goal.
Anyone familiar with Finite State Machines (FSM), will recognize the very state machine like setup of script goals.
Script Goal Functions
Script Goal Functions are documented in the ScriptGoal script reference page.
Game Specific Script Goals
Certain games may come with script goals already implemented. They implement additional functionality for the game they were written for. They may also be used as reference for writing your own.