Modding - Entity Format

Entity Format
Many definitions in the Dream Engines configuration files will follow an "entity" format. That is, the file will have an "entities" object, and within it a list of entities of that type that will be available in the game. For example: map-spawns: { entity: { bloodwoodresource: { parents: [ "map-spawns.base.default" ] object: "bloodwoodresource" sub-spawn: "bloodwoodgather" sub-spawn-count: "4,7" resource-item: "bloodwoodlog" enemy-spawn-extra: 2 } 		featherstoneresource: { ... 		} 	} } The map-spawns object defines different objects that can be spawned in the map generation algorithm, and how that spawns behaves (the bloodwoodresource, for example, spawns a single "bloodwoodresource" object and 4-7 "bloodwoodgather" objects around it). Note that the actual spawn defintions (bloodwoodresource, featherstoneresource, etc) are located within an "entity" object under the "map-spawns" parent.

This format is very common, you will see it when defining Items, Buildings, Production Recipes, Crafting Recipes, Biomes, and more.

Base Types
Entity types often have base types that define common characteristics for the actual entities to inherit from, similar to abstract classes in object oriented programming languages. For example, a "melee-weapon" base type will define all the parameters that are required to make a simple Item entity function as a weapon, and more precisely a melee weapon.

Base types are usually defined within the parent object that contains all entities of that type, however, they cannot appear under the "entity" object itself - because then the system will attempt to load them as actual entities, while we only want to use them as bases for the entities to inherit. There is no weapon called "ranged-weapon", instead we want specific weapons such as "crossbow" to inherit the "ranged-weapon" parameters and expand on them.

For that reason, we usually place base types under the "base" object, which is a sibling of the "entity" object. statuseffects: { base: { default: { effect-prefab: "EffectPowerUpPrefab" } 		hidden-effect: { parents: [ "statuseffects.base.default" ] effect-prefab: null hidden: true } 	} 	entity: { overclock: { parents: [ "statuseffects.base.default" ] modifiers: { stats: { speed: 2 } 			} 			ongoing-sound: "status-overclock" } 		enrage: { parents: [ "statuseffects.base.default" ] modifiers: { stats: { dmg: 0.2, speed: -2.5, attackrate: 0.3 } 			} 			ongoing-sound: "status-enrage" } 	} } In this example, the "statuseffects" parent has a "base" child that defines the base types of the status effects (normal status effects, and hidden status effects that do not show an icon - usually reserved for status effects that are permanently applied by equipment) - and an "entity" child that contains the actual status effect entities.

The "entity" child then has an entry for each status effect, such as "overclock" and "enrage".