Hello Felgo,
.
I have a similar approach to some things like in Squaby demo.
I try to borrow from it as much as possible, for example the design to have EditableComponent in base object for Entity to have nice Editor, or the way to create multiple instances of the same entity.
Main topic is component vs item.
I think I understand the difference, Qt Docs are quite clear here.
Just don’t understand why you used component in few particular places, what was the benefit there.
It is not urgent just would like to understand more why I am coping design from you 🙂
1. Is there any particular reason why you wrap Squaby entities with component?
It looks nice but I don’t understand why not just using normal entities wouldn’t be enough.
Component {
id: squabyYellow
Squaby {
id: sy
variationType: "squabyYellow"
score: balancingSettings.squabyYellow.score
gold: balancingSettings.squabyYellow.gold
health: balancingSettings.squabyYellow.health
damageMultiplicatorNailgun: balancingSettings.squabyYellow.damageMultiplicatorNailgun
damageMultiplicatorFlamethrower: balancingSettings.squabyYellow.damageMultiplicatorFlamethrower
damageMultiplicatorTaser: balancingSettings.squabyYellow.damageMultiplicatorTaser
damageMultiplicatorTesla: balancingSettings.squabyYellow.damageMultiplicatorTesla
pathMovementPixelsPerSecond: balancingSettings.squabyYellow.pathMovementPixelsPerSecond
}
}
Component {
// high fire resistance
id: squabyOrange
Squaby {
variationType: "squabyOrange"
score: balancingSettings.squabyOrange.score
gold: balancingSettings.squabyOrange.gold
health: balancingSettings.squabyOrange.health
damageMultiplicatorNailgun: balancingSettings.squabyOrange.damageMultiplicatorNailgun
damageMultiplicatorFlamethrower: balancingSettings.squabyOrange.damageMultiplicatorFlamethrower
damageMultiplicatorTaser: balancingSettings.squabyOrange.damageMultiplicatorTaser
damageMultiplicatorTesla: balancingSettings.squabyOrange.damageMultiplicatorTesla
pathMovementPixelsPerSecond: balancingSettings.squabyOrange.pathMovementPixelsPerSecond
}
}
2. Another thing is why do you use ComponentBase and not normal Item, as a base for HealthComponent?
From what I understand from docs, components are not shown by default and are only drawn on demand.
Components are better for reusing and more encapsulate the internals, better public interface.
Still not see the main benefit in this scenario.
I see there is a property owningEntity in ComponentBase so probably is to connect entity and component.
Why not make health a part of the entity?
3. Another one about components
I saw you use few times Style object from Qt(qml/common/SquabyStyle.qml).
Looks kind of advanced. What was the main reason you went as far as for styles, and just not created anything on your own?
PS. Any explanation or link to some docs would be useful.
Of course my game is not that advanced that’s why I won’t use similar approach like in Squaby demo everywhere.
Would be over complicated without much benefits.
Best regards,
Marcin