Game Development Community

Melee weapons?

by Tane Piper · in Torque Game Engine · 12/13/2001 (4:37 am) · 9 replies

For my game, Barbaric Arena, the majority of the weapons are close range weapons like swords, tridents, axes, maces, etc with a similar control system to the game "Die by the Sword". There will be some ranged magic weapons, but they won't be primary weapons.

How hard would it be to add melee weapons like this to the engine? Concidering it should be possible to decapitate, disembowel, or cut someones limbs off how hard would it be to create this sort of collision detection. Would it also mean a change in the model format so that arms and legs could be gibbed off?

Please note, I am still looking for a lead coder for this project, so if someone would like the challange, please contact me!

#1
12/13/2001 (5:33 am)
Josh already posted a bit of code for locational damage, with a bit of effort you could add limbs being cut to this.

Its quite possible, you HAVE the source :))

Phil.
#2
12/13/2001 (5:46 am)
Not me, I'm a pants coder, and my maths sucks :)

But it's nice to know that it could be quite possible, so I'll at least have a crack at it.
#3
12/13/2001 (8:17 am)
[Edit]
Noticed that this was more unclear than it was meant to be, throughout I am referring to the Hitbox Tutorial written by Raistlin
[/Edit]

Simplest way is to do the hitboxes, but don't use his melee weapon code (no offense). Instead modify the projectiles castRay (in container) to use hitboxes for players, and then make the sword a projectile with extremely close range. Or better yet derive a new class off of SceneObject. I'm actually doing all this, so I have substantial knowledge of how collision works with TGE, so if you have any questions feel free to post them. You're going to have to move his hitbox code from an array to a resizeable vector in order to universalize the hitbox code, which should be moved to the SceneObject class (since the SceneObject class is the one used in the projectiles castRay function). Or you could put a bool in the SceneObject as to whether or not the object is a player with hitboxes, and then set it true in the Player constructur, and then in the castRay function (if the bool were true) cast the SceneObject to a Player to gain access to the mHitboxes Vector/Array. I know none of this made sense, but it should wet your appetite. If you want me to explain it better I can, I just can't right now since I'm at work.
#4
12/13/2001 (8:22 am)
Oh and one more thing. The reason why not to use the Raistlin's Melee code is because he wrote his own interpolation code. While this is all well and good, TGE has much of this prediction built in. I am a firm believer on not changing everything but getting my changes to work with what already exists. Not only that but existing projectiles will not work with his code without a lot of work, unless you make your own. Also if you plan of having horse carriages in your medievil game (IE vehicles) his Hitbox code cannot be applied to them without some work, and then applying the specific PvP melee and projectile code you spent a lot of time working on will be useless. So use Raistlin's as a start, but as he says clean it up a bit.
#5
12/13/2001 (12:39 pm)
Actually I wonder if it would be easiar to derive a class off of shape base called Sword that when collision occured did damage to whatever it hit. Youd have to make it like a vehicle, giving the player who picked it up control of it.
#6
12/13/2001 (1:09 pm)
That sounds like the proper solution to me. Besides, then you could slash your own kneecaps. :]

Or not. You might have to do it as an actual mounted weapon model with it's own hitbox, but then you may need to exclude the player holding it when applying damage, as it may not be reasonable to arrange the weapon's hitbox to never intersect the player. It might be best not to give the player the opportunity to slice off his toes anyway...
#7
12/13/2001 (2:38 pm)
I made that tutorial before torque even had projectiles, so excuse me! There was no interpolation if projectiles didnt even exist! :)

Seriously, my "melee weapon" code was NOT in any way, meant to be final. It was just there to show that the hitboxes WERE working. Also, I would have liked to use collision details to define the hitboxes, but I dont own max (and am not going to pay thousands of dollars for it), so it would be impossible for me to test.

Currently, I am working on repairing my code, and implementing some of the suggestions that you guys gave (like the projectile thing). Thanks guys!
#8
12/13/2001 (8:10 pm)
If I was detrimental in anyway, I apologize. I didn't mean to be ;) Someone always has to make the first step, and someone always comes along and contradicts what they said, etc.
#9
12/14/2001 (2:09 pm)
heheh, no problem. :) I am actually glad that people have criticized it for two reasons:
1. Nothing gets better without criticism.
2. I saw some of those flaws, and this just goes to show that there actually are some intellegent people that both cared to read the stuff, and think about the flaws.

Thanks guys! :)