Slow image collision detection

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, robinmiller, kevinmiller, malte

Post Reply
Jock McTartan
Posts: 5
Joined: Tue Jul 25, 2006 12:38 pm

Slow image collision detection

Post by Jock McTartan » Sun Dec 03, 2006 7:40 pm

I decided to write a small demo game - a racecar driving around a track. However, the image collision detection ground to a halt with a large image. I did read the documentation that said try not to use images larger than around 80x80 - but why? To make things simple, I decided to have a small race car image and a large track image (800x570).

I experimented by writing my own image collision routine, which shows a massive speed increase.

I have uploaded a small demo stack to user space Jock_McTartan.
The same demo stack with AE takes around 12 - 15 seconds (on my PC) to detect collisions with all images turned on, compared to 5 - 45 milliseconds! (on the same PC)

Anyway, my question is - am I missing something? Is there an option to speed things up here?

I purchased AE a while ago, but never got around to checking it out. It was a post on the rev. list from someone asking if anyone had used AE that made me dig it out and give it a go.

I know AE is capable of a lot more than just detecting collisions and I still haven't got around to giving it a proper run!

Best regards,


Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany

Post by malte » Sun Dec 03, 2006 10:08 pm

Hey JC,

seems you came up with a much more clever approach than me did. :-)

Well done!

What I do is calculate the smallest rectangle of intersection and then compare the alphadata in that portion. I know it is costy processor wise. When I came up with it I needed the function only for small objects. However yours is much faster than mine. Way cool.

All the best,


Post Reply

Return to “Animation Engine”