Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Theme on Tue 14/11/2006 16:22:03

Title: SUGGESTION: Collision Boxes
Post by: Theme on Tue 14/11/2006 16:22:03
I was reading at Ahmet's AGS Fight Game thread. It would be nice if AGS implemented collision boxes. It would be setted to every sprite in a animation and when a hotspot, object, character etc collide with it, it would start an event.

(http://www.packetsniffers.org/projects/geeks_unleashed/tutorial/atkbox.gif)
this is from Mugen, it has 2 kinds of boxes, the red one is the attack and blue is the hitable area of the character. In ags case it would be only one.

o/
Title: Re: SUGGESTION: Collision Boxes
Post by: R4L on Tue 14/11/2006 20:22:03
Four words, Pixel Perfect Collision Detection. Im sure something could be done with it.
Title: Re: SUGGESTION: Collision Boxes
Post by: SSH on Tue 14/11/2006 22:25:06
Like perhaps a module? (http://ssh.me.uk/moddoc/PPCollision.zip)
Title: Re: SUGGESTION: Collision Boxes
Post by: R4L on Tue 14/11/2006 23:14:15
Why yes, of course!
Title: Re: SUGGESTION: Collision Boxes
Post by: Theme on Wed 15/11/2006 02:38:04
but edit the boxes yourself for each frame can let you do fighting games properly!
(not only fighting games)
I didn't test the module but I guess it works for the whole object or character, I mean not a specific frame or region of the obj/char.
So if the enemy hit the back of my character while I was executing a punch he wouldn't get hit.

oh, my explanation is little confusing +_+ sorry

o/
Title: Re: SUGGESTION: Collision Boxes
Post by: Janik on Wed 15/11/2006 03:00:50
I doubt CJ would add something like this since it's such a specialized request. Perhaps AGS is not the ideal environment for a fighting game...

If you define the box sizes manually (say reading off the positions in photoshop), you could then make a module which would know what boxes are where on each frame. It would be a bit of typing if you have a lot of frames, but possible.
Title: Re: SUGGESTION: Collision Boxes
Post by: Kweepa on Wed 15/11/2006 03:57:42
You could save the frames in two pieces - the hittable part and the attack part. You would just need to keep two characters in sync, one for the hittable part and one for the attack part. Then use the module to test the attack part against the other character's hittable part.
Title: Re: SUGGESTION: Collision Boxes
Post by: Pumaman on Thu 16/11/2006 19:00:57
Realistically I don't think this is something that I'd add to AGS, because of its rather specialized nature. As people have pointed out, you could do something similar yourself in the script, albeit more work to achieve.
Title: Re: SUGGESTION: Collision Boxes
Post by: R4L on Thu 16/11/2006 20:19:39
Couldn't you do something with rawdraw features and the PPCD module? I agree that this shouldn't be implemented into AGS, but a module would be nice.
Title: Re: SUGGESTION: Collision Boxes
Post by: Shane 'ProgZmax' Stevens on Fri 17/11/2006 13:38:39
Besides, you can create your own bounding boxes around sprites by doing simple collision tests.  Check out the OROW game Blackmail in Brooklyn I made using 100% Rawdraw code (including dialogue) for an example.  I never had a chance to clean it up though so it still has a few bugs I never got to fix.  Background by scotch!

http://www11.asphost4free.com/veradinx/blackmail.rar
Title: Re: SUGGESTION: Collision Boxes
Post by: Quintaros on Wed 22/11/2006 23:49:11
I'm currently working on a collision box editor in AGS.Ã,  The user defines collision boxes for each frame of a view and the corner coordinates are written to a .dat file.Ã,  Prior to a fight sequence the .dat file is read so that the coordinates can be used for collision detection.

(http://img2.freeimagehosting.net/uploads/e84a12df90.jpg) (http://www.freeimagehosting.net/)

Here's a screenshot where I was testing the collision detection:

(http://img2.freeimagehosting.net/uploads/e50dea8dbf.jpg) (http://www.freeimagehosting.net/)

Currently the code is specific to my own game but I should be able to generalize it over the weekend so it can be released as a downloadable module.

Title: Re: SUGGESTION: Collision Boxes
Post by: Theme on Mon 27/11/2006 21:09:56
wow thats neat quintaros!
I'll give it a try when you release
o/