Skip to content

Instantly share code, notes, and snippets.

@nateberkopec
Last active December 16, 2016 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nateberkopec/1996216ed16291202a19b966b9fc1315 to your computer and use it in GitHub Desktop.
Save nateberkopec/1996216ed16291202a19b966b9fc1315 to your computer and use it in GitHub Desktop.

Overview

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.

ALIVE_clusters - There are a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment