FPS problems!

About two days ago, I had these two goals.. I don't think I could meet them now...
# AI and enemies
# Item drop
The reason is this: when I added in the Item Drop feature, I realized that the game's fps rate fell below 10fps. The result was a choppy mess. Currently I'm using a simple loop - handle input, do logic calculations, draw, and cleanup. Apparently the logic portion is taking up too much time. If anyone has suggestions for optimizations or a better method altogether, please comment...

(log in to comment)

Comments

How are you trying to do the item drop feature? If the fps is ok without it, then it's probably the culprit and can be optomized.
sorry, I meant item pickup... basically, I have a loop that checks to see if the player collides with the powerup item, and if the player does, I remove it and add up on the player's stats. The problem is, I have other code like it, but even more intensive.. they don't affect the fps. You're probably right.. I'll have to check it.
Use distance to check, and don't run the check every frame; every other frame maybe?
have a timer and check for collisions on timer event. This would surely help out. And for collision checking.. check collision only if they are around the user, easy check would be to check collision between user and visible items only. hope this helps :)
If logic is taking a while, I would suggest using psyco ( http://psyco.sourceforge.net/ ) if you are not already. It can speed things up tremendously.
Please don't just resort to using psyco as the first step. Try some of the other suggestions first.
On the other hand, I would rather have non-optimized but psychoed code. But your code shouldn't be throwing away the CPU cycles for nothing either...
Note that psyco only works on 32-bit x86 -- at least give the option for disabling psyco (without venturing into source) so those of us with AMD64 and Macs can play too.