okay lets say a game uses a slowrom, which is about 2.7 Mhz, and it is space shooter that slowsdown at with about 10 bullets on screen and 10 enemies.
2,700,000 cycles per second / 60 frames per second = 45,000 cycles per frame
10 bullets * 10 enemies = 100 collision pairs
45,000 cycles per second / 100 collision pairs = 450 cycles per collision pair
What kind of collision detection takes 450 cycles? I myself made an algorithm that only takes up to 44 cycles at max (with 11 cycles being the minimum) but I have no idea how anyone spend a month making such a complicated formula for something that is that fairly simple. I know collision isn't the only thing the cpu has to do but you would think it must take up a large portion of it's time.
I just don't get what is running these programmers minds. People say programmers make slow code when they're rushed, but the only reason why my code is so fast is because I actually made it easy on myself.
It's like this, any normal person, when put in the task of writing something like a collision detection algorithm will think of two options: Will I make the simplest code so I can get done easily, or will I make a complicated code and spend a year on it? Any normal person will choose the first one. But programmers, they think, "I don't have enough time to make any decision what so ever, I must pick the worst of the two because I didn't have enough time to pick the better one" and makes the most complicated codes that take up both their time and also the cpus time. My brain just doesn't work that way sorry. I don't care if your brain works like that, my brain doesn't and will never do.
EDIT: looking around these forums, I found this:
Yes it explains it, A LOT!
2,700,000 cycles per second / 60 frames per second = 45,000 cycles per frame
10 bullets * 10 enemies = 100 collision pairs
45,000 cycles per second / 100 collision pairs = 450 cycles per collision pair
What kind of collision detection takes 450 cycles? I myself made an algorithm that only takes up to 44 cycles at max (with 11 cycles being the minimum) but I have no idea how anyone spend a month making such a complicated formula for something that is that fairly simple. I know collision isn't the only thing the cpu has to do but you would think it must take up a large portion of it's time.
I just don't get what is running these programmers minds. People say programmers make slow code when they're rushed, but the only reason why my code is so fast is because I actually made it easy on myself.
It's like this, any normal person, when put in the task of writing something like a collision detection algorithm will think of two options: Will I make the simplest code so I can get done easily, or will I make a complicated code and spend a year on it? Any normal person will choose the first one. But programmers, they think, "I don't have enough time to make any decision what so ever, I must pick the worst of the two because I didn't have enough time to pick the better one" and makes the most complicated codes that take up both their time and also the cpus time. My brain just doesn't work that way sorry. I don't care if your brain works like that, my brain doesn't and will never do.
EDIT: looking around these forums, I found this:
