Wednesday, January 16, 2008

fun with binary space partitions!

I recently added the use of BSPs(binary space partitions) for my game engine. In this demo I use BSPs for collision detection with the ground. I added functionality that automatically creates a BSP for any walk mask inputted. The BSP is used to speed up the collision detection process. Without the use of a BSP my computer could only handle about 100 entities colliding with the world and when using the BSP it can handle over 10000 with the same amount of cpu use.

This demo is called Hover Survive, something simple I made to easily test new functionality for the game engine. In this demo you can test how much your cpu can handle. You can press the zero key to increase the number of entities. Before the lines were models of mines that were 170 vertices each. I changed it to lines so that the demo could be a test of the bsp itself, it would slow down a lot sooner if your computer had to render that many vertices.

The demo starts with you controlling the hover car, if you want to just stress test your computer just run into one of the mines. Once dead you can move the camera anywhere you want. "w,s,a,d" controls the camera, you can mouse look and "y,h" moves up and down the Z axis.

The download includes a windows and linux executable. The program was written in C with the OpenGL and SDL APIs. Again, I don't currently have access to a mac so I am unable to compile a mac version.


No comments: