Engine updates

posted Aug 4, 2009 4:59 AM by Gustav Olsson   [ updated Aug 4, 2009 6:19 AM ]

I've made some updates to the physics engine in the last couple of days. The space partitioning tree has been optimized and I've implemented proper sleeping. (Making rigid bodies inactive if they don't move) These updates has made the game run much faster and because sleeping rigid bodies does not use alot of computing time there can now be hundereds of objects in the game without the performance dropping. (There can still only be a set amount of active objects in the world, but most objects will be sleeping in a typical scenario)

I've previously had the physics update frequency set to 100 Hz but I've decided to use 60 Hz from now on, making it possible to use more active objects in the game. It was quite unnecessary to set it to such a high value in the first place since the difference isn't visible at all. Finally I've also rewritten some of the integration code in order to get rid of jittering in the simulation. (This took byfar the most time)
 
The great news it that these optimizations has made the Xbox build of the game run very fast! (The floating point performance on the Xbox when using the XNA framework is not very good) It will now be possible to play a finished map at 60 Hz. (I expect a finished map to have a about 2000 rigid bodies in it)
 
Since there are no updates to the graphics side of things I won't post any screenshots in this post, but I'm going to work on the map editor and ocean next so stay tuned :)