Multiple alias this, what's the hold up?
Olivier FAURE
couteaubleu at gmail.com
Tue Jun 18 17:38:53 UTC 2019
On Monday, 17 June 2019 at 17:41:07 UTC, Ethan wrote:
> The implication here also is that component-based programming
> is not a method that the games industry is going to drop any
> time soon. If you're doing console game development, you need
> to be familiar with how to use components.
I agree with you that D has great potential as tool to write an
Entity-Component-System architecture better than existing
languages (for instance, it can swap arrays-of-structs with
structs-of-arrays pretty seamlessly), but I don't follow how
`alias this` is necessary or even helpful for ECS?
All use cases I've seen could be handled idiomatically with
`static foreach`, `static if` and `__traits(hasMember, ...)`.
Functions meant for an idiomatic ECS framework would look like:
@needs_components(Health, DamageToken)
@optional_components(ArmorSystem)
@needs_tags("!immortal")
void system_applyDamage(int entityId, ref Health, ref
DamageToken, ArmorSystem*)
{
...
}
No recompilation needed, expresses exactly what it does. I don't
think you need `alias this` at all.
More information about the Digitalmars-d
mailing list