Mon Mar 29, 2010 10:58 am by watusimoto
While I was away, I lost track of which version of BF is which! If you are using one that requires Lua to create point objects to do point computations (which you probably are), then the problem is likely due to memory management issues. That is, Lua has to create lots and lots of objects to do the calculations you are asking for, and, with lots of bots and lots of frames, there's a lot of memory allocation, deallocation, and garbage collection going on behind the scenes.
I haven't yet tried your latest bot (but I will just as soon as I can get my development environment back), but it sounds like issues I've seen before and I think that was the cause.
The fix, which is mostly implemented but not yet tested, sitting on the drive of my now broken laptop, dispenses with this by letting you have direct access to the C++ point structs that the game uses to track object position/velocity internally. You should be able to do most of your calculations without creating any new Lua objects as intermediates, and that should make everything run much smoother. Of course, you will not have write access to this data, but you generally don't need it. And, as a bonus, it will look almost exactly the way it does now from the Lua side.
I've had this idea for over a week, and I am really eager to test it out. I'll probably port your bot over as a test. Just as soon as my laptop woes have been dispensed with, that is.