Re: Data oriented programming

Phill Djonov <[email protected]> Fri, 8 Oct 2010 02:37:31 -0600
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
Go with components and limit cross-component communication to clearly
defined phases:

TickAnims();
MoveAnimDataToPhysics();
TickPhysics();
MovePhysicsDataToAnimation();
TouchUpAnimsForThingsPhysicsConstrained();

Etc.

Obviously, a lot of the move phases go away if you can find a
cache-friendly format that works well for most members of a group of
related subsystems, though often the cost of copying data around is
well worth the savings you can achieve when a complex computation is
tuned *just* right.

YMMV.

Phill

On Thu, Oct 7, 2010 at 7:11 PM, OvermindDL1 <[email protected]> wrote:
> On Thu, Oct 7, 2010 at 3:54 AM, Gabriel Sassone <[email protected]> wrote:
>> /* snip */
>
> Slightly back on to topic, data oriented programming, I know what most
> of it means anyway and I do use it in some specific areas, but I am
> curious, a common use-case for a game:
>
> Class hierarchy:
>  GameObject
>    Actor
>      Pawn
>        PlayerPawn
>        Vehicle
>          Wheeled
>          Tracked
>          Flying
>      Controller
>        PlayerController
>        AIController
>          MonsterController
>
> I am not certain how to properly get functionality over to a
> data-oriented model.  Just for the sake of ease-of-use argument, the
> best way might be a component system?  But it seems that no matter how
> I think of data usage, sometimes I will need, for example, the
> positions with the force descriptions, or I might need positions with
> the renderer, or I might need the force descriptions with the input to
> each model (and how do you model an input system based on events, such
> as you have a list of events and based on what they are they need to
> modify the structures of one thing per event, with possible multiple
> events per thing, or maybe zero).
>
> I have done quite a bit of looking on Google for any articles or
> tutorials that anyone may have done to convert a traditionally
> C++/Java-style OO hierarchy into a data-oriented or so setup for
> maximal speed, does anyone know of one?
> _______________________________________________
> Sweng-Gamedev mailing list
> [email protected]
> http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
>
_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com