Member 3734843 wrote:
I think that this code is pretty simple, why it takes so much power to run?
Well, since String's under the .NET CLR are immutable (cannot change them), every time you make a change to a string you're creating a new 81 MEGABYTE string! [WTF] Each old string is dropped, by not before the new one is created. Multiply that by the number of times you're making a change to the string and you've quite possibly created the worst collision detection algorithm ever.
Member 3734843 wrote:
Is this slow calculation have
anything to do with the programming language - Visual Basic 2008 - .NET Framework 3.5?
Nope. I can assure you, the performance problem is entirely in the design of your algorithm.
Member 3734843 wrote:
Is there anyway to
improve the collision detect performance of this system or this project is doomed?
Until you completely rewrite the detection algo to use the processor more efficiently, you're project is doomed.
Using an array of integers should improve performance dramatically. Completely scraping the array and comparing the bounds of object to object would be far better since you don't have to compare against 81000000 pixels every time you more something by 1 pixel.
It comes down to representing your objects more effificently and in a manner that lends itself to better collision detection. Really, pickup a book or two on game programming. I really can't explain how to do something better in a forum post.