Hand to Hand Combat, Locational Damage and Collision and More.
by Josh Albrecht · 11/08/2002 (2:07 pm) · 84 comments
Download Code File
This resources includes code for locational damage and collision for melee weapons and projectiles. It also has functions for creating and removing melee weapons, and for forcing projectiles to stick into players permanently when hit. :)
See the uploaded document for more details. It's 60 pages long, so be ready for a good read. :)
It is now in zip format. You can use winrar (www.winrar.com I assume) or winzip to decompress it. It is in *.doc format. The zip also includes a dts file of an arrow for testing the code with. Everything should work fine now. There are still a few imporvements that I would like to make, but it works fine as is.
This resources includes code for locational damage and collision for melee weapons and projectiles. It also has functions for creating and removing melee weapons, and for forcing projectiles to stick into players permanently when hit. :)
See the uploaded document for more details. It's 60 pages long, so be ready for a good read. :)
It is now in zip format. You can use winrar (www.winrar.com I assume) or winzip to decompress it. It is in *.doc format. The zip also includes a dts file of an arrow for testing the code with. Everything should work fine now. There are still a few imporvements that I would like to make, but it works fine as is.
#3
10/14/2002 (1:49 am)
You need to edit your post and reupload it....Apparantly that bug wasnt fixed.
#4
10/14/2002 (4:39 am)
it would be a good idea to make it in to smaller tuts...
#5
Yes, it would be a good idea to split it up. I will once I am sure that all of the imperfections are worked out. Otherwise, I would have to make corrections to more than one tutorial, and making them in one will be hard enough.
Someone suggest that I make a patch out of it. That's a good idea, and probably what most people would like, but I dont want to right now. First I want some people to read through it and point out any flaws they find. Then, once everything is corrected, I'll make a patch out of it. So if you dont want to deal with it right now, wait until it's a patch. :)
10/14/2002 (6:14 am)
Ok, I reuploaded it, and it seems to work for me now...Yes, it would be a good idea to split it up. I will once I am sure that all of the imperfections are worked out. Otherwise, I would have to make corrections to more than one tutorial, and making them in one will be hard enough.
Someone suggest that I make a patch out of it. That's a good idea, and probably what most people would like, but I dont want to right now. First I want some people to read through it and point out any flaws they find. Then, once everything is corrected, I'll make a patch out of it. So if you dont want to deal with it right now, wait until it's a patch. :)
#6
#####################################
Testing archive: 3374.hitboxtutorialv2[1].rar -- 10/15/02 14:42
#####################################
Testing file: Hitbox Tutorial v2.doc
--> CRC ERROR
#####################################
Done. -- 10/15/02 14:42
Warning: 1 error(s) found in the archive: 3374.hitboxtutorialv2[1].rar
10/15/2002 (11:32 am)
can you repackage this archive?#####################################
Testing archive: 3374.hitboxtutorialv2[1].rar -- 10/15/02 14:42
#####################################
Testing file: Hitbox Tutorial v2.doc
--> CRC ERROR
#####################################
Done. -- 10/15/02 14:42
Warning: 1 error(s) found in the archive: 3374.hitboxtutorialv2[1].rar
#7
10/15/2002 (2:24 pm)
It is repackaged as a .zip file now, hopefully that is better for people.
#8
10/16/2002 (8:01 pm)
The zip now includes a sword file for testing, and the tut is updated after some initial feedback. It should work nicely now.
#9
. Oh well, next round...
David - who's modelling ability makes flowers look like refrigerators...
10/17/2002 (7:34 am)
Doh! You forgot the sticky arrow again David - who's modelling ability makes flowers look like refrigerators...
#10
10/17/2002 (6:28 pm)
Newest version is up, everything should be working fine now. The arrow is included this time too, though th sword was removed, and replaced with an imaginary weapon (it's better this way, trust me. :)
#11
Could you re-upload it, please? Thx! :D
10/18/2002 (5:07 am)
Josh, the zip seems to be "broken", its only 1 kb (the arrow), the doc file is 0 kb and therefore pretty empty... ;)Could you re-upload it, please? Thx! :D
#12
10/18/2002 (4:31 pm)
Should be fixed now. Sorry about that, I have no idea why it happened. :(
#13
Nice work though - but, when I compiled it I got like 347 errors :/
11/09/2002 (12:40 pm)
you definitally should just make a patch or even just have the .cc and .h files in the zip as well - that way we you just replace the old files, backing up the old ones - just a thought.Nice work though - but, when I compiled it I got like 347 errors :/
#14
11/12/2002 (6:21 pm)
I just went through the tutorial and it worked perfectly for me. This tutorial saved me a lot of time trying to figure this out for myself. It would be nice if it was broken up into smaller pieces since all I needed was the melee weapon stuff, but it doesn't hurt now knowing how to do sticky projectiles.
#15
Forgive the newbie quetions.. I'm still tyring to get up to speed on TGE.
11/17/2002 (5:16 am)
For some odd reason the engine is displaying the hitboxes for the player and various objects. I quick glance through the doc didn't shed any light as to why.. Any ideas how to turn that off?Forgive the newbie quetions.. I'm still tyring to get up to speed on TGE.
#16
11/17/2002 (10:02 am)
Never mind found and "fixed" them
#17
11/20/2002 (6:33 pm)
As I'm working more with the code I found what seems to be a serious flaw. It doesn't seem to calculate the end point of a weapon correctly in the register function. This causes the weapon hit detection to not work properly.
#18
11/20/2002 (6:44 pm)
It seems I was wrong about that not being correct. It turns out it just didnt detect the tip of my sword correctly, which I'm not sure how to change.
#19
--------------------Configuration: Torque Demo - Win32 Debug--------------------
Compiling...
editor.cc
c:\torque\engine\game\shapebase.h(460) : error C2061: syntax error : identifier 'Max_Hitboxes'
c:\torque\engine\game\shapebase.h(464) : error C2143: syntax error : missing ';' before '}'
c:\torque\engine\game\shapebase.h(464) : error C2238: unexpected token(s) preceding ';'
c:\torque\engine\game\shapebase.h(478) : error C2143: syntax error : missing ';' before 'private'
c:\torque\engine\game\shapebase.h(491) : error C2065: 'MaxSoundThreads' : undeclared identifier
c:\torque\engine\game\shapebase.h(491) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(491) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(505) : error C2065: 'MaxScriptThreads' : undeclared identifier
c:\torque\engine\game\shapebase.h(505) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(505) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(516) : error C2143: syntax error : missing ';' before 'protected'
c:\torque\engine\game\shapebase.h(550) : error C2065: 'MaxImageEmitters' : undeclared identifier
c:\torque\engine\game\shapebase.h(550) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(556) : error C2065: 'MaxMountedImages' : undeclared identifier
c:\torque\engine\game\shapebase.h(556) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(556) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(556) : error C2233: '' : arrays of objects containing zero-size arrays are illegal
c:\torque\engine\game\shapebase.h(607) : error C2143: syntax error : missing ';' before 'public'
c:\torque\engine\game\shapebase.h(627) : error C2065: 'Max_Hitboxes' : undeclared identifier
c:\torque\engine\game\shapebase.h(627) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(627) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(642) : error C2143: syntax error : missing ';' before 'protected'
c:\torque\engine\game\shapebase.h(683) : error C2575: 'setImage' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(698) : error C2575: 'onDeleteNotify' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(699) : error C2575: 'onImageRecoil' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(700) : error C2575: 'ejectShellCasing' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(701) : error C2575: 'updateDamageLevel' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(702) : error C2575: 'updateDamageState' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(703) : error C2575: 'blowUp' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(704) : error C2575: 'onMount' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(705) : error C2575: 'onUnmount' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(706) : error C2575: 'onImpact' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(707) : error C2575: 'onImpact' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(709) : error C2143: syntax error : missing ';' before 'public'
c:\torque\engine\game\shapebase.h(711) : error C2588: '::~ShapeBase' : illegal global destructor
....
all the way down until
c:\torque\engine\game\shapebase.h(818) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
torqueDemo_DEBUG.exe - 4692 error(s), 0 warning(s)
SHAZBOT!
help please
Joseph Spataro
12/17/2002 (12:48 am)
I tried to do this thing and I tried my best not to be a tard and put everything where it is supposed to go based on the txt. This is what i got....--------------------Configuration: Torque Demo - Win32 Debug--------------------
Compiling...
editor.cc
c:\torque\engine\game\shapebase.h(460) : error C2061: syntax error : identifier 'Max_Hitboxes'
c:\torque\engine\game\shapebase.h(464) : error C2143: syntax error : missing ';' before '}'
c:\torque\engine\game\shapebase.h(464) : error C2238: unexpected token(s) preceding ';'
c:\torque\engine\game\shapebase.h(478) : error C2143: syntax error : missing ';' before 'private'
c:\torque\engine\game\shapebase.h(491) : error C2065: 'MaxSoundThreads' : undeclared identifier
c:\torque\engine\game\shapebase.h(491) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(491) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(505) : error C2065: 'MaxScriptThreads' : undeclared identifier
c:\torque\engine\game\shapebase.h(505) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(505) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(516) : error C2143: syntax error : missing ';' before 'protected'
c:\torque\engine\game\shapebase.h(550) : error C2065: 'MaxImageEmitters' : undeclared identifier
c:\torque\engine\game\shapebase.h(550) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(556) : error C2065: 'MaxMountedImages' : undeclared identifier
c:\torque\engine\game\shapebase.h(556) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(556) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(556) : error C2233: '
c:\torque\engine\game\shapebase.h(607) : error C2143: syntax error : missing ';' before 'public'
c:\torque\engine\game\shapebase.h(627) : error C2065: 'Max_Hitboxes' : undeclared identifier
c:\torque\engine\game\shapebase.h(627) : error C2057: expected constant expression
c:\torque\engine\game\shapebase.h(627) : error C2466: cannot allocate an array of constant size 0
c:\torque\engine\game\shapebase.h(642) : error C2143: syntax error : missing ';' before 'protected'
c:\torque\engine\game\shapebase.h(683) : error C2575: 'setImage' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(698) : error C2575: 'onDeleteNotify' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(699) : error C2575: 'onImageRecoil' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(700) : error C2575: 'ejectShellCasing' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(701) : error C2575: 'updateDamageLevel' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(702) : error C2575: 'updateDamageState' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(703) : error C2575: 'blowUp' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(704) : error C2575: 'onMount' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(705) : error C2575: 'onUnmount' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(706) : error C2575: 'onImpact' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(707) : error C2575: 'onImpact' : only member functions and bases can be virtual
c:\torque\engine\game\shapebase.h(709) : error C2143: syntax error : missing ';' before 'public'
c:\torque\engine\game\shapebase.h(711) : error C2588: '::~ShapeBase' : illegal global destructor
....
all the way down until
c:\torque\engine\game\shapebase.h(818) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.
torqueDemo_DEBUG.exe - 4692 error(s), 0 warning(s)
SHAZBOT!
help please
Joseph Spataro

Torque Owner Josh Albrecht
Also, keep in mind that just because its there, doesnt mean you need to use it. For example, if you dont need any melee combat code, it doesnt hurt to put it in. Just dont use any melee weapons, and you wont be losing any performance, and everything will still work.