Re: Data oriented programming

Phill Djonov <[email protected]> Fri, 8 Oct 2010 02:56:01 -0600
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
You also mentioned events, and I didn't really address that.

I avoid those like the plague. In my experience, having subsystems
directly call each other as they work is a recipe for disaster, as the
code you get is highly interdependent and you lose the ability to
reorganize the internals of a system (for performance or otherwise)
because the entire rest of the game is expecting things of it at all
times. Message queues or buffers of intermediate results, on the other
hand, are awesome:

listOfCollisions = BeginPhysicsTick();
DecideOnCollisionResolutions( listOfCollisions ); //updates the list inline
FinishPhysicsTick( listOfCollisions );

gameCollisions = FindCollisionsGameplayCaresAbout( listOfCollisions );
SpawnCollisionEffects( gameCollisions );
ApplyImpactDamage( gameCollisions );

//use listOfCollisions later to optimize what data you send over the network as
//prediction might do a decent job of objects that are simply moving
along uninterrupted

//etc

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