The library in development stage. May be not fully tested and README may be not full. If you have any questions, please, create an issue.
Decore - a Defold library for managing ECS game entities and components in a data-driven way. The ECS is based on tiny ECS library.
- Entity Management: Register, create and manage game entities
- Component Management: Add, remove and update entity components
- Easy Integration: Simple setup and integration with Defold projects
Add in your game.project dependencies:
https://github.com/Insality/decore/archive/refs/tags/2.zip
local decore = require("decore.decore")
function init(self)
local world = decore.new_world(
require("system.input.system_input").create(),
require("system.transform.system_transform").create(),
require("system.game_object.system_game_object").create(),
)
decore.register_entities("game", {
["player"] = require("entity.player.player_entity")
})
world:addEntity(decore.create_prefab("player"))
end
function update(self, dt)
self.world:update(dt)
end
function on_input(self, action_id, action)
return self.world.input:on_input(action_id, action)
end
function final(self)
self.world:clearEntities()
self.world:clearSystems()
endlocal decore = require("decore.decore")
-- Create new world instance
decore.new_world(...)
-- Create new system instance
decore.system(system_module, system_id, [require_all_filters])
decore.processing_system(system_module, system_id, [require_all_filters])
decore.sorted_system(system_module, system_id, [require_all_filters])
decore.sorted_processing_system(system_module, system_id, [require_all_filters])
-- Register entity to create it with `create_prefab` function
decore.register_entity(entity_id, entity_data, [pack_id])
decore.register_entities(pack_id, entities)
decore.unregister_entities(pack_id)
-- Create new entity instance
decore.create([components])
decore.create_prefab([prefab_id], [pack_id], [components])
-- Register component to decore components
decore.register_component(component_id, [component_data], [pack_id])
decore.register_components(components_data)
decore.unregister_components(pack_id)
-- Create new component instance
decore.create_component(component_id, [component_pack_id])
decore.apply_component(entity, component_id, [component_data])
decore.apply_components(entity, [components])
decore.find_entities(world, component_id, [component_value])
decore.print_loaded_packs_debug_info()
decore.print_loaded_systems_debug_info(world)
decore.set_logger([logger_instance])
decore.get_logger([name], [level])This project is licensed under the MIT License - see the LICENSE file for details.
If you have any issues, questions or suggestions please create an issue.
Your donation helps me stay engaged in creating valuable projects for Defold. If you appreciate what I'm doing, please consider supporting me!
