Re: Handling different types gracefully

2013-07-02 Thread bearophile
Roderick Gibson: Variant is a possiblity. How is the performance with large containers of these, since these structures will likely hold the majority of the data in the game? You probably have to benchmark yourself. (But I have suggested an Algebraic). Bye, bearophile

Re: Handling different types gracefully

2013-07-02 Thread Roderick Gibson
On Tuesday, 2 July 2013 at 06:54:58 UTC, bearophile wrote: Roderick Gibson: Variant is a possiblity. How is the performance with large containers of these, since these structures will likely hold the majority of the data in the game? You probably have to benchmark yourself. (But I have

Re: Handling different types gracefully

2013-07-02 Thread bearophile
Roderick Gibson: I should know the types at compile time, so I will be using it most likely, but reading the docs it looks like Algebraic is built on top of the same structure as Variant. Is there any difference in implementation? Take a look at the Phobos source code, it's much faster than

Re: Handling different types gracefully

2013-07-02 Thread Roderick Gibson
On Tuesday, 2 July 2013 at 21:45:57 UTC, bearophile wrote: Roderick Gibson: I should know the types at compile time, so I will be using it most likely, but reading the docs it looks like Algebraic is built on top of the same structure as Variant. Is there any difference in implementation?

Handling different types gracefully

2013-07-01 Thread Roderick Gibson
I'm asking because I'm doing some game development in D and I've come upon the entity component architecture, and it looks like a good way to handle the complexity and interdependency that games seem to have. The components wind up being plain old data types (I currently use structs), with

Re: Handling different types gracefully

2013-07-01 Thread bearophile
Roderick Gibson: auto entities = new Entities(); auto entity_id = entities.createEntity(); entities.addComponent!(position)(entity_id, pos); entities.addComponent!(movement)(entity_id, mov); entities.addComponent!(collision)(entity_id, col); auto physics_data =

Re: Handling different types gracefully

2013-07-01 Thread Anthony Goins
On Monday, 1 July 2013 at 12:03:25 UTC, Roderick Gibson wrote: I'm asking because I'm doing some game development in D and I've come upon the entity component architecture, and it looks like a good way to handle the complexity and interdependency that games seem to have. The components wind

Re: Handling different types gracefully

2013-07-01 Thread Roderick Gibson
On Monday, 1 July 2013 at 12:16:50 UTC, bearophile wrote: Roderick Gibson: auto entities = new Entities(); auto entity_id = entities.createEntity(); entities.addComponent!(position)(entity_id, pos); entities.addComponent!(movement)(entity_id, mov); entities.addComponent!(collision)(entity_id,