Difference between revisions of "Scripting Overview"
Nateberkopec (Talk | contribs) (Start) |
(No difference)
|
Latest revision as of 11:58, 21 December 2016
ALiVE is divided into five core components - Core, Military, Support, Ambience and Data.
Common Object Types
Several types of "objects" feature prominently in ALiVE's code.
Hashes
ALiVE uses CBA hashes nearly everywhere, through the ALIVE_fnc_hash* functions. Rather than using CBA hashes directly, ALiVE wraps them to provide some additional features, like guards for passing bad arguments, and nil return if a value does not exist. Prefer the ALIVE function if it exists, though any CBA function will work with any hash created by ALiVE.
Complete list of general-use hash functions, with ALIVE versions where applicable:
ALIVE_fnc_hashCopy
ALIVE_fnc_hashCreate
CBA_fnc_hashEachPair
CBA_fnc_hashFilter
CBA_fnc_hashHasKey
ALIVE_fnc_hashGet
ALIVE_fnc_hashRem
ALIVE_fnc_hashSet
CBA_fnc_hashSize
Sectors
In ALiVE, a sector is an object which represents a rectangular section of the map. All sectors are contained in the global variable ALIVE_sectorGrid. In ALiVE's code, they are often used for:
- Narrowing down search areas - rather than iterating through ALL clusters on a map, iterate only through those in a given sector. For instance, military placement uses the flat spots in a sector for placing units.
- Sectors are used extensively for map analysis.
See ALIVE_fnc_sector for more about what data sectors contain.
Clusters
In ALiVE, a cluster is a collection of map nodes. Map nodes can be things like houses, fuel stations, and other features.
Objectives
In ALiVE, an objective is a cluster which has been assigned to an OPCOM.
Useful Globals
OPCOM_instances - list of OPCOM AI modules.
ALIVE_battlefieldAnalysis - contains lots of useful functions for battlefield state.