Replies: 3 comments 1 reply
-
Hi, there are a lot of ECS implementations out there but Fleks is definitely not based on flecs (which I heard for the first time now :D). Also, in C you have certain features which are more convenient than in JVM based languages like Java and Kotlin. One big difference is the possibility in C++ to like "inherit" static fields. This is important for unique component ids that can be "magically" created in the background while in Kotlin we need to inherit for a specific interface/class to make that happen. Anyway, I quickly read through the article and imo most examples (maybe all of them) are already doable in Fleks but in a different way. Just to give you two examples: InventoryThis can be solved by having a single component that references to the different items (=entities). You can then add an class Inventory : Component<Inventory> {
val items = mutableListOf<Entity>()
override fun type() = Inventory
companion object : ComponentType<Inventory>()
} LikesIn Fleks we have families to know if an entity has a specific configuration of components. You could implement an enumeration for entity types like: enum class EntityType { DOG, CAT, .... } and a component like: class Likes: Component<Likes> {
val types = mutableListOf<EntityType >()
override fun type() = Likes
companion object : ComponentType<Likes>()
} You can then create a family like Referencing entities in components is also save in Fleks because of the So in short, I think a relationship functionality is not super important since everything can be solved in multiple ways and I am pretty confident that Fleks can solve all those problems. However, I understand that the special storage and implementation of a relation system will be faster/more convenient in certain scenarios which would be cool. Unfortunately, I won't have the time to look into that but I can give you some hints that might be important for you:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for a quick reply.
This not what i meant. I would like to be able to add both Likes-Cats and Likes-Dogs.
This is really interesting. I think this has the potential to fulfill my requirement. I will fiddle with and we will see... |
Beta Was this translation helpful? Give feedback.
-
Hey, i tried many things and you were right, the best approach here would be to stick with the good 'ol mutableList :) Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi
I thought that fleks is based off flecs(c++ implementation). But i guess its not?
Anyways i saw this article about entity relationships and thought that it is really cool and offers great possibilities:
https://ajmmertens.medium.com/building-games-in-ecs-with-entity-relationships-657275ba2c6c
long story short its about being able to do something like this:
1.
and the queries are the most powerful feature of this:
https://www.flecs.dev/flecs/md_docs_2Queries.html
Do you guys think its doable in fleks?
I spent some time already trying to create a proof of concept in fleks, but so far no success.
I'm looking forward to a discussion.
Beta Was this translation helpful? Give feedback.
All reactions