-
Notifications
You must be signed in to change notification settings - Fork 19
Engine initialization
You need three things to initialize the engine:
- data handler
- cache handler
- logger
- optional flag which controls if this instance of engine will be marked as default or not.
logger = TextLogger('eos_tq', 'data_folder/logs/eos.log')
data_handler = JsonDataHandler('data_folder/phobos/')
cache_handler = JsonCacheHandler('data_folder/cache/eos.json.bz2', logger)
engine = Eos(data_handler, cache_handler, logger, make_default=True)
It will provide access to the data Eos needs. Built-in data handlers:
- [JsonDataHandler] (https://github.com/DarkFenX/Eos/blob/master/data/data_handler/json_data_handler.py), which takes path to folder with [Phobos] (https://github.com/DarkFenX/Phobos) JSON dump as initialization argument.
- [SQLiteDataHandler] (https://github.com/DarkFenX/Eos/blob/master/data/data_handler/sqlite_data_handler.py) which takes path to SQLite database as initialization argument. Data still should be in Phobos-like format.
Of course, you can write your own handler as needed. Interface is defined in abstract base class.
Eos needs access to following data in format of [{field name: field value}, ...] for each table:
- invtypes
- typeID
- groupID
- radius
- mass
- volume
- capacity
- invgroups
- groupID
- groupName
- categoryID
- dgmattribs
- attributeID
- maxAttributeID
- defaultValue
- highIsGood
- stackable
- dgmtypeattribs
- typeID
- attributeID
- value
- dgmeffects
- effectID
- effectCategory
- isOffensive
- isAssistance
- durationAttributeID
- dischargeAttributeID
- rangeAttributeID
- falloffAttributeID
- trackingSpeedAttributeID
- fittingUsageChanceAttributeID
- preExpression
- postExpression
- modifierInfo
- dgmtypeeffects
- typeID
- effectID
- isDefault
- dgmexpressions
- expressionID
- operandID
- arg1
- arg2
- expressionValue
- expressionTypeID
- expressionGroupID
- expressionAttributeID
- phbmetadata
- field_name
- field_value
Its purpose is provide fast and efficient way to the data Eos needs for calculations. It should take data in the following format ({entity name: set({field name: field value}, ...)}:
- types
- type_id (integer)
- group (integer)
- category (integer)
- attributes ({integer: float, ...})
- effects ([integer, ...])
- default_effect (integer)
- attributes
- attribute_id (integer)
- max_attribute (integer)
- default_value (float)
- high_is_good (boolean)
- stackable (boolean)
- effects
- effect_id (integer)
- effect_category (integer)
- is_offensive (boolean)
- is_assistance (boolean)
- duration_attribute (integer)
- discharge_attribute (integer)
- range_attribute (integer)
- falloff_attribute (integer)
- tracking_speed_attribute (integer)
- fitting_usage_chance_attribute (integer)
- build_status (integer)
- modifiers ([integer, ...])
- modifiers
- modifier_id (integer)
- state (integer)
- scope (integer)
- src_attr (integer)
- operator (integer)
- tgt_attr (integer)
- domain (integer)
- filter_type (integer)
- filter_value (integer)
When requested, it should return various objects needed for Eos when it uses handler's corresponding methods.
Built-in cache handlers:
- [JsonCacheHandler] (https://github.com/DarkFenX/Eos/blob/master/data/cache_handler/json_cache_handler.py) - fairly fast handler with medium-to-large memory footprint.
Interface is defined in [BaseCacheHandler] (https://github.com/DarkFenX/Eos/blob/master/data/cache_handler/abc.py).
As simple as it sounds, provides logging facilities. Following loggers are built-in:
- [TextLogger] (https://github.com/DarkFenX/Eos/blob/master/util/logger/text_logger.py) - write logs into plain text file.
Interface is defined in [BaseLogger] (https://github.com/DarkFenX/Eos/blob/master/util/logger/abc.py).
If true, all fits created within current python interpreter will be attached to this Eos instance by default; otherwise, you will have to pass Eos instance each time you instantiate a fit.