Archive for the ‘physics’ Category


first post in a long while + some erosion progress

March 15, 2009

Well apparently school takes up time.  So it’s been a while.  But here goes:

I got all A’s on my midterms, so fuck YES!  I feel happy about that.  Good times.  I have been spending an increasing amount of time with other people as well.  I know, crazy right?  It’s me.  Apparently some people don’t hate my guts, and I seem to have met some in person.  They are decidedly cool.  Hence that last post about Travis’ birthday.  So, yeah.

What else?  Oh, making progress on the Qix clone, Erosion.  Here you go:

It has a game state machine with GAME OVER and gameplay states and whatnot.  It has much better graphics now, I implemented bloom with my old shader framework and improved the color scheme.  You can die, and I’ve even got gamepad working with rumble on collisions and all.  You will also notice that I replaced the simple bouncing bar with a bar with a thruster in a damped system that actually semi-tries to follow you.  Enjoy this clip:


qix meets physics!

February 11, 2009

I’m currently working on a clone of Qix called Erosion.  It was assigned to me by Dr. Liow.

So, after getting the very basic bare bones of Erosion’s logic working, it struck me what would be about the coolest twist to Qix ever!  If I integrated physics!  Tada!!!  Fucking A!  It just so happens I’ve cooked up a little physics engine you all probably know about.  Soooooo, here you go, alpha test 1.  And hey, I was apparently listening to Opeth while coding, and it was picked up by the video recorder during the test! \m/

Bitching, yo.


physics talk abstract and slides

December 25, 2008

So now that my talk is done and over with, I guess I promised earlier to post my abstract/slides. SO IM POSTING THEM JESUS DONT KILL ME OKAY KAYTHX.

They’re here, and you must use the video signal analysis in your brain to interpret the pictures. No one ever gets that and they’re all like ROFLMAO I CANT SEE WTF. silly silly people.

download: physics_talk_08_ccis.7z

That takes care of that.


interwebs are back! new laptop arrived! CAMERAS!

November 27, 2008


afk is a fairly disgusting statement.  It was coined by a friend who thought there should be texting abbreviation for anally fucking kittens.  He came up with it.  Not me.  Though it does make a great expletive.  gggrrrraaAAAHHH!  ANALLY FUCKING KITTENS, THIS SUCKS!  Packs a punch.

Now that I have full access to ye olde intarwebz0rz again, allow me to fill you in: my new laptop is here.  Yes here.  Not almost here, ACTUALLY HERE!  It runs Ubuntu 8.10 Intrepid perfectly, and Windows Vista because if I take it off I’ll lose the software license.  Microsoft bitches.

I have tested my stuff under Vista though, and I was pleasantly surprised that it ran!  My code has always been very raw and portable, something I am very proud of.  It also runs on Ubuntu Intrepid just fine.  Actually, better than anywhere else, because this is an AMD64 (Athlon64X2) machine.  It came with 32-bit Windows, which makes no sense to me, it’s like putting two toilets in an apartment with only one ass.  But the Ubuntu half is full on 64-bit, and I have to say it’s a big improvement, especially since this baby is dual core.  Multitasking!  Also, the physics engine has a build now just for 64-bit GNU/Linux, available through both GNU Make and C::B projects.  It’s really fast on this machine, and this build is always double precision too, because of the 64 bittage!

Here’s a screenshot of the pyramid example running on the laptop:



Yeah.  Now look at the zooming in on the frame rate:



Okay, that’s about it.

But hey, webcam fun! 🙂  LOOOOKIIIT



Yes, the laptop has a webcam to.  Camgasm that’s awesome.

Oh, wait!  I’ve also just been messing around with shaders, because my laptop can actually handle this shit!  This is my phong lighting shader.  I have it split in to ambient and diffuse/specular passes, so that luminance occlusion multipass shadows can be easily integrated.  I’m working on a shadow mapper right now.  But anyway, last picture:


See all y’alls!


other physics videos

November 17, 2008

For those too lazy to get the engine from the repository and build it, here are more videos of it in action.  Seriously though, I can understand if you aren’t a programmer.  But for those who are, I have a link on my site, accessible from here, that goes to a publicly checkout-able repository and a jillion ways to build it.  It builds on Visual Studio 2008 (VC9) with a project file, it builds in C::B 8.02 or higher on the MinGW toolset, it has a raw makefile MinGW build, it has a GNU/Linux make GCC build, a C::B 8.02 or highter Ubuntu Linux build, I MEAN HAVE I NOT GIVEN YOU ENOUGH OPTIONS!?  JESUS GOD OMFGROFLMAO NARNIA PANTALOON SCALLYWAG! SLDKJFKLSDJSOIEOWEJOOJ!!!1!1!!1!!11!!!1!  😮 😮 😮 😀 😡  I’ll do 64-bit build when my laptop gets here as it’s 64-bit, that should make it friendlier to 64-bit types.

yay, its crazy time forever lawlz XD.

Now that we’re done with me becoming mildly volatile for a brief period, let’s get back to the videos.

wooooooooo, happy town.


pivot constraints == awesome chain physics!

November 17, 2008

In the past, I have had two different kinds of inelastic distance constraints: single distance constraints (rat_constraint_bar) and min/max distance constraints (rat_constraint_slider).  I add a new one called the pivot (rat_constraint_pivot).  Why, you ask?

Well, you might think a distance constraint with a length of zero is sufficient, but it isn’t.  Here’s why: a distance constraint uses the normal of the distance “bar” to decide how to pull or push the anchor points.  If you are a point, this value cannot exist unless the objects are separated, which means the constraint will never keep the anchors at zero distance from each other.  Furthermore, this means the pivot will never react like a revolute joint, because this behavior relies on a shared point.  So, the key is to compromise.  We use our old friend bias velocity (pseudo velocity) to keep the points together, regular distance constraint style.  But in order to get the correct pivot behavior out of it we have to calculate the impulse as if, like I said before, the anchors share a point even if they don’t.  This means instead of normals, we must create a mass matrix to get the correct torque, then apply the equal offset impulse to the anchors.  Think of it as unbreakable sticky friction.

The really cool looking result can be seen in the following video.  I can now have real segmented chains; solid segments, not distance constraints between particles!  🙂


islands + rigid body sleep + time of impact

October 30, 2008

So, on the topic of time of impact.  The first thing I realized, is that time of impact calculations if done with the proper time conservation (advance all by nearest time of impact, solve, and repeat until timestep is gone) are enormously costly for massive groups of bodies.  This is because you update EVERY BODY in the system all those times whether you need to or not.  A good fix, which is also practical for putting bodies to sleep, is solver islands.  Basically, isolate groups of topologically adjacent bodies through contacts and constraints.  Then simulate them independently, including doing less TOI substeps for islands that don’t need that many.  It’s actually not even possible to do the unneccessary steps on an island solver architecture.  The reason this is also good for the sleeping scheme, is that putting islands to sleep as a whole instead of each body individually is much more stable, because you know that once all have settled, there is nothing still moving to keep the others awake.  And again, doing this per island allows you to be more efficient, because per body takes longer and is less stable, and per world is useless because there is always something moving in a video game.

Well, one of my dad’s friends reviewed my presentation (he’s an electrical engineer with programming experience in microcontrollers) and he said it was so good it could get me in to MIT.  I have a good feeling about this.  😀