Posted: Mon Jun 02, 2008 8:53 am
Just a little update on the frame rate situation in Oolite. Those of you (PC users mainly) who have witnessed occasional 5-20 seconds frame rate drops, with FPS dropping from 60 to 20 or 21, will be pleased to know that the cause of these delays has been found and hopefully dealt with for 1.72.
The hiccups were happening whenever a trader ship was trying to execute a hyperspace exit. In the exitingTraderAI, the ship is instructed to execute hyperspace exit on every AI update, when in the EXIT_SYSTEM state. When close to the station, this fails, but as soon as it has built enough distance, it makes the jump. The problem is that until it jumps out, it tries to generate system information for all the planets in the current galaxy, in order to locate the ones within jump range. This would happen on every frame. Ouch, too expensive.
Now the required nearby system information is cached, so it is calculated only once. Subsequent calls on each frame will just read the cached information instead of regenerating it, until the ship makes the jump. First tests indicate zero FPS drops.
The hiccups were happening whenever a trader ship was trying to execute a hyperspace exit. In the exitingTraderAI, the ship is instructed to execute hyperspace exit on every AI update, when in the EXIT_SYSTEM state. When close to the station, this fails, but as soon as it has built enough distance, it makes the jump. The problem is that until it jumps out, it tries to generate system information for all the planets in the current galaxy, in order to locate the ones within jump range. This would happen on every frame. Ouch, too expensive.
Now the required nearby system information is cached, so it is calculated only once. Subsequent calls on each frame will just read the cached information instead of regenerating it, until the ship makes the jump. First tests indicate zero FPS drops.