Sunday, April 29, 2007

More destructo-beam work, etc.

I've done some more work on the destructo-beam's functionality. When the player presses the right trigger on the Xbox controller, the weapon charges for a couple seconds, then fires in a stream downward. It is supposed to stop once it hits a building (or the ground), but TorqueX collision weirdness is causing the collision to often be detected too early or else too late. Thankfully TorqueX offers a way to retrieve the exact point of the collision (where it should intersect collision volumes), but I'm struggling with problems compensating using this; namely, the laser visibly always stops too early or too late -- though I can live with the latter as long as it isn't horrendous. I keep going back and forth between doubting Torque's collision system and doubting my own basic geometry skills.

I will debug this more tomorrow.

Oh, I also added a generic FiniteStateMachine class that I applied to the laser beam's state. It's a marked improvement from the ones I used to throw together as a game developer at Cat Daddy Games. It's a C# generic class, which means you can strongly type it with any type of state you want. I originally wanted to make the FSM be initialized with an enumerated type and automatically create state objects for each possible value, but the Xbox .NET libraries are limited and don't have any way to iterate through all the possible values of an enumeration. That's unfortunate, but the alternate solution I came up with seems to work well so far, but it requires that you manually add every state you care about to the FSM. No big deal for now.

Also on the agenda for tomorrow:
  1. Create some sort of particle effect illustrating the "charge-up" phase of the destructo-beam.
  2. Manipulate the HealthBar component of a scene object as it's affected by the destructo-beam
If I can accomplish both of those, anything else will be icing.

-Mike

No comments: