Hey guys,
A while ago I came across this awesome little program made by Photon Storm called Pixel Smash, which is essentially a really cool way to mix pixel 8-bit like games with modern day graphics. Check it out here, as you can see, there are quite a number of possibilities that come to mind when you've got what is essentially a destructible pixel environment (think Modern Warfare 2D or similar) how cool!!?
One thing that this particular demo got me on to was of course Nape, as this is the engine that is powering it. However, as many flash developers are aware, the major physics engine of favor in and among game titles is of course Box2D, so I went about porting the Nape Pixel Smash example over to Box2D, with outstandingly disappointing results, I use a simple plugin class called "stats" which was developed by a guy called Mr Doob, and can be githubbed here, which gives you an awesome looking run down of what framerate you're running, how many objects you've got in your scene and also monitors memory and even refresh rates.
Here's the annoying thing though, the Pixel Smash Nape demo gave me a steady 60fps, with 1017 objects and a refresh rate of around 17ms. Now, when I run my Box2D version of it:
Suffice to say, pretty disappointing, and this is with an image that only generates 236 objects! For the purpose of this I've opened up a github account and y'all can browse and pickup the code there.
https://github.com/SPGamesStudio/Pixel-Smash-Box2D
Be gentle with me, still learning all the stuff that goes with github, so I hope it's all working.
Anyway, basically, the major problem with the Box2D version (I think) is that when the objects spawn into the world, they are all colliding off of one another. So if every object has 8 objects surrounding it, all colliding together, then that's a problem and very computationally hard.
So, with that, I am still at a loss as to how to improve the performance of the Box2D version, if you feel so inclined, feel free to grab the code off of github. And remember, credit given where it's due, this isn't my code to start with, I simple ported it. It's really Rich Daveys' from Photon Storm, I just played with it and got it to Box2D. I'm now in the process of re-writing the code in Nape with the most recent milestone, and will probably end up making a little movie out of it, we shall see.
In the mean time, yeah, get on it! Github it up people!!!
David
Subscribe to:
Post Comments (Atom)
2 comments:
so happy to post the first comment and also be the first subscriber .
i'm waiting for the nextx video of the tutorial series.
thank you
interesting blog. It would be great if you can provide more details about it. Thanks you
Flash Development
Post a Comment