Sign in to follow this  
  • entries
    53
  • comments
    225
  • views
    69253

Bridge Cannon

Sign in to follow this  
Milkshake

225 views

Last night on the way home from work, I started thinking about making things blow up. The first thing I did was to add a "Explosive" behaviour object that listens for JOLT events from the physics engine to tell it the object it belongs to has hit (or been hit by) something. Behaviours in my engine are control objects you can drop onto things in the game to give them a certain behaviour or characteristic. The idea is that, rather than building monolithic AI logic that requires new code every time you add a new type of thing to the game, there will be a library of small, focused behaviours you can combine and configure to get lots of different results.

Oh, then I had to modify the physics engine to actually send JOLT events out. It already sends out CONTACT and ~CONTACT messages to let you know when you start and stop touching something, but the JOLT message is different in that it indicates when your object has actually hit something, and how much energy was involved in the collision (so you can distinguish a glancing blow that a bomb might bounce off from a direct impact that should make it blow up). I got this mostly working, but wasn't able to find a place I could easily detect situations where you were hit hard, but didn't move (e.g. you're already jammed up against a wall). Still, it's enough to get me started.

At this point, I had my projectiles hitting things and calling a stub "Explode" method which just removes them from the scene, and I started thinking about how I was going to depict explosions. Given I don't even have the start of a particle system yet, I quickly decided I wasn't about to get any explosions working before my train arrived, so I started mucking about with other ideas ... like how much I enjoyed the geometry cannon from a few journal entries back.

Here's a moovie of one of the prototypes. I don't know if I'll end up using it as it has some obvious game balancing issues, but it was fun to play about with and took a grand total of 3 lines of code to implement.

Disabled

Cheers!
Sign in to follow this  


1 Comment


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