Non-pipeline component programming
Francesco Cattoglio
francesco.cattoglio at gmail.com
Tue Feb 4 02:06:17 PST 2014
On Tuesday, 4 February 2014 at 09:49:39 UTC, Zoadian wrote:
> We're currently working on an Entity Component System for D (
> https://github.com/Zoadian/nitro)
>
> Here some good explanations:
I've seen it too. I like it so far, because of the nice usage of
templates, but right now I didn't gave it a try due to zero docs.
The questions asked by Luìs probably has more to do with "if I'm
iterating one entity/component at a time, how can I access two
components at one time for my computations?"
The easy way is just using the cartesian product of your range
with itself.
http://dlang.org/phobos/std_algorithm.html#cartesianProduct
This way you get a range of tuples, so you get pairs made of each
entity with all the other ones, and you can process that pair
with your next filter function. After that I'm not really sure
about what one could do.
Another approach could be: pass (a copy of your) RA range to a
filter, and use that to compute the effects for each entity.
Bang, every entity is now processed.
More information about the Digitalmars-d
mailing list