Changes between Version 1 and Version 2 of AIEngineAPI
- Timestamp:
- Jul 14, 2011, 7:42:34 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AIEngineAPI
v1 v2 1 1 AI scripts receive data from the engine about the current simulation state, once per simulation turn. This is a fairly low-level mechanism - it is expected that AI scripts will use a wrapper to provide more convenient access to the data. Currently this wrapper is implemented in `common-ai/base.js`. 2 3 > Note by lexa: here is [http://code.google.com/p/split-bot/source/browse/#svn%2Ftrunk%2Fsrc%2Forg%2Fzeroad%2Fcommon_api a fully typed description of the javascript classes] 2 4 3 5 The AI's `HandleMessage` method is called with one argument: … … 13 15 }; 14 16 }}} 15 16 17 == `entities` == 17 18 18 TODO 19 19 20 20 == `events` == 21 22 21 TODO 23 22 24 23 == `map` and `passabilityClasses` == 25 26 24 {{{ 27 25 state.map = { … … 31 29 }; 32 30 }}} 33 34 31 {{{ 35 32 state.passabilityClasses = { … … 40 37 }; 41 38 }}} 42 43 39 `state.map.data` encodes all the passability data of each terrain tile. `state.passabilityClasses` gives bitmasks that define how to interpret `state.map.data`. For example: 44 40 … … 52 48 53 49 }}} 54 55 50 Since these are bitmasks, you can 'or' them together: 56 51