Closed 1vanK closed 3 weeks ago
But in EnTT, you simply can't add multiple components of the same type to one entity.
You can have multiple components of the same type already:
registry.storage<cannon_type>("left_cannon"_hs).emplace(entity);
registry.storage<cannon_type>("right_cannon"_hs).emplace(entity);
See here for more details. If you have any further questions once you have read the documentation too, then I am here. Moreover:
I create a weapons component that holds an array of entities, each of which is a laser cannon
You can also create a component with a fixed-size array of cold elements and a counter of in-use ones. There is no need to use cannons to kill mosquitoes sometimes. It really depends on the user case.
I used chat GPT which said that in entt this is impossible to have multiple components of the same type xD
Thanks!
Don't use ChatGPT for coding unless you have enough knowledge and experience, otherwise you won't be able to assess the correctness of the AI answer. And read documentation first.
I use chat GPT when I'm learning the basics of something new, it's useless for more professional stuff xD
It's dangerous for learning, because you can't distinguish correct information from incorrect information. Anyway, there is a better neuronal network for learning things. Everyone have it.
Can this be added to https://github.com/skypjack/entt/wiki/EnTT-in-Action?
Sure thing. Can you provide name, link and a short description in English? Similar to what you see for the other games. Thanks. 👍
Well, I don't know how to describe it. It's a small demo for engine. Ships fly out onto the screen, the player shoots at them and gets points for it.
Something like Tyrian https://www.youtube.com/watch?v=w4XOBfOcYgE
It's called "Letalka"
Got it. Adding it to the wiki. 👍
Thanks!
Let's say you described a component - a laser cannon. The cannon can be mounted on a tank, or on a building. The tank can get hit, and the tracks will stop moving, but the cannon will continue to fire, or the turret with the cannon can be detached, and the cannon can similarly continue to fire.
But in EnTT, you simply can't add multiple components of the same type to one entity.
What do you do when you have an airplane with several laser cannons? In other words, you can't easily make it so that one cannon gets detached, falls to the ground, while the other laser cannons continue to fire.
Okay, I create a weapons component that holds an array of entities, each of which is a laser cannon. But I need to move the cannons not separately, but together with the airplane. And now I have to store the entity of the parent object (the airplane) in each cannon. In short, it becomes a mess.