13 April 2006

I'm so easily distracted (new benchmarks)

I was supposed to finish the collision and action systems tonight... And what do I do? I just had to implement a feature that wasn't even in my original list of features for the framework: dynamic lighting. So, now you'll be able to create light sources, and they can move and smoothly alter their color/brightness (via Actions of course).



Here are some benchmarks with moving Sprites (using simple newtonian physics) and dynamic light sources.

sprites: 1000 3000 10000
------------------------------------
10 lights 85fps 85fps ~35fps
30 lights 85fps ~59fps ~18fps
100 lights ~64fps ~21fps ~6fps

As you can see, there's still some room for optimization, but implementing different levels of lighting detail should help a bit in situations typical to games. Currently, each light source affects every corner of every sprite, so that's four calculations for every sprite for every light source. Small sprites don't really need this, so they can be optimized by calculating a single light value for the center of the sprite and using it for the whole image.

On the other hand, having 100+ dynamic light sources might not be the most typical scenario...

4 Comments:

Anonymous Anonymous said...

awesome! but, euh, where can I download it??

13 April, 2006 08:26  
Blogger shang said...

>> where can I download it??

Sorry, the new framework isn't publicly available yet. I want the APIs to get a bit more mature before releasing the first version, so I won't get frustrated users whose code breaks after every revision.

That plus I haven't yet decided on the specific license I'm going to use.

13 April, 2006 11:03  
Blogger Van Leth said...

Looks brilliant so far. I will eagerly follow the Opioid progress now. Sounds like you got some good thoughts to put into this rewrite based on earlier experiences.

Best regards

14 April, 2006 06:29  
Anonymous Anonymous said...

I'm interested in your project, too - I'll be following this blog and wishing you the best.

16 April, 2006 00:05  

Post a Comment

<< Home