Game Development Community

I need some programming suggestions

by Ronald J Nelson · in Torque Game Engine · 03/25/2007 (3:54 pm) · 1 replies

I have been trying to come up with a solution to my problemand quite frankly I haven't come up with a solution that fully fits my needs. I am hoping someone out there can give me a suggestion on which way to go with this.

Here is what I have:

I have a working vehicle hitbox system that uses interchangeable meshes to display damage. It also emits debris on impact based upon the material of the object it collides with. I have managed to get it so it not only successfully passes the hitbox through projectile collisions but also with onImpact (DIFS and Terrain) and onCollision(DTS) objects.

Here is what I need but haven't come up with a good plan for yet:

Since I can now pass the hitbox information to just about anything I need to have a system that per vehicle can have a different number of hitboxes since obviously different chassis sizes or types are going to have a different layout of hitboxes.

So lets say a variable in the datablock of numHitboxes = 8;

Based off of that I need to have each hitbox to have parameters assigned to it, such as, cleanState, damagedState, damagedState2, and chassisRegion.

I need to have the system be able to select the hitbox information based upon the number passed through a function and to be able to access the parameters for that individual hitbox.

I have considered arrays and creating an entirely new class of object called a hitbox with these parameters but am not entirely sure if that is the best way to go or if there is another better way.

I am not asking anyone to do my work here, I would really just like a suggestion or two.

#1
03/25/2007 (6:51 pm)
How about each type of vehicle has it's own class derived from a common base class.
There is method implemented in the class for the vehicle called say takeDamage() which accepts the parameters.
This method would determine which hit box takes the damage.
eg. a motorbike might only have 2 hit boxes so the method only needs to determine if the damage was forward or aft of the vehicles center. A tank would have a move complex (probably vector based) system.

- a bit vague I know but I hope it helps