realbasic-games
[Top] [All Lists]

Re: Game engine test

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Game engine test
From: Frank Condello <developer at chaoticbox dot com>
Date: Sat, 25 Mar 2006 17:06:20 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20060317180027 dot 96F56117533D at lists dot realsoftware dot com> <4424B89C dot 2010408 at optusnet dot com dot au> <8268A93C-A492-41B9-A867-091978805AC2 at miensoftware dot com> <12B1852E-DE58-4871-A997-E7D44E40CBF4 at mindspring dot com> <BF4347D4-DEA4-4533-87BE-BEB12B106D91 at miensoftware dot com> <5FA27ACF-802D-4210-80DA-7E31FF0AAF60 at chaoticbox dot com> <F6EC35A8-63A1-4315-817F-B434D976A1BF at divergentmedia dot com> <CD676989-0D92-418F-87FA-9FDEF3FA2197 at chaoticbox dot com> <0FDC0C8A-9C1B-4A06-B0AE-439A9238E702 at divergentmedia dot com> <C2341D88-2A3F-4AAC-B856-85DD57872624 at chaoticbox dot com> <6AEFB6AE-7DBB-4D7A-88A1-E1CE82A7301F at divergentmedia dot com>

On 25-Mar-06, at 3:56 PM, Mike Woodworth wrote:

On Mar 25, 2006, at 3:42 PM, Frank Condello wrote:

On 25-Mar-06, at 4:07 AM, Mike Woodworth wrote:
...
perhaps, you can send me a sample of this math done as scalar operations, and i'll port it to my class? then we can see if there's any advantage.

Lo's example should do:

        newvec = veca + (vecb - veca) * scalar
...

so all 3 floats have the same operation performed? so vecb {xa1,ya1,za1,xa2,ya2,za3,...} + veca{xb1,yb1,zb1,xb2,yb2,zb2} = {xa1 +xb1,ya1+yb1,za1+zb1,xa2+xb2,ya2+yb2,za2+zb2} ?

Yup.

if so, option 2 will likely be *much* faster than scalar math in rb loops.

I'm talking about plugin code exclusively - we've already given up on vector array math in Rb ;)

sure, it might not be much faster than a plugin, but it will still likely be on par. my time tests on similar vectorized code usually shows a 10x speed increase.

This may be worth investigating further in that case...

What I envision are generic memoryblock extensions that can be mapped to vDSP functions where appropriate e.g.:

  blockResult.VecAdd( blockA, blockB, vecSize, [start], [end] )

This VecAdd extension would add each member of blockA and blockB and store the result in blockResult. vecSize would be the number of members in each vector, and start/end would be optional byte offsets within the blocks (if end is omitted then sized blocks are expected, and will be processed from start to block.Size-1).

These methods would assume each member is a 4 byte float. Given this, the plugin can check if vecSize is 4 members and pass the data to vDSP wholesale, or decide to work on a padded copy, or just do the math itself.

VecAdd, VecSub, and VecMult (vec*scalar) methods would be enough to be useful, but more exotic combinations (VecAddMult) and Matrix methods (VecMultMat4x4) plus Double precision versions (VecAddD) would help flesh it out ;)

I intended to do this myself at some point but my current game project doesn't use mesh animation so it's not an immediate concern. I'd certainly be happy to see someone else take this on in the meantime.

Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>