Skip to content

Components and ships colonies other higher level entitys

se5a edited this page Dec 11, 2019 · 1 revision

Entities are made up of a number of Ability Datablobs. these abilities get their values from Components.
Components are Entities which are made up of Attribute Datablobs components are no-longer ECS type "entities", I need to sit down and re-write how they work, they're still somewhat similar to whats written, it's mostly just the structure of the components and facilities that have changed, which alleviated a bunch of problems with trying to fit them into the ECS style architecture, which made some things very confusing.

A high level Entity has a ComponentInstanceDB which contains a dictionary of Component type entities. thid dictionary holds the Entity of a component as a key, and a list of ComponentInstance as a value: @public Dictionary<Entity, List> SpecificInstances { get; internal set; } = new Dictionary<Entity, List>();@

Note that a high level component does not contain a separate instance of each Component Entity that it has. instead it has a single instance of the Component Entity which describes the Component, then has an SpecificInstance class for each instance of that entity, which describes how damaged it is for example.

To avoid running through the calculation to see how fast a ship Entity should be able to go each time we do movement, or how many minerals a colony Entity can mine every econProcess, we use the ReCalcProcessor. the ReCalcProcessor is basically a dictionary of AbilityDB linked to Processors. we can throw an high level entity at the ReCalcProcessor which will recalculate the high level abilities depending on the AbilityDB that the parent entity's sub componentInstance entity's have. we should do this every time an entity changes significantly, i.e. takes damage and looses a component, installs a new component or facility or removes a component or facility. etc.

A ship might have several engines of a specific engine design, so the ComponentInstanceDB dictionary would have that design entity as a Key, and then several SpecificInstances as a value. A colony might have several Mine Components, and the ComponentInstanceDB dictionary would have that mine design entity as a Key and several SpecificInstances as a value.

Currently the AbilityDatablobs are somewhat specific to the type of entity, ie we have ColonyMining etc. I'm intending to make these more generic, since a ship should be able to have the Mining Ability. before we can do this however, we need to define how restrictions on these abilitys will work. we can't for exampe have a ship with the mining ability mining from deep space. currently the ColonyMineingDB is getting it's parent planet via the ColonyInfoDB. we need to break the Abilities away from the ColonyInfoDB and ShipInfoDB and allow them to be more generic.