Brief Status Update

I have spent a lot of time working on BossConstructor lately and would like to give you a brief update. Alongside a general code cleanup, the main issue I have been working on is the collision handling algorithm.

Collision handling is both complex and computationally intensive at the same time. The complexity arises because concave shapes like the ships in BossConstructor can intersect in different places at once. Furthermore, once a collision has been handled, the ship can intersect in another place as a side effect. Both of these problems can lead to physically flawed and unintentionally spectacular effects like two ships blasting off in random directions or ships clipping through walls.

convexhull

Luckily, I finally managed to find a satisfying solution to these problems. The approach I implemented simplifies the ships as convex hulls (the white lines in the image above) which offers two advantages. Advantage one is that convex hulls can only intersect in one place at once which handles the problematic scenarios described above. Advantage two is that it is very easy to check if a point lies within a convex hull, which makes the collision detection process much faster and also allows the game to handle collisions ‘slower’ (as opposed to handling them in one frame) which makes them feel ‘smoother’ and more realistic.

concavehull

The disadvantage of this approach is that the convex hull can be a very inaccurate representation of some ship designs. Consider the image above as an example for a ‘very concave’ ship. In case this turns out to be a major problem I will have to build an algorithm which partitions the ships into multiple convex hulls later on. However, for now I am quite satisfied as the new collision handling algorithm feels much more ‘natural’ and far less buggy than before.

Coming up next on my todo-list is completing the collision handling for all the different scenery tiles (which should not take too long) and to expand the editor until I can implement some simple demo missions. Slowly making progress… Take care! đŸ™‚

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s