Getting Started
MobFarm Basics are a modular collection of resources providing basic functionality for other MobFarm packages. In general, these resources are for the control of AI units. Basics include mobility and navigation scripts that allow the AI to control units, scanner and targeting scripts to create simple decision making, and turret and weapon scripts. Also included are a few prefabs of simple units. Generally, each script component has an abstract base class that allows functionally to be built upon, while providing a common point of access that allows scripts to operate with each other. For example, MF_AbstractWeapon is the base class for MF_B_Gun. Other scripts will access the base class to use the gun, and this allows the creation and use of different weapon scripts without changing the base class. In this way, most of the components can be swapped out and built upon. How to Use
Below is a brief overview on how various components interact. For more detailed descriptions, see the tutorials and script reference. Movement and Navigation To make a unit move, it needs a mobility script and a navigation script. The navigation script will make decisions on where to go, and the mobility script will handle how the unit moves. In this way, mobility and navigation scripts can be changed without changing the other. Scanning and Targeting If a unit is to react to other units in the scene, it needs a way to see them and make decisions. Scanners will detect and gather information about other units and place that info in a target list. Targeting scripts will then make decisions about elements in the list. Units can have multiple scanners contributing to a list, and multiple targeting scripts reading the list. Platforms and Weapons Once a targeting script has chosen a target, it can then be used to aim a weapon. Platforms hold a weapon, and can be things like a stationary mount or a turret. Each platform is paired with a control element that looks for a target chosen by a targeting script, and operates weapons. The control element will feed the target to the platform, and the platform will handle the specifics on how to engage the target, such as a turret computing an intercept course and turning to the correct position. When a firing solution is found, the control script will operate weapons. Selecting Units Also included, are scripts to allow the selection of a unit. This allows a visualization of what units are on its target list, and the ability to manually edit its target list in real-time. |
Example Project Scene
A sample scene is included for you to tinker with and showcase some different uses and set-ups. The example is in the the Scenes folder of _MobFarm Basics. SpaceBattle Opposing teams of ships will spawn periodically. They will navigate around waypoints until they detect an enemy. Once they have a target, they will engage it. Large Ships: Fixed twin main guns. Will fly towards ships with the most health and engage with main guns. They will stay with their current target until it is dead. Small Ships: Fixed gun. Will fly and shoot towards the closest ship. Use the ‘z’ key to toggle the zoom of the current camera. Use ‘~’ to lock or unlock the mouse. |