dominion-dev / dominion-ecs-java

Insanely fast ECS (Entity Component System) for Java
https://dominion-dev.github.io
MIT License
294 stars 18 forks source link

QUESTION: referencing another entities and direct component access #95

Closed demkom58 closed 2 years ago

demkom58 commented 2 years ago

I'm trying to implement a basic Transform component like in Godot or Unity.

The main idea is that the parent should affect the children, for that I need some way to reference them and then query the component.

I saw that there is an IntEntity with getId(), but this is not a public API and requests cannot be made using these identifiers. Also Entity doesn't have methods to access components.

Can we expect such functionality in the future or is there some other way to implement it?

enricostara commented 2 years ago

Hi @demkom58,

let's start by saying that is not possible by design to use directly any implementation class in the "engine" module. The reason, as you may guess, is that only the interfaces from the 'API' module can be used, so the project will be able to change whatever on the engine implementation without worrying about other projects that cannot directly refer to it.

Regarding your specific question, no strategy has yet been implemented that allows you to express a relationship between entities. This, as you can imagine, is not part of the basic ECS paradigm, but that does not mean that the Dominion project will not address this specific need sooner or later.