Jump to content
  • Advertisement
  • entries
    112
  • comments
    236
  • views
    136749

Chain...

Sign in to follow this  
Demosthenes

240 views

My brother suggested that I should display a chain instead of the balls I previously used to show the connection from the Bennu to the object it's swinging from. Click here for a video.

I also got major performance improvements from switching my broad-phase collision algorithm. I was previously using a modification of the sweep and prune implementation that came with the Farseer Physics Engine. In the way I was using sweep and prune, objects were being sorted in an array by their lower and upper boundaries along the X axis.

In my specific case I have a lot of objects, but most are static (such as the blocks and obstacles), so the array processing got expensive on more complex levels.

I switched to a grid-based collision algorithm, where all static objects are placed in a two-dimensional matrix where each position corresponds to a sub-square of the level, containing the list of static objects that are present in that sub-square. An object is placed in every sub-square from his lower (x,y) boundary to his upper (x,y) boundary, as depending on the object's dimensions it can belong to more than one sub-square. The non-static objects are kept in a list apart, and collisions are only checked between each non-static object and the static objects in the sub-squares the non-static object is currently located in.

Right now the collisions between each pair of non-static objects are all being checked, since I have a small number of them, but these can be optimized apart.
Sign in to follow this  


2 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!