Skip to content

Engine initialization

Trent Bartlem edited this page Feb 25, 2015 · 9 revisions

You need three things to initialize the engine:

  1. data handler
  2. cache handler
  3. 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)

Data handler

It will provide access to the data Eos needs. Built-in data handlers:

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

Cache handler

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:

Interface is defined in [BaseCacheHandler] (https://github.com/DarkFenX/Eos/blob/master/data/cache_handler/abc.py).

Logger

As simple as it sounds, provides logging facilities. Following loggers are built-in:

Interface is defined in [BaseLogger] (https://github.com/DarkFenX/Eos/blob/master/util/logger/abc.py).

Default instance flag

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.

Clone this wiki locally